aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Martin <dave.martin@linaro.org>2013-02-06 15:45:23 +0000
committerNicolas Pitre <nicolas.pitre@linaro.org>2013-05-13 19:03:41 -0400
commit56e453ef248c69627f35c7c901838398a4f8bdd4 (patch)
treee9cce06e8daba687b8b3be96f4b76269f057756e
parentcc943eda78d22a16b852c69ecb370f45d5d34999 (diff)
downloadvexpress-lsk-56e453ef248c69627f35c7c901838398a4f8bdd4.tar.gz
ARM: bL_switcher/trace: Add trace trigger for trace bootstrapping
When tracing switching, an external tracer needs a way to bootstrap its knowledge of the logical<->physical CPU mapping. This patch adds a sysfs attribute trace_trigger. A write to this attribute will generate a power:cpu_migrate_current event for each online CPU, indicating the current physical CPU for each logical CPU. Activating or deactivating the switcher also generates these events, so that the tracer knows about the resulting remapping of affected CPUs. Signed-off-by: Dave Martin <dave.martin@linaro.org>
-rw-r--r--arch/arm/common/bL_switcher.c36
-rw-r--r--include/trace/events/power_cpu_migrate.h1
2 files changed, 37 insertions, 0 deletions
diff --git a/arch/arm/common/bL_switcher.c b/arch/arm/common/bL_switcher.c
index fd59d58fe28..b878e6f6dd5 100644
--- a/arch/arm/common/bL_switcher.c
+++ b/arch/arm/common/bL_switcher.c
@@ -26,6 +26,7 @@
#include <linux/notifier.h>
#include <linux/mm.h>
#include <linux/mutex.h>
+#include <linux/smp.h>
#include <linux/string.h>
#include <linux/sysfs.h>
#include <linux/irqchip/arm-gic.h>
@@ -458,6 +459,25 @@ static int bL_switcher_halve_cpus(void)
return 0;
}
+static void bL_switcher_trace_trigger_cpu(void *__always_unused info)
+{
+ trace_cpu_migrate_current(get_ns(), read_mpidr() & MPIDR_HWID_BITMASK);
+}
+
+static int bL_switcher_trace_trigger(void)
+{
+ int ret;
+
+ preempt_disable();
+
+ bL_switcher_trace_trigger_cpu(NULL);
+ ret = smp_call_function(bL_switcher_trace_trigger_cpu, NULL, true);
+
+ preempt_enable();
+
+ return ret;
+}
+
static int bL_switcher_enable(void)
{
int cpu, ret;
@@ -480,6 +500,8 @@ static int bL_switcher_enable(void)
if (ret)
goto error;
+ bL_switcher_trace_trigger();
+
for_each_online_cpu(cpu) {
struct bL_thread *t = &bL_threads[cpu];
init_waitqueue_head(&t->wq);
@@ -568,6 +590,8 @@ static void bL_switcher_disable(void)
}
bL_switcher_restore_cpus();
+ bL_switcher_trace_trigger();
+
bL_activation_notify(BL_NOTIFY_POST_DISABLE);
out:
@@ -601,11 +625,23 @@ static ssize_t bL_switcher_active_store(struct kobject *kobj,
return (ret >= 0) ? count : ret;
}
+static ssize_t bL_switcher_trace_trigger_store(struct kobject *kobj,
+ struct kobj_attribute *attr, const char *buf, size_t count)
+{
+ int ret = bL_switcher_trace_trigger();
+
+ return ret ? ret : count;
+}
+
static struct kobj_attribute bL_switcher_active_attr =
__ATTR(active, 0644, bL_switcher_active_show, bL_switcher_active_store);
+static struct kobj_attribute bL_switcher_trace_trigger_attr =
+ __ATTR(trace_trigger, 0200, NULL, bL_switcher_trace_trigger_store);
+
static struct attribute *bL_switcher_attrs[] = {
&bL_switcher_active_attr.attr,
+ &bL_switcher_trace_trigger_attr.attr,
NULL,
};
diff --git a/include/trace/events/power_cpu_migrate.h b/include/trace/events/power_cpu_migrate.h
index 3694af0f5bc..f76dd4de625 100644
--- a/include/trace/events/power_cpu_migrate.h
+++ b/include/trace/events/power_cpu_migrate.h
@@ -42,6 +42,7 @@ DECLARE_EVENT_CLASS(cpu_migrate,
__define_cpu_migrate_event(begin);
__define_cpu_migrate_event(finish);
+__define_cpu_migrate_event(current);
#undef __define_cpu_migrate
#undef __cpu_migrate_proto