diff options
author | Andy Park <andyp@nvidia.com> | 2012-05-01 08:53:26 -0700 |
---|---|---|
committer | Varun Colbert <vcolbert@nvidia.com> | 2012-05-01 17:01:56 -0700 |
commit | b5e5c73d6d5889d245c17910020f77af5da04a16 (patch) | |
tree | e5d78b3ca59f3ed6508d5048cf982407015270be | |
parent | 828c895ed9e74bffdb55a18d6a010350a4dd7c50 (diff) |
tracing: Add tracepoints for hotplug
Simple trace points for measuring hotplug up/down times.
Bug 960310
Change-Id: I74dd3c5cddcc1ded02ad08a7ce38bacf3147ee3e
Reviewed-on: http://git-master/r/99806
Reviewed-by: Andy Park <andyp@nvidia.com>
Tested-by: Andy Park <andyp@nvidia.com>
Reviewed-by: Prajakta Gudadhe <pgudadhe@nvidia.com>
-rw-r--r-- | include/trace/events/power.h | 29 | ||||
-rw-r--r-- | kernel/cpu.c | 7 |
2 files changed, 36 insertions, 0 deletions
diff --git a/include/trace/events/power.h b/include/trace/events/power.h index 1bcc2a8c00e2..be2325339768 100644 --- a/include/trace/events/power.h +++ b/include/trace/events/power.h @@ -39,8 +39,37 @@ DEFINE_EVENT(cpu, cpu_idle, #define _PWR_EVENT_AVOID_DOUBLE_DEFINING #define PWR_EVENT_EXIT -1 + +enum { + POWER_CPU_UP_START, + POWER_CPU_UP_DONE, + POWER_CPU_DOWN_START, + POWER_CPU_DOWN_DONE, +}; + #endif +TRACE_EVENT(cpu_hotplug, + + TP_PROTO(unsigned int cpu_id, int state), + + TP_ARGS(cpu_id, state), + + TP_STRUCT__entry( + __field(u32, cpu_id) + __field(u32, state) + ), + + TP_fast_assign( + __entry->cpu_id = cpu_id; + __entry->state = state; + ), + + TP_printk("cpu_id=%lu, state=%lu", + (unsigned long)__entry->cpu_id, + (unsigned long)__entry->state) +); + DEFINE_EVENT(cpu, cpu_frequency, TP_PROTO(unsigned int frequency, unsigned int cpu_id), diff --git a/kernel/cpu.c b/kernel/cpu.c index eae3d9b39574..f9bb3d498fb4 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c @@ -16,6 +16,7 @@ #include <linux/mutex.h> #include <linux/gfp.h> #include <linux/suspend.h> +#include <trace/events/power.h> #ifdef CONFIG_SMP /* Serializes the updates to cpu_online_mask, cpu_present_mask */ @@ -274,6 +275,8 @@ int __ref cpu_down(unsigned int cpu) { int err; + trace_cpu_hotplug(cpu, POWER_CPU_DOWN_START); + cpu_maps_update_begin(); if (cpu_hotplug_disabled) { @@ -285,6 +288,7 @@ int __ref cpu_down(unsigned int cpu) out: cpu_maps_update_done(); + trace_cpu_hotplug(cpu, POWER_CPU_DOWN_DONE); return err; } EXPORT_SYMBOL(cpu_down); @@ -335,6 +339,8 @@ int __cpuinit cpu_up(unsigned int cpu) pg_data_t *pgdat; #endif + trace_cpu_hotplug(cpu, POWER_CPU_UP_START); + if (!cpu_possible(cpu)) { printk(KERN_ERR "can't online cpu %d because it is not " "configured as may-hotadd at boot time\n", cpu); @@ -378,6 +384,7 @@ int __cpuinit cpu_up(unsigned int cpu) out: cpu_maps_update_done(); + trace_cpu_hotplug(cpu, POWER_CPU_UP_DONE); return err; } |