[CPUFREQ] x86 cpufreq: Make trace_power_frequency cpufreq driver independent

and fix the broken case if a core's frequency depends on others.

trace_power_frequency was only implemented in a rather ungeneric way
in acpi-cpufreq driver's target() function only.
-> Move the call to trace_power_frequency to
   cpufreq.c:cpufreq_notify_transition() where CPUFREQ_POSTCHANGE
   notifier is triggered.
   This will support power frequency tracing by all cpufreq drivers

trace_power_frequency did not trace frequency changes correctly when
the userspace governor was used or when CPU cores' frequency depend
on each other.
-> Moving this into the CPUFREQ_POSTCHANGE notifier and pass the cpu
   which gets switched automatically fixes this.

Robert Schoene provided some important fixes on top of my initial
quick shot version which are integrated in this patch:
- Forgot some changes in power_end trace (TP_printk/variable names)
- Variable dummy in power_end must now be cpu_id
- Use static 64 bit variable instead of unsigned int for cpu_id

Signed-off-by: Thomas Renninger <trenn@suse.de>
CC: davej@redhat.com
CC: arjan@infradead.org
CC: linux-kernel@vger.kernel.org
CC: robert.schoene@tu-dresden.de
Tested-by: robert.schoene@tu-dresden.de
Signed-off-by: Dave Jones <davej@redhat.com>
This commit is contained in:
Thomas Renninger
2010-04-20 13:17:36 +02:00
committed by Dave Jones
parent 6b72e3934b
commit 6f4f2723d0
6 changed files with 31 additions and 25 deletions

View File

@ -300,8 +300,9 @@ struct trace_entry {
struct power_entry {
struct trace_entry te;
s64 type;
s64 value;
u64 type;
u64 value;
u64 cpu_id;
};
#define TASK_COMM_LEN 16
@ -498,13 +499,13 @@ static int process_sample_event(event_t *event, struct perf_session *session)
return 0;
if (strcmp(event_str, "power:power_start") == 0)
c_state_start(data.cpu, data.time, pe->value);
c_state_start(pe->cpu_id, data.time, pe->value);
if (strcmp(event_str, "power:power_end") == 0)
c_state_end(data.cpu, data.time);
c_state_end(pe->cpu_id, data.time);
if (strcmp(event_str, "power:power_frequency") == 0)
p_state_change(data.cpu, data.time, pe->value);
p_state_change(pe->cpu_id, data.time, pe->value);
if (strcmp(event_str, "sched:sched_wakeup") == 0)
sched_wakeup(data.cpu, data.time, data.pid, te);