Make cpu_idle events architecture independent
Subsystems (11)
cover Make cpu_idle events architecture independent
and cleanup/fix some related stuff.
The patches are based on latest linux-2.6-x86 tree.
I had to revert some latest userspace perf patches to test
as they seem to be buggy, but they should not interfere with these changes.
As most/all are rather easy patches it would be great to still get them queued up in linux-2.6-x86 tree for 2.6.38 inclusion.
Thanks,
Thomas
Thomas Renninger (9):
acpi: Use ACPI C-state type instead of enumeration value to export
cpuidle state name
cpuidle: Rename X86 specific idle poll state[0] from C0 to POLL X86/perf: fix power:cpu_idle double end events and throw cpu_idle
events from the cpuidle layer
cpuidle: Introduce .abbr (abbrevation) for cpuidle states
acpi: processor->cpuidle: Only set cpuidle check_bm flag if
pr->flags.bm_check is set
perf (userspace): Fix variable clash with glibc time() func perf (userspace): Introduce --verbose param for perf timechart perf timechart: Map power:cpu_idle events to the corresponding
cpuidle state
perf: timechart: Fix memleak
arch/arm/mach-at91/cpuidle.c | 12 ++- arch/arm/mach-davinci/cpuidle.c | 13 ++- arch/arm/mach-kirkwood/cpuidle.c | 12 ++- arch/arm/mach-omap2/cpuidle34xx.c | 3 +- arch/sh/kernel/cpu/shmobile/cpuidle.c | 19 ++-- arch/x86/kernel/process.c | 6 +- arch/x86/kernel/process_32.c | 4 - arch/x86/kernel/process_64.c | 6 - drivers/acpi/processor_idle.c | 10 ++- drivers/cpuidle/cpuidle.c | 13 ++- drivers/cpuidle/sysfs.c | 3 + drivers/idle/intel_idle.c | 13 ++- include/linux/cpuidle.h | 2 + tools/perf/builtin-timechart.c | 15 +++ tools/perf/util/include/linux/cpuidle.h | 20 ++++ tools/perf/util/svghelper.c | 154 +++++++++++++++++++++++++++---- 16 files changed, 248 insertions(+), 57 deletions(-) create mode 100644 tools/perf/util/include/linux/cpuidle.h
Signature · 1 line
1.7.3.1
PATCH 1/9 acpi: Use ACPI C-state type instead of enumeration value to export cpuidle state name
In the former /proc/acpi/processor/power/* there were Cx showing the enumerated number/amount of C-states and type[Cy] which is what should get shown as the cpuidle state name.
Typically on latest Nehalem and later CPUs, BIOS vendors miss out C2 and C3 wrongly shows up as C2.
--- drivers/acpi/processor_idle.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/acpi/processor_idle.c +3 -1
@@ -1008,7 +1008,6 @@ static int acpi_processor_setup_cpuidle(struct acpi_processor *pr)#endif cpuidle_set_statedata (state, cx); -snprintf (state->name,CPUIDLE_NAME_LEN ,"C%d" , i);strncpy (state->desc, cx->desc,CPUIDLE_DESC_LEN ); state->exit_latency = cx->latency; state->target_residency = cx->latency * latency_factor;
@@ -1016,6 +1015,7 @@ static int acpi_processor_setup_cpuidle(struct acpi_processor *pr) state->flags =0 ;switch (cx->type) {case ACPI_STATE_C1 : +snprintf (state->name,CPUIDLE_NAME_LEN ,"C1" ); state->flags |=CPUIDLE_FLAG_SHALLOW ;if (cx->entry_method ==ACPI_CSTATE_FFH ) state->flags |=CPUIDLE_FLAG_TIME_VALID ;
@@ -1025,6 +1025,7 @@ static int acpi_processor_setup_cpuidle(struct acpi_processor *pr)break ;case ACPI_STATE_C2 : +snprintf (state->name,CPUIDLE_NAME_LEN ,"C2" ); state->flags |=CPUIDLE_FLAG_BALANCED ; state->flags |=CPUIDLE_FLAG_TIME_VALID ; state->enter = acpi_idle_enter_simple;
@@ -1032,6 +1033,7 @@ static int acpi_processor_setup_cpuidle(struct acpi_processor *pr)break ;case ACPI_STATE_C3 : +snprintf (state->name,CPUIDLE_NAME_LEN ,"C3" ); state->flags |=CPUIDLE_FLAG_DEEP ; state->flags |=CPUIDLE_FLAG_TIME_VALID ; state->flags |=CPUIDLE_FLAG_CHECK_BM ;
Signature · 1 line
1.7.3.1
Len Brown
reviewerRe: [PATCH 1/9] acpi: Use ACPI C-state type instead of enumeration value to export cpuidle state name
Quoted 6 lines · Thomas Renninger
In the former
/proc/acpi/processor/power/*there were Cx showing the enumerated number/amount of C-states and type[Cy] which is what should get shown as the cpuidle state name.Typically on latest Nehalem and later CPUs, BIOS vendors miss out C2 and C3 wrongly shows up as C2.
I think this patch will cause more confusion than it will fix.
It assumes that all states of type C2 should have the name "C2" and all the states of type "C3" should have the name "C3". But some systems may have more than one state of each type...
also, the state->name is somewhat arbitrary.
You'll notice that intel_idle uses the hardware C-state names such as NHM-C1, NHM-C3, NHM-C6 - to match the (arbitrary) names in the hardware documentation. We could call those states Moe/Larry/Curley just as well.
If somebody wants to know what the state _is_, then the state->desc field shows them in un-ambiguous terms, "MWAIT 0x10" etc.
if somebody wants to simply enumerate the states, so they can use acpi.max_cstate=N, for example, then cpuidle already enumerates them in /sys/devices/system/cpu/cpu0/cpuidle/state%d
thanks,
Len Brown, Intel Open Source Technology Center
ps. the thing about "mising C2". That isn't a bug. That is actually BIOS writer's attempt to not break the installed base of Linux. NHM doesn't actually have any ACPI C3-type states, just C2-type states. But in NHM, the LAPIC timer stops in C2-type states, so the BIOS advertises them as C2-type to make sure that an old version of Linux doesn't attempt to use the LAPIC timer in those states.
(we switched to not trusting the LAPIC timer even in C2-type states a while back, but the installed base never gets updated)
pps. I do think we need to be able to dump
the _CST, as we lost the ACPI type info that
was in /proc/acpi/processor/*/power and we
may need it to debug some systems.
Quoted 48 lines
Signed-off-by Thomas Renninger <[email protected]>--- drivers/acpi/processor_idle.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)drivers/acpi/processor_idle.c +3
-1@@ -1008,7 +1008,6 @@ static int acpi_processor_setup_cpuidle(struct acpi_processor *pr)#endif cpuidle_set_statedata (state, cx); -snprintf (state->name,CPUIDLE_NAME_LEN ,"C%d" , i);strncpy (state->desc, cx->desc,CPUIDLE_DESC_LEN ); state->exit_latency = cx->latency; state->target_residency = cx->latency * latency_factor;@@ -1016,6 +1015,7 @@ static int acpi_processor_setup_cpuidle(struct acpi_processor *pr) state->flags =0 ;switch (cx->type) {case ACPI_STATE_C1 : +snprintf (state->name,CPUIDLE_NAME_LEN ,"C1" ); state->flags |=CPUIDLE_FLAG_SHALLOW ;if (cx->entry_method ==ACPI_CSTATE_FFH ) state->flags |=CPUIDLE_FLAG_TIME_VALID ;@@ -1025,6 +1025,7 @@ static int acpi_processor_setup_cpuidle(struct acpi_processor *pr)break ;case ACPI_STATE_C2 : +snprintf (state->name,CPUIDLE_NAME_LEN ,"C2" ); state->flags |=CPUIDLE_FLAG_BALANCED ; state->flags |=CPUIDLE_FLAG_TIME_VALID ; state->enter = acpi_idle_enter_simple;@@ -1032,6 +1033,7 @@ static int acpi_processor_setup_cpuidle(struct acpi_processor *pr)break ;case ACPI_STATE_C3 : +snprintf (state->name,CPUIDLE_NAME_LEN ,"C3" ); state->flags |=CPUIDLE_FLAG_DEEP ; state->flags |=CPUIDLE_FLAG_TIME_VALID ; state->flags |=CPUIDLE_FLAG_CHECK_BM ;Signature · 1 line
1.7.3.1
Re: [PATCH 1/9] acpi: Use ACPI C-state type instead of enumeration value to export cpuidle state name
Quoted 6 lines · On Friday 07 January 2011 21:45:18 Len Brown wrote:
Quoted 4 lines · Thomas Renninger
In the former
/proc/acpi/processor/power/*there were Cx showing the enumerated number/amount of C-states and type[Cy] which is what should get shown as the cpuidle state name.
Quoted 7 lines
Quoted 2 lines
Typically on latest Nehalem and later CPUs, BIOS vendors miss out C2 and C3 wrongly shows up as C2.
I think this patch will cause more confusion than it will fix.
It assumes that all states of type C2 should have the name "C2" and all the states of type "C3" should have the name "C3".
Right.
Quoted 1 line
But some systems may have more than one state of each type...
Exported through ACPI tables?
Quoted 6 lines
also, the
state->nameis somewhat arbitrary.You'll notice that
intel_idleuses the hardware C-state names such as NHM-C1, NHM-C3, NHM-C6 - to match the (arbitrary) names in the hardware documentation. We could call those states Moe/Larry/Curley just as well.
That works out with HW specific intel_idle.c driver, but not with the generic acpi/processor one.
Quoted 3 lines
If somebody wants to know what the state _is_, then the
state->descfield shows them in un-ambiguous terms, "MWAIT0x10" etc.
Right, people can/should use it for additional info.
Quoted 4 lines
if somebody wants to simply enumerate the states, so they can use acpi.max_cstate=N, for example, then cpuidle already enumerates them in /sys/devices/system/cpu/cpu0/cpuidle/state%d
Not sure I get this.
Currently you have:/sys/../stateX/... /sys/devices/system/cpu/cpu0/cpuidle/state%d/name
and stateX (the directory name) and stateX/name contain duplicate info:
X and CX.
in acpi cpuidle driver case.
While the C-state type as exported by BIOS may not always be correct, it contains more info as the current approach, which has zero info.
The other ACPI related patches are ok?
What do you think of cpu_idle events thrown as real cpuidle subsystem events to make them architecture independent and break up the unnecessary complexity (intel_idle throws the idle start and cpuidle the end event, etc.).
Quoted 15 lines
thanks,
Len Brown, Intel Open Source Technology Centerps. the thing about "mising C2". That isn't a bug. That is actually BIOS writer's attempt to not break the installed base of Linux. NHM doesn't actually have any ACPI C3-type states, just C2-type states. But in NHM, the LAPIC timer stops in C2-type states, so the BIOS advertises them as C2-type to make sure that an old version of Linux doesn't attempt to use the LAPIC timer in those states.
(we switched to not trusting the LAPIC timer even in C2-type states a while back, but the installed base never gets updated)
Quoted 4 lines
pps. I do think we need to be able to dump
the_CST, as we lost the ACPI type info that
was in/proc/acpi/processor/*/powerand we
may need it to debug some systems.
?
I restore the ACPI type info as exported by ACPI tables with this patch, should be the same as done with /proc/acpi/processor/*/power
Do I miss something?
Do you want to export additional ACPI table C-state info?
Something else, but related:
You recently said that it might be a good idea to get C-/P- state ACPI tables which are often in a separate SSDT loaded at runtime via "load" ACPI command, dumped with the acpidump tool. This would be a cool feature. Does dynamically loaded SSDT dumping
via acpidump work already or is/has someone looked at this?
Thanks,
Thomas
Quoted 50 lines
Quoted 49 lines
Signed-off-by Thomas Renninger <[email protected]>--- drivers/acpi/processor_idle.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)drivers/acpi/processor_idle.c +3
-1@@ -1008,7 +1008,6 @@ static int acpi_processor_setup_cpuidle(struct acpi_processor *pr)#endif cpuidle_set_statedata (state, cx); -snprintf (state->name,CPUIDLE_NAME_LEN ,"C%d" , i);strncpy (state->desc, cx->desc,CPUIDLE_DESC_LEN ); state->exit_latency = cx->latency; state->target_residency = cx->latency * latency_factor;@@ -1016,6 +1015,7 @@ static int acpi_processor_setup_cpuidle(struct acpi_processor *pr) state->flags =0 ;switch (cx->type) {case ACPI_STATE_C1 : +snprintf (state->name,CPUIDLE_NAME_LEN ,"C1" ); state->flags |=CPUIDLE_FLAG_SHALLOW ;if (cx->entry_method ==ACPI_CSTATE_FFH ) state->flags |=CPUIDLE_FLAG_TIME_VALID ;@@ -1025,6 +1025,7 @@ static int acpi_processor_setup_cpuidle(struct acpi_processor *pr)break ;case ACPI_STATE_C2 : +snprintf (state->name,CPUIDLE_NAME_LEN ,"C2" ); state->flags |=CPUIDLE_FLAG_BALANCED ; state->flags |=CPUIDLE_FLAG_TIME_VALID ; state->enter = acpi_idle_enter_simple;@@ -1032,6 +1033,7 @@ static int acpi_processor_setup_cpuidle(struct acpi_processor *pr)break ;case ACPI_STATE_C3 : +snprintf (state->name,CPUIDLE_NAME_LEN ,"C3" ); state->flags |=CPUIDLE_FLAG_DEEP ; state->flags |=CPUIDLE_FLAG_TIME_VALID ; state->flags |=CPUIDLE_FLAG_CHECK_BM ;Signature · 1 line
1.7.3.1
Len Brown
reviewerRe: [PATCH 1/9] acpi: Use ACPI C-state type instead of enumeration value to export cpuidle state name
Quoted 3 lines
Quoted 1 line
But some systems may have more than one state of each type...
Exported through ACPI tables?
Yes.
It is quite common, for example in the Pentium M
generations, for a BIOS to export C3 and C4 -
both of which are ACPI C3-type.
Quoted 9 lines
Quoted 6 lines
also, the
state->nameis somewhat arbitrary.You'll notice that
intel_idleuses the hardware C-state names such as NHM-C1, NHM-C3, NHM-C6 - to match the (arbitrary) names in the hardware documentation. We could call those states Moe/Larry/Curley just as well.That works out with HW specific
intel_idle.cdriver, but not with the generic acpi/processor one.
Actually, C0..Cn work out fine for the acpi/processor driver. the names are unique, and they also correspond to max_cstate if somebody wants to use that.
Quoted 4 lines
I restore the ACPI type info as exported by ACPI tables with this patch, should be the same as done with
/proc/acpi/processor/*/power
Do I miss something?
/proc/acpi/processor/*/power had a type field. Per the example above, the type field didn't always match the C-state number.
Quoted 2 lines
Do you want to export additional ACPI table C-state info?
I have a 1 line patch someplace to print out the type for debug info when needed, that should be sufficient for debugging, which is the only time we care about type.
Quoted 7 lines
Something else, but related:
You recently said that it might be a good idea to get C-/P- state ACPI tables which are often in a separate SSDT loaded at runtime via "load" ACPI command, dumped with the acpidump tool. This would be a cool feature. Does dynamically loaded SSDT dumping
via acpidump work already or is/has someone looked at this?
Yakui fixed this a while back.
acpidump in the latest pmtools in
http://userweb.kernel.org/~lenb/acpi/utils/
picks up the dynamic tables from /sys/firmware/acpi/tables.
cheers,
Len Brown, Intel Open Source Technology Center
Re: [PATCH 1/9] acpi: Use ACPI C-state type instead of enumeration value to export cpuidle state name
Quoted 9 lines · On Wednesday 12 January 2011 07:36:17 Len Brown wrote:
Quoted 3 lines
Quoted 1 line
But some systems may have more than one state of each type...
Exported through ACPI tables?
Yes.
It is quite common, for example in the Pentium M
generations, for a BIOS to export C3 and C4 -
both of which are ACPI C3-type.
Then you have two C3 types/names, this doesn't hurt. It's even "more" correct than enumeration (expecting that C2 is missing which can happen, right?):
C1 -> C1
C2 -> C3
C3 -> C4
As you already said, people have to look closer at the description file anyway. There is not much we can/should do about that in the generic acpi_idle driver (beside a note in Documentation/...).
Quoted 7 lines
Quoted 6 lines
Quoted 6 lines
also, the
state->nameis somewhat arbitrary.You'll notice that
intel_idleuses the hardware C-state names such as NHM-C1, NHM-C3, NHM-C6 - to match the (arbitrary) names in the hardware documentation. We could call those states Moe/Larry/Curley just as well.
Quoted 6 lines
Quoted 2 lines
That works out with HW specific
intel_idle.cdriver, but not with the generic acpi/processor one.Actually, C0..Cn work out fine for the acpi/processor driver. the names are unique, and they also correspond to
max_cstateif somebody wants to use that.
I do not like the fact that the name contains zero info and still is wrong and will still cause confusion (enumerating from C0-Cx will also not match C-states as described in documentations, but at least match the type as exported by BIOS vendors).
if [ cat /sys/devices/system/cpu/cpuidle/current_driver = "acpi_idle" ];then
for ((x=1; x<10; x++));do
[ ! -d /sys/devices/system/cpu/cpu0/cpuidle/state${x} ] && break
if [ `cat /sys/devices/system/cpu/cpu0/cpuidle/state${x}/name` = C${x} ];then
echo "The same"
fi done
fi
The same
The same
The same
Currently it will always be "The same".
Quoted 8 lines
Quoted 4 lines
I restore the ACPI type info as exported by ACPI tables with this patch, should be the same as done with
/proc/acpi/processor/*/power
Do I miss something?
/proc/acpi/processor/*/powerhad a type field. Per the example above, the type field didn't always match the C-state number.
But compared to plain enumeration it has at least some use (see your own comment below).
And if OEMs care (and some probably would) they can export the type they like to see and it gets passed from the BIOS tables up to the very high end userspace/customer tools.
I know Intel uses intel_idle, but there are others which make use of ACPI C-states.
Quoted 6 lines
Quoted 2 lines
Do you want to export additional ACPI table C-state info?
I have a 1 line patch someplace to print out the type for debug info when needed, that should be sufficient for debugging, which is the only time we care about type.
To be honest I do not care about this detail that much. I think it would be nicer to export the C-state type in the name. Name and description is cpuidle driver (in this case acpi_idle) specific info, why shouldn't processor_idle fill it with something which has at least some meaning.
Quoted 8 lines
Quoted 7 lines
Something else, but related:
You recently said that it might be a good idea to get C-/P- state ACPI tables which are often in a separate SSDT loaded at runtime via "load" ACPI command, dumped with the acpidump tool. This would be a cool feature. Does dynamically loaded SSDT dumping
via acpidump work already or is/has someone looked at this?
Quoted 4 lines
Yakui fixed this a while back.
acpidump in the latest pmtools in
http://userweb.kernel.org/~lenb/acpi/utils/
picks up the dynamic tables from/sys/firmware/acpi/tables.
Great!
I didn't update acpidump for quite some time as I hoped it shows up in the acpica project and also did some adjustance for this already. I'll grab it for 11.4.
Thomas
Len Brown
reviewerRe: [PATCH 1/9] acpi: Use ACPI C-state type instead of enumeration value to export cpuidle state name
Thomas,
I think the ACPI C-state names are fine the way they are.
I don't understand the value proposition you have presented to replace the C-state names with ACPI C-state types.
I think this would be extremely confusing, particularly since it would mean that multiple states can then appear with duplicate names.
Thus I do not recommend changing the format of the name that we have been exporting since cpuidle went upstream 3 years ago.
thanks,
Len Brown, Intel Open Source Technology Center
PATCH 2/9 cpuidle: Rename X86 specific idle poll state[0] from C0 to POLL
In reply to Thomas RenningerC0 means and is well know as "not idle".
All documentation out there uses this term as "running"/"not idle" state. Also Linux userspace tools (e.g. cpufreq-aperf and turbostat) show C0 residency which there is correct, but means something totally else than cpuidle "POLL" state.
--- drivers/cpuidle/cpuidle.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/cpuidle/cpuidle.c +1 -1
@@ -260,7 +260,7 @@ static void poll_idle_init(struct cpuidle_device *dev)cpuidle_set_statedata (state,NULL ); -snprintf (state->name,CPUIDLE_NAME_LEN ,"C0" ); +snprintf (state->name,CPUIDLE_NAME_LEN ,"POLL" );snprintf (state->desc,CPUIDLE_DESC_LEN ,"CPUIDLE CORE POLL IDLE" ); state->exit_latency =0 ; state->target_residency =0 ;
Signature · 1 line
1.7.3.1
Len Brown
reviewerRe: [PATCH 2/9] cpuidle: Rename X86 specific idle poll state[0] from C0 to POLL
applied to idle-test
thanks,
Len Brown, Intel Open Source Technology Center
PATCH 3/9 X86/perf: fix power:cpu_idle double end events and throw cpu_idle events from the cpuidle layer
In reply to Thomas RenningerCurrently intel_idle and acpi_idle driver show double cpu_idle "exit idle" events -> this patch fixes it and makes cpu_idle events throwing less complex.
It also introduces cpu_idle events for all architectures which use the cpuidle subsystem, namely:
- arch/arm/mach-at91/cpuidle.c
- arch/arm/mach-davinci/cpuidle.c
- arch/arm/mach-kirkwood/cpuidle.c
- arch/arm/mach-omap2/cpuidle34xx.c
- arch/drivers/acpi/processor_idle.c (for all cases, not only mwait)
- arch/x86/kernel/process.c (did throw events before, but was a mess)
- drivers/idle/intel_idle.c (did throw events before)
Convention should be:
Fire cpu_idle events inside the current pm_idle function (not somewhere down the the callee tree) to keep things easy.
Current possible pm_idle functions in X86:c1e_idle, poll_idle, cpuidle_idle_call, mwait_idle, default_idle -> this is really easy is now.
This affects userspace:
The type field of the cpu_idle power event can now direclty get mapped to:/sys/devices/system/cpu/cpuX/cpuidle/stateX/{name,desc,usage,time,...} instead of throwing very CPU/mwait specific values.
This change is not visible for the intel_idle driver.
For the acpi_idle driver it should only be visible if the vendor misses out C-states in his BIOS.
Another (perf timechart) patch reads out cpuidle info of cpu_idle events from:/sys/.../cpuidle/stateX/*, then the cpuidle events are mapped to the correct C-/cpuidle state again, even if e.g. vendors miss out C-states in their BIOS and for example only export C1 and C3. -> everything is fine.
--- arch/x86/kernel/process.c | 6 ++++-- arch/x86/kernel/process_32.c | 4 ---- arch/x86/kernel/process_64.c | 6 ------ drivers/cpuidle/cpuidle.c | 10 ++++++++-- drivers/idle/intel_idle.c | 2 -- 5 files changed, 12 insertions(+), 16 deletions(-)
arch/x86/kernel/process.c +4 -2
@@ -385,6 +385,8 @@ void default_idle(void)else local_irq_enable ();current_thread_info ()->status |=TS_POLLING ; +trace_power_end (smp_processor_id ()); +trace_cpu_idle (PWR_EVENT_EXIT ,smp_processor_id ()); }else {local_irq_enable ();/* loop is done by the caller */
@@ -442,8 +444,6 @@ EXPORT_SYMBOL_GPL(cpu_idle_wait);*/ void mwait_idle_with_hints (unsigned long ax,unsigned long cx) { -trace_power_start (POWER_CSTATE , (ax>>4 )+1 ,smp_processor_id ()); -trace_cpu_idle ((ax>>4 )+1 ,smp_processor_id ());if (!need_resched ()) {if (cpu_has (¤t_cpu_data,X86_FEATURE_CLFLUSH_MONITOR ))clflush ((void *)¤t_thread_info ()->flags);
@@ -470,6 +470,8 @@ static void mwait_idle(void)__sti_mwait (0 ,0 ); elselocal_irq_enable (); +trace_power_end (smp_processor_id ()); +trace_cpu_idle (PWR_EVENT_EXIT ,smp_processor_id ()); }else local_irq_enable (); }
arch/x86/kernel/process_32.c +0 -4
@@ -57,8 +57,6 @@#include <asm/syscalls.h> #include <asm/debugreg.h> -#include <trace/events/power.h> - asmlinkage void ret_from_fork(void) __asm__("ret_from_fork");/*
@@ -113,8 +111,6 @@ void cpu_idle(void)stop_critical_timings ();pm_idle ();start_critical_timings (); -trace_power_end (smp_processor_id ()); -trace_cpu_idle (PWR_EVENT_EXIT ,smp_processor_id ()); }tick_nohz_restart_sched_tick ();preempt_enable_no_resched ();
arch/x86/kernel/process_64.c +0 -6
@@ -51,8 +51,6 @@#include <asm/syscalls.h> #include <asm/debugreg.h> -#include <trace/events/power.h> - asmlinkage extern void ret_from_fork(void); DEFINE_PER_CPU(unsigned long, old_rsp);
@@ -141,10 +139,6 @@ void cpu_idle(void)pm_idle ();start_critical_timings (); -trace_power_end (smp_processor_id ()); -trace_cpu_idle (PWR_EVENT_EXIT , -smp_processor_id ()); -/* In many cases the interrupt that ended idle has already called exit_idle. But some idle loops can be woken up without interrupt. */
drivers/cpuidle/cpuidle.c +8 -2
@@ -96,7 +96,15 @@ static void cpuidle_idle_call(void)/* enter the state and update stats */ dev->last_state = target_state; + +trace_power_start (POWER_CSTATE , next_state, dev->cpu); +trace_cpu_idle (next_state, dev->cpu); + dev->last_residency = target_state->enter (dev, target_state); + +trace_power_end (dev->cpu); +trace_cpu_idle (PWR_EVENT_EXIT , dev->cpu); +if (dev->last_state) target_state = dev->last_state;
@@ -106,8 +114,6 @@ static void cpuidle_idle_call(void)/* give the governor an opportunity to reflect on the outcome */ if (cpuidle_curr_governor->reflect) cpuidle_curr_governor->reflect (dev); -trace_power_end (smp_processor_id ()); -trace_cpu_idle (PWR_EVENT_EXIT ,smp_processor_id ()); }/**
drivers/idle/intel_idle.c +0 -2
@@ -220,8 +220,6 @@ static int intel_idle(struct cpuidle_device *dev, struct cpuidle_state *state) kt_before =ktime_get_real ();stop_critical_timings (); -trace_power_start (POWER_CSTATE , (eax >>4 ) +1 , cpu); -trace_cpu_idle ((eax >>4 ) +1 , cpu);if (!need_resched ()) {__monitor ((void *)¤t_thread_info ()->flags,0 ,0 );
Signature · 1 line
1.7.3.1
Re: [PATCH 3/9] X86/perf: fix power:cpu_idle double end events and throw cpu_idle events from the cpuidle layer
I'm happy to see the trace point move up into cpuidle from intel_idle.
If somebody is picking this up in a perf tree,
else I can put it in the idle tree, let me know.
thanks,
Len Brown, Intel Open Source Technology Center
Re: [PATCH 3/9] X86/perf: fix power:cpu_idle double end events and throw cpu_idle events from the cpuidle layer
Quoted 6 lines · On Wednesday 12 January 2011 07:42:59 Len Brown wrote:
I'm happy to see the trace point move up into cpuidle from
intel_idle.If somebody is picking this up in a perf tree,
Acked-by Len Brown <[email protected]>else I can put it in the idle tree, let me know.
I didn't know you have an idle tree.
If you can push this one through the idle tree that would be great.
I'll go through the rest of my patches and resubmit in some days as soon as some things are clarified.
But I need this one to still be included in .38.
Please tell me if this could be a problem.
Thanks,
Thomas
Len Brown
reviewerRe: [PATCH 3/9] X86/perf: fix power:cpu_idle double end events and throw cpu_idle events from the cpuidle layer
Applied to idle-test
git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-idle-2.6.git idle-test
Thomas,
Please test this branch, and base your incremental patches on it.
thanks,
Len Brown, Intel Open Source Technology Center
Len Brown
reviewerRe: [PATCH 3/9] X86/perf: fix power:cpu_idle double end events and throw cpu_idle events from the cpuidle layer
In reply to Thomas RenningerApplied to idle-test
git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-idle-2.6.git idle-test
Thomas,
Please test this branch, and base your incremental patches on it.
thanks,
Len Brown, Intel Open Source Technology Center
Re: [PATCH 3/9] X86/perf: fix power:cpu_idle double end events and throw cpu_idle events from the cpuidle layer
In reply to Len BrownQuoted 6 lines · On Wednesday 12 January 2011 07:42:59 Len Brown wrote:
I'm happy to see the trace point move up into cpuidle from
intel_idle.If somebody is picking this up in a perf tree,
Acked-by Len Brown <[email protected]>else I can put it in the idle tree, let me know.
I didn't know you have an idle tree.
If you can push this one through the idle tree that would be great.
I'll go through the rest of my patches and resubmit in some days as soon as some things are clarified.
But I need this one to still be included in .38.
Please tell me if this could be a problem.
Thanks,
Thomas
Re: [PATCH 3/9] X86/perf: fix power:cpu_idle double end events and throw cpu_idle events from the cpuidle layer
In reply to Thomas RenningerI'm happy to see the trace point move up into cpuidle from intel_idle.
If somebody is picking this up in a perf tree,
else I can put it in the idle tree, let me know.
thanks,
Len Brown, Intel Open Source Technology Center
PATCH 3/9 X86/perf: fix power:cpu_idle double end events and throw cpu_idle events from the cpuidle layer
In reply to Thomas RenningerCurrently intel_idle and acpi_idle driver show double cpu_idle "exit idle" events -> this patch fixes it and makes cpu_idle events throwing less complex.
It also introduces cpu_idle events for all architectures which use the cpuidle subsystem, namely:
- arch/arm/mach-at91/cpuidle.c
- arch/arm/mach-davinci/cpuidle.c
- arch/arm/mach-kirkwood/cpuidle.c
- arch/arm/mach-omap2/cpuidle34xx.c
- arch/drivers/acpi/processor_idle.c (for all cases, not only mwait)
- arch/x86/kernel/process.c (did throw events before, but was a mess)
- drivers/idle/intel_idle.c (did throw events before)
Convention should be:
Fire cpu_idle events inside the current pm_idle function (not somewhere down the the callee tree) to keep things easy.
Current possible pm_idle functions in X86:c1e_idle, poll_idle, cpuidle_idle_call, mwait_idle, default_idle -> this is really easy is now.
This affects userspace:
The type field of the cpu_idle power event can now direclty get mapped to:/sys/devices/system/cpu/cpuX/cpuidle/stateX/{name,desc,usage,time,...} instead of throwing very CPU/mwait specific values.
This change is not visible for the intel_idle driver.
For the acpi_idle driver it should only be visible if the vendor misses out C-states in his BIOS.
Another (perf timechart) patch reads out cpuidle info of cpu_idle events from:/sys/.../cpuidle/stateX/*, then the cpuidle events are mapped to the correct C-/cpuidle state again, even if e.g. vendors miss out C-states in their BIOS and for example only export C1 and C3. -> everything is fine.
--- arch/x86/kernel/process.c | 6 ++++-- arch/x86/kernel/process_32.c | 4 ---- arch/x86/kernel/process_64.c | 6 ------ drivers/cpuidle/cpuidle.c | 10 ++++++++-- drivers/idle/intel_idle.c | 2 -- 5 files changed, 12 insertions(+), 16 deletions(-)
arch/x86/kernel/process.c +4 -2
@@ -385,6 +385,8 @@ void default_idle(void)else local_irq_enable ();current_thread_info ()->status |=TS_POLLING ; +trace_power_end (smp_processor_id ()); +trace_cpu_idle (PWR_EVENT_EXIT ,smp_processor_id ()); }else {local_irq_enable ();/* loop is done by the caller */
@@ -442,8 +444,6 @@ EXPORT_SYMBOL_GPL(cpu_idle_wait);*/ void mwait_idle_with_hints (unsigned long ax,unsigned long cx) { -trace_power_start (POWER_CSTATE , (ax>>4 )+1 ,smp_processor_id ()); -trace_cpu_idle ((ax>>4 )+1 ,smp_processor_id ());if (!need_resched ()) {if (cpu_has (¤t_cpu_data,X86_FEATURE_CLFLUSH_MONITOR ))clflush ((void *)¤t_thread_info ()->flags);
@@ -470,6 +470,8 @@ static void mwait_idle(void)__sti_mwait (0 ,0 ); elselocal_irq_enable (); +trace_power_end (smp_processor_id ()); +trace_cpu_idle (PWR_EVENT_EXIT ,smp_processor_id ()); }else local_irq_enable (); }
arch/x86/kernel/process_32.c +0 -4
@@ -57,8 +57,6 @@#include <asm/syscalls.h> #include <asm/debugreg.h> -#include <trace/events/power.h> - asmlinkage void ret_from_fork(void) __asm__("ret_from_fork");/*
@@ -113,8 +111,6 @@ void cpu_idle(void)stop_critical_timings ();pm_idle ();start_critical_timings (); -trace_power_end (smp_processor_id ()); -trace_cpu_idle (PWR_EVENT_EXIT ,smp_processor_id ()); }tick_nohz_restart_sched_tick ();preempt_enable_no_resched ();
arch/x86/kernel/process_64.c +0 -6
@@ -51,8 +51,6 @@#include <asm/syscalls.h> #include <asm/debugreg.h> -#include <trace/events/power.h> - asmlinkage extern void ret_from_fork(void); DEFINE_PER_CPU(unsigned long, old_rsp);
@@ -141,10 +139,6 @@ void cpu_idle(void)pm_idle ();start_critical_timings (); -trace_power_end (smp_processor_id ()); -trace_cpu_idle (PWR_EVENT_EXIT , -smp_processor_id ()); -/* In many cases the interrupt that ended idle has already called exit_idle. But some idle loops can be woken up without interrupt. */
drivers/cpuidle/cpuidle.c +8 -2
@@ -96,7 +96,15 @@ static void cpuidle_idle_call(void)/* enter the state and update stats */ dev->last_state = target_state; + +trace_power_start (POWER_CSTATE , next_state, dev->cpu); +trace_cpu_idle (next_state, dev->cpu); + dev->last_residency = target_state->enter (dev, target_state); + +trace_power_end (dev->cpu); +trace_cpu_idle (PWR_EVENT_EXIT , dev->cpu); +if (dev->last_state) target_state = dev->last_state;
@@ -106,8 +114,6 @@ static void cpuidle_idle_call(void)/* give the governor an opportunity to reflect on the outcome */ if (cpuidle_curr_governor->reflect) cpuidle_curr_governor->reflect (dev); -trace_power_end (smp_processor_id ()); -trace_cpu_idle (PWR_EVENT_EXIT ,smp_processor_id ()); }/**
drivers/idle/intel_idle.c +0 -2
@@ -220,8 +220,6 @@ static int intel_idle(struct cpuidle_device *dev, struct cpuidle_state *state) kt_before =ktime_get_real ();stop_critical_timings (); -trace_power_start (POWER_CSTATE , (eax >>4 ) +1 , cpu); -trace_cpu_idle ((eax >>4 ) +1 , cpu);if (!need_resched ()) {__monitor ((void *)¤t_thread_info ()->flags,0 ,0 );
Signature · 1 line
1.7.3.1
PATCH 4/9 cpuidle: Introduce .abbr (abbrevation) for cpuidle states
In reply to Thomas Renningerand fill name, description and newly introduced abbrevation consistently (always use snprintf) in all cpuidle drivers.
This is mainly for perf timechart. It draws vector graphics pictures of sleep/idle state usage catching perf cpu_idle events. The string used for the idle state must not exceed 3 chars or you can't see much in these pictures.
The name could get used in the title, the introduced abbrevations inside of the picture and the text must therefore be rather short.
--- arch/arm/mach-at91/cpuidle.c | 12 ++++++++---- arch/arm/mach-davinci/cpuidle.c | 13 +++++++++---- arch/arm/mach-kirkwood/cpuidle.c | 12 ++++++++---- arch/arm/mach-omap2/cpuidle34xx.c | 3 ++- arch/sh/kernel/cpu/shmobile/cpuidle.c | 19 +++++++++++-------- drivers/acpi/processor_idle.c | 3 +++ drivers/cpuidle/cpuidle.c | 1 + drivers/cpuidle/sysfs.c | 3 +++ drivers/idle/intel_idle.c | 11 +++++++++++ include/linux/cpuidle.h | 2 ++ 10 files changed, 58 insertions(+), 21 deletions(-)
arch/arm/mach-at91/cpuidle.c +8 -4
@@ -73,16 +73,20 @@ static int at91_init_cpuidle(void) device->states[0 ].exit_latency =1 ; device->states[0 ].target_residency =10000 ; device->states[0 ].flags =CPUIDLE_FLAG_TIME_VALID ; -strcpy (device->states[0 ].name,"WFI" ); -strcpy (device->states[0 ].desc,"Wait for interrupt" ); +snprintf (device->states[0 ].name,CPUIDLE_NAME_LEN ,"WFI" ); +snprintf (device->states[0 ].desc,CPUIDLE_DESC_LEN , +"Wait for interrupt" ); +snprintf (device->states[0 ].abbr,CPUIDLE_ABBR_LEN ,"W" );/* Wait for interrupt and RAM self refresh state */ device->states[1 ].enter = at91_enter_idle; device->states[1 ].exit_latency =10 ; device->states[1 ].target_residency =10000 ; device->states[1 ].flags =CPUIDLE_FLAG_TIME_VALID ; -strcpy (device->states[1 ].name,"RAM_SR" ); -strcpy (device->states[1 ].desc,"WFI and RAM Self Refresh" ); +snprintf (device->states[1 ].name,CPUIDLE_NAME_LEN ,"RAM SR" ); +snprintf (device->states[1 ].desc,CPUIDLE_DESC_LEN , +"WFI and RAM Self Refresh" ); +snprintf (device->states[1 ].abbr,CPUIDLE_ABBR_LEN ,"WSR" );if (cpuidle_register_device (device)) {printk (KERN_ERR "at91_init_cpuidle: Failed registering\n" );
arch/arm/mach-davinci/cpuidle.c +9 -4
@@ -127,16 +127,21 @@ static int __init davinci_cpuidle_probe(struct platform_device *pdev) device->states[0 ].exit_latency =1 ; device->states[0 ].target_residency =10000 ; device->states[0 ].flags =CPUIDLE_FLAG_TIME_VALID ; -strcpy (device->states[0 ].name,"WFI" ); -strcpy (device->states[0 ].desc,"Wait for interrupt" ); +snprintf (device->states[0 ].name,CPUIDLE_NAME_LEN ,"WFI" ); +snprintf (device->states[0 ].desc,CPUIDLE_DESC_LEN , +"Wait for interrupt" ); +snprintf (device->states[0 ].abbr,CPUIDLE_ABBR_LEN ,"W" );/* Wait for interrupt and DDR self refresh state */ device->states[1 ].enter = davinci_enter_idle; device->states[1 ].exit_latency =10 ; device->states[1 ].target_residency =10000 ; device->states[1 ].flags =CPUIDLE_FLAG_TIME_VALID ; -strcpy (device->states[1 ].name,"DDR SR" ); -strcpy (device->states[1 ].desc,"WFI and DDR Self Refresh" ); +snprintf (device->states[1 ].name,CPUIDLE_NAME_LEN ,"RAM SR" ); +snprintf (device->states[1 ].desc,CPUIDLE_DESC_LEN , +"WFI and RAM Self Refresh" ); +snprintf (device->states[1 ].abbr,CPUIDLE_ABBR_LEN ,"WSR" ); +if (pdata->ddr2_pdown) davinci_states[1 ].flags |=DAVINCI_CPUIDLE_FLAGS_DDR2_PWDN ;cpuidle_set_statedata (&device->states[1 ], &davinci_states[1 ]);
arch/arm/mach-kirkwood/cpuidle.c +8 -4
@@ -75,16 +75,20 @@ static int kirkwood_init_cpuidle(void) device->states[0 ].exit_latency =1 ; device->states[0 ].target_residency =10000 ; device->states[0 ].flags =CPUIDLE_FLAG_TIME_VALID ; -strcpy (device->states[0 ].name,"WFI" ); -strcpy (device->states[0 ].desc,"Wait for interrupt" ); +snprintf (device->states[0 ].name,CPUIDLE_NAME_LEN ,"WFI" ); +snprintf (device->states[0 ].desc,CPUIDLE_DESC_LEN , +"Wait for interrupt" ); +snprintf (device->states[0 ].abbr,CPUIDLE_ABBR_LEN ,"W" );/* Wait for interrupt and DDR self refresh state */ device->states[1 ].enter = kirkwood_enter_idle; device->states[1 ].exit_latency =10 ; device->states[1 ].target_residency =10000 ; device->states[1 ].flags =CPUIDLE_FLAG_TIME_VALID ; -strcpy (device->states[1 ].name,"DDR SR" ); -strcpy (device->states[1 ].desc,"WFI and DDR Self Refresh" ); +snprintf (device->states[1 ].name,CPUIDLE_NAME_LEN ,"RAM SR" ); +snprintf (device->states[1 ].desc,CPUIDLE_DESC_LEN , +"WFI and RAM Self Refresh" ); +snprintf (device->states[1 ].abbr,CPUIDLE_ABBR_LEN ,"WSR" );if (cpuidle_register_device (device)) {printk (KERN_ERR "kirkwood_init_cpuidle: Failed registering\n" );
arch/arm/mach-omap2/cpuidle34xx.c +2 -1
@@ -496,7 +496,8 @@ int __init omap3_idle_init(void) omap3_enter_idle_bm : omap3_enter_idle;if (cx->type ==OMAP3_STATE_C1 ) dev->safe_state = state; -sprintf (state->name,"C%d" , count+1 ); +snprintf (state->name,CPUIDLE_NAME_LEN ,"C%d" , count+1 ); +snprintf (state->abbr,CPUIDLE_ABBR_LEN ,"C%d" , count+1 ); count++; }
arch/sh/kernel/cpu/shmobile/cpuidle.c +11 -8
@@ -75,8 +75,9 @@ void sh_mobile_setup_cpuidle(void) i =CPUIDLE_DRIVER_STATE_START ; state = &dev->states[i++]; -snprintf (state->name,CPUIDLE_NAME_LEN ,"C0" ); -strncpy (state->desc,"SuperH Sleep Mode" ,CPUIDLE_DESC_LEN ); +snprintf (state->name,CPUIDLE_NAME_LEN ,"SuperH" ); +snprintf (state->desc,CPUIDLE_DESC_LEN ,"SuperH Sleep Mode" ); +snprintf (state->abbr,CPUIDLE_ABBR_LEN ,"SH" ); state->exit_latency =1 ; state->target_residency =1 *2 ; state->power_usage =3 ;
@@ -89,9 +90,10 @@ void sh_mobile_setup_cpuidle(void)if (sh_mobile_sleep_supported &SUSP_SH_SF ) { state = &dev->states[i++]; -snprintf (state->name,CPUIDLE_NAME_LEN ,"C1" ); -strncpy (state->desc,"SuperH Sleep Mode [SF]" , -CPUIDLE_DESC_LEN ); +snprintf (state->name,CPUIDLE_NAME_LEN ,"SuperH [SF]" ); +snprintf (state->desc,CPUIDLE_DESC_LEN , +"SuperH Sleep Mode [SF]" ); +snprintf (state->abbr,CPUIDLE_ABBR_LEN ,"SHF" ); state->exit_latency =100 ; state->target_residency =1 *2 ; state->power_usage =1 ;
@@ -102,9 +104,10 @@ void sh_mobile_setup_cpuidle(void)if (sh_mobile_sleep_supported &SUSP_SH_STANDBY ) { state = &dev->states[i++]; -snprintf (state->name,CPUIDLE_NAME_LEN ,"C2" ); -strncpy (state->desc,"SuperH Mobile Standby Mode [SF]" , -CPUIDLE_DESC_LEN ); +snprintf (state->name,CPUIDLE_NAME_LEN ,"SuperH Standby [SF]" ); +snprintf (state->desc,CPUIDLE_DESC_LEN , +"SuperH Mobile Standby Mode [SF]" ); +snprintf (state->abbr,CPUIDLE_ABBR_LEN ,"SHS" ); state->exit_latency =2300 ; state->target_residency =1 *2 ; state->power_usage =1 ;
drivers/acpi/processor_idle.c +3 -0
@@ -1016,6 +1016,7 @@ static int acpi_processor_setup_cpuidle(struct acpi_processor *pr)switch (cx->type) {case ACPI_STATE_C1 :snprintf (state->name,CPUIDLE_NAME_LEN ,"C1" ); +snprintf (state->abbr,CPUIDLE_ABBR_LEN ,"C1" ); state->flags |=CPUIDLE_FLAG_SHALLOW ;if (cx->entry_method ==ACPI_CSTATE_FFH ) state->flags |=CPUIDLE_FLAG_TIME_VALID ;
@@ -1026,6 +1027,7 @@ static int acpi_processor_setup_cpuidle(struct acpi_processor *pr)case ACPI_STATE_C2 :snprintf (state->name,CPUIDLE_NAME_LEN ,"C2" ); +snprintf (state->abbr,CPUIDLE_ABBR_LEN ,"C2" ); state->flags |=CPUIDLE_FLAG_BALANCED ; state->flags |=CPUIDLE_FLAG_TIME_VALID ; state->enter = acpi_idle_enter_simple;
@@ -1034,6 +1036,7 @@ static int acpi_processor_setup_cpuidle(struct acpi_processor *pr)case ACPI_STATE_C3 :snprintf (state->name,CPUIDLE_NAME_LEN ,"C3" ); +snprintf (state->abbr,CPUIDLE_ABBR_LEN ,"C3" ); state->flags |=CPUIDLE_FLAG_DEEP ; state->flags |=CPUIDLE_FLAG_TIME_VALID ; state->flags |=CPUIDLE_FLAG_CHECK_BM ;
drivers/cpuidle/cpuidle.c +1 -0
@@ -268,6 +268,7 @@ static void poll_idle_init(struct cpuidle_device *dev)snprintf (state->name,CPUIDLE_NAME_LEN ,"POLL" );snprintf (state->desc,CPUIDLE_DESC_LEN ,"CPUIDLE CORE POLL IDLE" ); +snprintf (state->abbr,CPUIDLE_ABBR_LEN ,"P" ); state->exit_latency =0 ; state->target_residency =0 ; state->power_usage =-1 ;
drivers/cpuidle/sysfs.c +3 -0
@@ -249,9 +249,11 @@ define_show_state_ull_function(usage)define_show_state_ull_function (time) define_show_state_str_function(name) define_show_state_str_function(desc) +define_show_state_str_function(abbr) define_one_state_ro(name, show_state_name);define_one_state_ro (desc, show_state_desc); +define_one_state_ro (abbr, show_state_abbr);define_one_state_ro (latency, show_state_exit_latency);define_one_state_ro (power, show_state_power_usage);define_one_state_ro (usage, show_state_usage);
@@ -260,6 +262,7 @@ define_one_state_ro(time, show_state_time);static struct attribute *cpuidle_state_default_attrs[] = { &attr_name.attr, &attr_desc.attr, + &attr_abbr.attr, &attr_latency.attr, &attr_power.attr, &attr_usage.attr,
drivers/idle/intel_idle.c +11 -0
@@ -91,6 +91,7 @@ static struct cpuidle_state nehalem_cstates[MWAIT_MAX_NUM_CSTATES] = { {/* MWAIT C1 */ .name = "NHM-C1", .desc = "MWAIT 0x00", + .abbr = "C1", .driver_data = (void *) 0x00, .flags = CPUIDLE_FLAG_TIME_VALID, .exit_latency = 3,
@@ -99,6 +100,7 @@ static struct cpuidle_state nehalem_cstates[MWAIT_MAX_NUM_CSTATES] = { {/* MWAIT C2 */ .name = "NHM-C3", .desc = "MWAIT 0x10", + .abbr = "C3", .driver_data = (void *) 0x10, .flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED, .exit_latency = 20,
@@ -107,6 +109,7 @@ static struct cpuidle_state nehalem_cstates[MWAIT_MAX_NUM_CSTATES] = { {/* MWAIT C3 */ .name = "NHM-C6", .desc = "MWAIT 0x20", + .abbr = "C6", .driver_data = (void *) 0x20, .flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED, .exit_latency = 200,
@@ -119,6 +122,7 @@ static struct cpuidle_state snb_cstates[MWAIT_MAX_NUM_CSTATES] = { {/* MWAIT C1 */ .name = "SNB-C1", .desc = "MWAIT 0x00", + .abbr = "C1", .driver_data = (void *) 0x00, .flags = CPUIDLE_FLAG_TIME_VALID, .exit_latency = 1,
@@ -127,6 +131,7 @@ static struct cpuidle_state snb_cstates[MWAIT_MAX_NUM_CSTATES] = { {/* MWAIT C2 */ .name = "SNB-C3", .desc = "MWAIT 0x10", + .abbr = "C3", .driver_data = (void *) 0x10, .flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED, .exit_latency = 80,
@@ -135,6 +140,7 @@ static struct cpuidle_state snb_cstates[MWAIT_MAX_NUM_CSTATES] = { {/* MWAIT C3 */ .name = "SNB-C6", .desc = "MWAIT 0x20", + .abbr = "C6", .driver_data = (void *) 0x20, .flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED, .exit_latency = 104,
@@ -143,6 +149,7 @@ static struct cpuidle_state snb_cstates[MWAIT_MAX_NUM_CSTATES] = { {/* MWAIT C4 */ .name = "SNB-C7", .desc = "MWAIT 0x30", + .abbr = "C7", .driver_data = (void *) 0x30, .flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED, .exit_latency = 109,
@@ -155,6 +162,7 @@ static struct cpuidle_state atom_cstates[MWAIT_MAX_NUM_CSTATES] = { {/* MWAIT C1 */ .name = "ATM-C1", .desc = "MWAIT 0x00", + .abbr = "C1", .driver_data = (void *) 0x00, .flags = CPUIDLE_FLAG_TIME_VALID, .exit_latency = 1,
@@ -163,6 +171,7 @@ static struct cpuidle_state atom_cstates[MWAIT_MAX_NUM_CSTATES] = { {/* MWAIT C2 */ .name = "ATM-C2", .desc = "MWAIT 0x10", + .abbr = "C2", .driver_data = (void *) 0x10, .flags = CPUIDLE_FLAG_TIME_VALID, .exit_latency = 20,
@@ -172,6 +181,7 @@ static struct cpuidle_state atom_cstates[MWAIT_MAX_NUM_CSTATES] = { {/* MWAIT C4 */ .name = "ATM-C4", .desc = "MWAIT 0x30", + .abbr = "C4", .driver_data = (void *) 0x30, .flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED, .exit_latency = 100,
@@ -181,6 +191,7 @@ static struct cpuidle_state atom_cstates[MWAIT_MAX_NUM_CSTATES] = { {/* MWAIT C6 */ .name = "ATM-C6", .desc = "MWAIT 0x52", + .abbr = "C6", .driver_data = (void *) 0x52, .flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED, .exit_latency = 140,
include/linux/cpuidle.h +2 -0
@@ -20,6 +20,7 @@#define CPUIDLE_STATE_MAX 8#define CPUIDLE_NAME_LEN 16#define CPUIDLE_DESC_LEN 32 +#define CPUIDLE_ABBR_LEN 3struct cpuidle_device ;
@@ -31,6 +32,7 @@ struct cpuidle_device;struct cpuidle_state {char name[CPUIDLE_NAME_LEN ];char desc[CPUIDLE_DESC_LEN ]; +char abbr[CPUIDLE_ABBR_LEN ];void *driver_data;unsigned int flags;
Signature · 1 line
1.7.3.1
Re: [PATCH 4/9] cpuidle: Introduce .abbr (abbrevation) for cpuidle states
Quoted 19 lines · Thomas Renninger
and fill name, description and newly introduced abbrevation consistently (always use snprintf) in all cpuidle drivers.
This is mainly for perf timechart. It draws vector graphics pictures of sleep/idle state usage catching perf
cpu_idleevents. The string used for the idle state must not exceed 3 chars or you can't see much in these pictures.
The name could get used in the title, the introduced abbrevations inside of the picture and the text must therefore be rather short.Signed-off-by Thomas Renninger <[email protected]>CC Arjan van de Ven <[email protected]>CC Ingo Molnar <[email protected]>CC Frederic Weisbecker <[email protected]>
Quoted 12 lines
--- arch/arm/mach-at91/cpuidle.c | 12 ++++++++---- arch/arm/mach-davinci/cpuidle.c | 13 +++++++++---- arch/arm/mach-kirkwood/cpuidle.c | 12 ++++++++---- arch/arm/mach-omap2/cpuidle34xx.c | 3 ++- arch/sh/kernel/cpu/shmobile/cpuidle.c | 19 +++++++++++-------- drivers/acpi/processor_idle.c | 3 +++ drivers/cpuidle/cpuidle.c | 1 + drivers/cpuidle/sysfs.c | 3 +++ drivers/idle/intel_idle.c | 11 +++++++++++ include/linux/cpuidle.h | 2 ++ 10 files changed, 58 insertions(+), 21 deletions(-)
For the davinci & OMAP changes,
Quoted 322 lines
arch/arm/mach-at91/cpuidle.c +8
-4@@ -73,16 +73,20 @@ static int at91_init_cpuidle(void) device->states[0 ].exit_latency =1 ; device->states[0 ].target_residency =10000 ; device->states[0 ].flags =CPUIDLE_FLAG_TIME_VALID ; -strcpy (device->states[0 ].name,"WFI" ); -strcpy (device->states[0 ].desc,"Wait for interrupt" ); +snprintf (device->states[0 ].name,CPUIDLE_NAME_LEN ,"WFI" ); +snprintf (device->states[0 ].desc,CPUIDLE_DESC_LEN , +"Wait for interrupt" ); +snprintf (device->states[0 ].abbr,CPUIDLE_ABBR_LEN ,"W" );/* Wait for interrupt and RAM self refresh state */ device->states[1 ].enter = at91_enter_idle; device->states[1 ].exit_latency =10 ; device->states[1 ].target_residency =10000 ; device->states[1 ].flags =CPUIDLE_FLAG_TIME_VALID ; -strcpy (device->states[1 ].name,"RAM_SR" ); -strcpy (device->states[1 ].desc,"WFI and RAM Self Refresh" ); +snprintf (device->states[1 ].name,CPUIDLE_NAME_LEN ,"RAM SR" ); +snprintf (device->states[1 ].desc,CPUIDLE_DESC_LEN , +"WFI and RAM Self Refresh" ); +snprintf (device->states[1 ].abbr,CPUIDLE_ABBR_LEN ,"WSR" );if (cpuidle_register_device (device)) {printk (KERN_ERR "at91_init_cpuidle: Failed registering\n" );arch/arm/mach-davinci/cpuidle.c +9
-4@@ -127,16 +127,21 @@ static int __init davinci_cpuidle_probe(struct platform_device *pdev) device->states[0 ].exit_latency =1 ; device->states[0 ].target_residency =10000 ; device->states[0 ].flags =CPUIDLE_FLAG_TIME_VALID ; -strcpy (device->states[0 ].name,"WFI" ); -strcpy (device->states[0 ].desc,"Wait for interrupt" ); +snprintf (device->states[0 ].name,CPUIDLE_NAME_LEN ,"WFI" ); +snprintf (device->states[0 ].desc,CPUIDLE_DESC_LEN , +"Wait for interrupt" ); +snprintf (device->states[0 ].abbr,CPUIDLE_ABBR_LEN ,"W" );/* Wait for interrupt and DDR self refresh state */ device->states[1 ].enter = davinci_enter_idle; device->states[1 ].exit_latency =10 ; device->states[1 ].target_residency =10000 ; device->states[1 ].flags =CPUIDLE_FLAG_TIME_VALID ; -strcpy (device->states[1 ].name,"DDR SR" ); -strcpy (device->states[1 ].desc,"WFI and DDR Self Refresh" ); +snprintf (device->states[1 ].name,CPUIDLE_NAME_LEN ,"RAM SR" ); +snprintf (device->states[1 ].desc,CPUIDLE_DESC_LEN , +"WFI and RAM Self Refresh" ); +snprintf (device->states[1 ].abbr,CPUIDLE_ABBR_LEN ,"WSR" ); +if (pdata->ddr2_pdown) davinci_states[1 ].flags |=DAVINCI_CPUIDLE_FLAGS_DDR2_PWDN ;cpuidle_set_statedata (&device->states[1 ], &davinci_states[1 ]);arch/arm/mach-kirkwood/cpuidle.c +8
-4@@ -75,16 +75,20 @@ static int kirkwood_init_cpuidle(void) device->states[0 ].exit_latency =1 ; device->states[0 ].target_residency =10000 ; device->states[0 ].flags =CPUIDLE_FLAG_TIME_VALID ; -strcpy (device->states[0 ].name,"WFI" ); -strcpy (device->states[0 ].desc,"Wait for interrupt" ); +snprintf (device->states[0 ].name,CPUIDLE_NAME_LEN ,"WFI" ); +snprintf (device->states[0 ].desc,CPUIDLE_DESC_LEN , +"Wait for interrupt" ); +snprintf (device->states[0 ].abbr,CPUIDLE_ABBR_LEN ,"W" );/* Wait for interrupt and DDR self refresh state */ device->states[1 ].enter = kirkwood_enter_idle; device->states[1 ].exit_latency =10 ; device->states[1 ].target_residency =10000 ; device->states[1 ].flags =CPUIDLE_FLAG_TIME_VALID ; -strcpy (device->states[1 ].name,"DDR SR" ); -strcpy (device->states[1 ].desc,"WFI and DDR Self Refresh" ); +snprintf (device->states[1 ].name,CPUIDLE_NAME_LEN ,"RAM SR" ); +snprintf (device->states[1 ].desc,CPUIDLE_DESC_LEN , +"WFI and RAM Self Refresh" ); +snprintf (device->states[1 ].abbr,CPUIDLE_ABBR_LEN ,"WSR" );if (cpuidle_register_device (device)) {printk (KERN_ERR "kirkwood_init_cpuidle: Failed registering\n" );arch/arm/mach-omap2/cpuidle34xx.c +2
-1@@ -496,7 +496,8 @@ int __init omap3_idle_init(void) omap3_enter_idle_bm : omap3_enter_idle;if (cx->type ==OMAP3_STATE_C1 ) dev->safe_state = state; -sprintf (state->name,"C%d" , count+1 ); +snprintf (state->name,CPUIDLE_NAME_LEN ,"C%d" , count+1 ); +snprintf (state->abbr,CPUIDLE_ABBR_LEN ,"C%d" , count+1 ); count++; }arch/sh/kernel/cpu/shmobile/cpuidle.c +11
-8@@ -75,8 +75,9 @@ void sh_mobile_setup_cpuidle(void) i =CPUIDLE_DRIVER_STATE_START ; state = &dev->states[i++]; -snprintf (state->name,CPUIDLE_NAME_LEN ,"C0" ); -strncpy (state->desc,"SuperH Sleep Mode" ,CPUIDLE_DESC_LEN ); +snprintf (state->name,CPUIDLE_NAME_LEN ,"SuperH" ); +snprintf (state->desc,CPUIDLE_DESC_LEN ,"SuperH Sleep Mode" ); +snprintf (state->abbr,CPUIDLE_ABBR_LEN ,"SH" ); state->exit_latency =1 ; state->target_residency =1 *2 ; state->power_usage =3 ;@@ -89,9 +90,10 @@ void sh_mobile_setup_cpuidle(void)if (sh_mobile_sleep_supported &SUSP_SH_SF ) { state = &dev->states[i++]; -snprintf (state->name,CPUIDLE_NAME_LEN ,"C1" ); -strncpy (state->desc,"SuperH Sleep Mode [SF]" , -CPUIDLE_DESC_LEN ); +snprintf (state->name,CPUIDLE_NAME_LEN ,"SuperH [SF]" ); +snprintf (state->desc,CPUIDLE_DESC_LEN , +"SuperH Sleep Mode [SF]" ); +snprintf (state->abbr,CPUIDLE_ABBR_LEN ,"SHF" ); state->exit_latency =100 ; state->target_residency =1 *2 ; state->power_usage =1 ;@@ -102,9 +104,10 @@ void sh_mobile_setup_cpuidle(void)if (sh_mobile_sleep_supported &SUSP_SH_STANDBY ) { state = &dev->states[i++]; -snprintf (state->name,CPUIDLE_NAME_LEN ,"C2" ); -strncpy (state->desc,"SuperH Mobile Standby Mode [SF]" , -CPUIDLE_DESC_LEN ); +snprintf (state->name,CPUIDLE_NAME_LEN ,"SuperH Standby [SF]" ); +snprintf (state->desc,CPUIDLE_DESC_LEN , +"SuperH Mobile Standby Mode [SF]" ); +snprintf (state->abbr,CPUIDLE_ABBR_LEN ,"SHS" ); state->exit_latency =2300 ; state->target_residency =1 *2 ; state->power_usage =1 ;drivers/acpi/processor_idle.c +3
-0@@ -1016,6 +1016,7 @@ static int acpi_processor_setup_cpuidle(struct acpi_processor *pr)switch (cx->type) {case ACPI_STATE_C1 :snprintf (state->name,CPUIDLE_NAME_LEN ,"C1" ); +snprintf (state->abbr,CPUIDLE_ABBR_LEN ,"C1" ); state->flags |=CPUIDLE_FLAG_SHALLOW ;if (cx->entry_method ==ACPI_CSTATE_FFH ) state->flags |=CPUIDLE_FLAG_TIME_VALID ;@@ -1026,6 +1027,7 @@ static int acpi_processor_setup_cpuidle(struct acpi_processor *pr)case ACPI_STATE_C2 :snprintf (state->name,CPUIDLE_NAME_LEN ,"C2" ); +snprintf (state->abbr,CPUIDLE_ABBR_LEN ,"C2" ); state->flags |=CPUIDLE_FLAG_BALANCED ; state->flags |=CPUIDLE_FLAG_TIME_VALID ; state->enter = acpi_idle_enter_simple;@@ -1034,6 +1036,7 @@ static int acpi_processor_setup_cpuidle(struct acpi_processor *pr)case ACPI_STATE_C3 :snprintf (state->name,CPUIDLE_NAME_LEN ,"C3" ); +snprintf (state->abbr,CPUIDLE_ABBR_LEN ,"C3" ); state->flags |=CPUIDLE_FLAG_DEEP ; state->flags |=CPUIDLE_FLAG_TIME_VALID ; state->flags |=CPUIDLE_FLAG_CHECK_BM ;drivers/cpuidle/cpuidle.c +1
-0@@ -268,6 +268,7 @@ static void poll_idle_init(struct cpuidle_device *dev)snprintf (state->name,CPUIDLE_NAME_LEN ,"POLL" );snprintf (state->desc,CPUIDLE_DESC_LEN ,"CPUIDLE CORE POLL IDLE" ); +snprintf (state->abbr,CPUIDLE_ABBR_LEN ,"P" ); state->exit_latency =0 ; state->target_residency =0 ; state->power_usage =-1 ;drivers/cpuidle/sysfs.c +3
-0@@ -249,9 +249,11 @@ define_show_state_ull_function(usage)define_show_state_ull_function (time) define_show_state_str_function(name) define_show_state_str_function(desc) +define_show_state_str_function(abbr) define_one_state_ro(name, show_state_name);define_one_state_ro (desc, show_state_desc); +define_one_state_ro (abbr, show_state_abbr);define_one_state_ro (latency, show_state_exit_latency);define_one_state_ro (power, show_state_power_usage);define_one_state_ro (usage, show_state_usage);@@ -260,6 +262,7 @@ define_one_state_ro(time, show_state_time);static struct attribute *cpuidle_state_default_attrs[] = { &attr_name.attr, &attr_desc.attr, + &attr_abbr.attr, &attr_latency.attr, &attr_power.attr, &attr_usage.attr,drivers/idle/intel_idle.c +11
-0@@ -91,6 +91,7 @@ static struct cpuidle_state nehalem_cstates[MWAIT_MAX_NUM_CSTATES] = { {/* MWAIT C1 */ .name = "NHM-C1", .desc = "MWAIT 0x00", + .abbr = "C1", .driver_data = (void *) 0x00, .flags = CPUIDLE_FLAG_TIME_VALID, .exit_latency = 3,@@ -99,6 +100,7 @@ static struct cpuidle_state nehalem_cstates[MWAIT_MAX_NUM_CSTATES] = { {/* MWAIT C2 */ .name = "NHM-C3", .desc = "MWAIT 0x10", + .abbr = "C3", .driver_data = (void *) 0x10, .flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED, .exit_latency = 20,@@ -107,6 +109,7 @@ static struct cpuidle_state nehalem_cstates[MWAIT_MAX_NUM_CSTATES] = { {/* MWAIT C3 */ .name = "NHM-C6", .desc = "MWAIT 0x20", + .abbr = "C6", .driver_data = (void *) 0x20, .flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED, .exit_latency = 200,@@ -119,6 +122,7 @@ static struct cpuidle_state snb_cstates[MWAIT_MAX_NUM_CSTATES] = { {/* MWAIT C1 */ .name = "SNB-C1", .desc = "MWAIT 0x00", + .abbr = "C1", .driver_data = (void *) 0x00, .flags = CPUIDLE_FLAG_TIME_VALID, .exit_latency = 1,@@ -127,6 +131,7 @@ static struct cpuidle_state snb_cstates[MWAIT_MAX_NUM_CSTATES] = { {/* MWAIT C2 */ .name = "SNB-C3", .desc = "MWAIT 0x10", + .abbr = "C3", .driver_data = (void *) 0x10, .flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED, .exit_latency = 80,@@ -135,6 +140,7 @@ static struct cpuidle_state snb_cstates[MWAIT_MAX_NUM_CSTATES] = { {/* MWAIT C3 */ .name = "SNB-C6", .desc = "MWAIT 0x20", + .abbr = "C6", .driver_data = (void *) 0x20, .flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED, .exit_latency = 104,@@ -143,6 +149,7 @@ static struct cpuidle_state snb_cstates[MWAIT_MAX_NUM_CSTATES] = { {/* MWAIT C4 */ .name = "SNB-C7", .desc = "MWAIT 0x30", + .abbr = "C7", .driver_data = (void *) 0x30, .flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED, .exit_latency = 109,@@ -155,6 +162,7 @@ static struct cpuidle_state atom_cstates[MWAIT_MAX_NUM_CSTATES] = { {/* MWAIT C1 */ .name = "ATM-C1", .desc = "MWAIT 0x00", + .abbr = "C1", .driver_data = (void *) 0x00, .flags = CPUIDLE_FLAG_TIME_VALID, .exit_latency = 1,@@ -163,6 +171,7 @@ static struct cpuidle_state atom_cstates[MWAIT_MAX_NUM_CSTATES] = { {/* MWAIT C2 */ .name = "ATM-C2", .desc = "MWAIT 0x10", + .abbr = "C2", .driver_data = (void *) 0x10, .flags = CPUIDLE_FLAG_TIME_VALID, .exit_latency = 20,@@ -172,6 +181,7 @@ static struct cpuidle_state atom_cstates[MWAIT_MAX_NUM_CSTATES] = { {/* MWAIT C4 */ .name = "ATM-C4", .desc = "MWAIT 0x30", + .abbr = "C4", .driver_data = (void *) 0x30, .flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED, .exit_latency = 100,@@ -181,6 +191,7 @@ static struct cpuidle_state atom_cstates[MWAIT_MAX_NUM_CSTATES] = { {/* MWAIT C6 */ .name = "ATM-C6", .desc = "MWAIT 0x52", + .abbr = "C6", .driver_data = (void *) 0x52, .flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED, .exit_latency = 140,include/linux/cpuidle.h +2
-0@@ -20,6 +20,7 @@#define CPUIDLE_STATE_MAX 8#define CPUIDLE_NAME_LEN 16#define CPUIDLE_DESC_LEN 32 +#define CPUIDLE_ABBR_LEN 3struct cpuidle_device ;@@ -31,6 +32,7 @@ struct cpuidle_device;struct cpuidle_state {char name[CPUIDLE_NAME_LEN ];char desc[CPUIDLE_DESC_LEN ]; +char abbr[CPUIDLE_ABBR_LEN ];void *driver_data;unsigned int flags;
Re: [PATCH 4/9] cpuidle: Introduce .abbr (abbrevation) for cpuidle states
In reply to Thomas RenningerQuoted 19 lines · Thomas Renninger
and fill name, description and newly introduced abbrevation consistently (always use snprintf) in all cpuidle drivers.
This is mainly for perf timechart. It draws vector graphics pictures of sleep/idle state usage catching perf
cpu_idleevents. The string used for the idle state must not exceed 3 chars or you can't see much in these pictures.
The name could get used in the title, the introduced abbrevations inside of the picture and the text must therefore be rather short.Signed-off-by Thomas Renninger <[email protected]>CC Arjan van de Ven <[email protected]>CC Ingo Molnar <[email protected]>CC Frederic Weisbecker <[email protected]>
Quoted 12 lines
--- arch/arm/mach-at91/cpuidle.c | 12 ++++++++---- arch/arm/mach-davinci/cpuidle.c | 13 +++++++++---- arch/arm/mach-kirkwood/cpuidle.c | 12 ++++++++---- arch/arm/mach-omap2/cpuidle34xx.c | 3 ++- arch/sh/kernel/cpu/shmobile/cpuidle.c | 19 +++++++++++-------- drivers/acpi/processor_idle.c | 3 +++ drivers/cpuidle/cpuidle.c | 1 + drivers/cpuidle/sysfs.c | 3 +++ drivers/idle/intel_idle.c | 11 +++++++++++ include/linux/cpuidle.h | 2 ++ 10 files changed, 58 insertions(+), 21 deletions(-)
For the davinci & OMAP changes,
Quoted 322 lines
arch/arm/mach-at91/cpuidle.c +8
-4@@ -73,16 +73,20 @@ static int at91_init_cpuidle(void) device->states[0 ].exit_latency =1 ; device->states[0 ].target_residency =10000 ; device->states[0 ].flags =CPUIDLE_FLAG_TIME_VALID ; -strcpy (device->states[0 ].name,"WFI" ); -strcpy (device->states[0 ].desc,"Wait for interrupt" ); +snprintf (device->states[0 ].name,CPUIDLE_NAME_LEN ,"WFI" ); +snprintf (device->states[0 ].desc,CPUIDLE_DESC_LEN , +"Wait for interrupt" ); +snprintf (device->states[0 ].abbr,CPUIDLE_ABBR_LEN ,"W" );/* Wait for interrupt and RAM self refresh state */ device->states[1 ].enter = at91_enter_idle; device->states[1 ].exit_latency =10 ; device->states[1 ].target_residency =10000 ; device->states[1 ].flags =CPUIDLE_FLAG_TIME_VALID ; -strcpy (device->states[1 ].name,"RAM_SR" ); -strcpy (device->states[1 ].desc,"WFI and RAM Self Refresh" ); +snprintf (device->states[1 ].name,CPUIDLE_NAME_LEN ,"RAM SR" ); +snprintf (device->states[1 ].desc,CPUIDLE_DESC_LEN , +"WFI and RAM Self Refresh" ); +snprintf (device->states[1 ].abbr,CPUIDLE_ABBR_LEN ,"WSR" );if (cpuidle_register_device (device)) {printk (KERN_ERR "at91_init_cpuidle: Failed registering\n" );arch/arm/mach-davinci/cpuidle.c +9
-4@@ -127,16 +127,21 @@ static int __init davinci_cpuidle_probe(struct platform_device *pdev) device->states[0 ].exit_latency =1 ; device->states[0 ].target_residency =10000 ; device->states[0 ].flags =CPUIDLE_FLAG_TIME_VALID ; -strcpy (device->states[0 ].name,"WFI" ); -strcpy (device->states[0 ].desc,"Wait for interrupt" ); +snprintf (device->states[0 ].name,CPUIDLE_NAME_LEN ,"WFI" ); +snprintf (device->states[0 ].desc,CPUIDLE_DESC_LEN , +"Wait for interrupt" ); +snprintf (device->states[0 ].abbr,CPUIDLE_ABBR_LEN ,"W" );/* Wait for interrupt and DDR self refresh state */ device->states[1 ].enter = davinci_enter_idle; device->states[1 ].exit_latency =10 ; device->states[1 ].target_residency =10000 ; device->states[1 ].flags =CPUIDLE_FLAG_TIME_VALID ; -strcpy (device->states[1 ].name,"DDR SR" ); -strcpy (device->states[1 ].desc,"WFI and DDR Self Refresh" ); +snprintf (device->states[1 ].name,CPUIDLE_NAME_LEN ,"RAM SR" ); +snprintf (device->states[1 ].desc,CPUIDLE_DESC_LEN , +"WFI and RAM Self Refresh" ); +snprintf (device->states[1 ].abbr,CPUIDLE_ABBR_LEN ,"WSR" ); +if (pdata->ddr2_pdown) davinci_states[1 ].flags |=DAVINCI_CPUIDLE_FLAGS_DDR2_PWDN ;cpuidle_set_statedata (&device->states[1 ], &davinci_states[1 ]);arch/arm/mach-kirkwood/cpuidle.c +8
-4@@ -75,16 +75,20 @@ static int kirkwood_init_cpuidle(void) device->states[0 ].exit_latency =1 ; device->states[0 ].target_residency =10000 ; device->states[0 ].flags =CPUIDLE_FLAG_TIME_VALID ; -strcpy (device->states[0 ].name,"WFI" ); -strcpy (device->states[0 ].desc,"Wait for interrupt" ); +snprintf (device->states[0 ].name,CPUIDLE_NAME_LEN ,"WFI" ); +snprintf (device->states[0 ].desc,CPUIDLE_DESC_LEN , +"Wait for interrupt" ); +snprintf (device->states[0 ].abbr,CPUIDLE_ABBR_LEN ,"W" );/* Wait for interrupt and DDR self refresh state */ device->states[1 ].enter = kirkwood_enter_idle; device->states[1 ].exit_latency =10 ; device->states[1 ].target_residency =10000 ; device->states[1 ].flags =CPUIDLE_FLAG_TIME_VALID ; -strcpy (device->states[1 ].name,"DDR SR" ); -strcpy (device->states[1 ].desc,"WFI and DDR Self Refresh" ); +snprintf (device->states[1 ].name,CPUIDLE_NAME_LEN ,"RAM SR" ); +snprintf (device->states[1 ].desc,CPUIDLE_DESC_LEN , +"WFI and RAM Self Refresh" ); +snprintf (device->states[1 ].abbr,CPUIDLE_ABBR_LEN ,"WSR" );if (cpuidle_register_device (device)) {printk (KERN_ERR "kirkwood_init_cpuidle: Failed registering\n" );arch/arm/mach-omap2/cpuidle34xx.c +2
-1@@ -496,7 +496,8 @@ int __init omap3_idle_init(void) omap3_enter_idle_bm : omap3_enter_idle;if (cx->type ==OMAP3_STATE_C1 ) dev->safe_state = state; -sprintf (state->name,"C%d" , count+1 ); +snprintf (state->name,CPUIDLE_NAME_LEN ,"C%d" , count+1 ); +snprintf (state->abbr,CPUIDLE_ABBR_LEN ,"C%d" , count+1 ); count++; }arch/sh/kernel/cpu/shmobile/cpuidle.c +11
-8@@ -75,8 +75,9 @@ void sh_mobile_setup_cpuidle(void) i =CPUIDLE_DRIVER_STATE_START ; state = &dev->states[i++]; -snprintf (state->name,CPUIDLE_NAME_LEN ,"C0" ); -strncpy (state->desc,"SuperH Sleep Mode" ,CPUIDLE_DESC_LEN ); +snprintf (state->name,CPUIDLE_NAME_LEN ,"SuperH" ); +snprintf (state->desc,CPUIDLE_DESC_LEN ,"SuperH Sleep Mode" ); +snprintf (state->abbr,CPUIDLE_ABBR_LEN ,"SH" ); state->exit_latency =1 ; state->target_residency =1 *2 ; state->power_usage =3 ;@@ -89,9 +90,10 @@ void sh_mobile_setup_cpuidle(void)if (sh_mobile_sleep_supported &SUSP_SH_SF ) { state = &dev->states[i++]; -snprintf (state->name,CPUIDLE_NAME_LEN ,"C1" ); -strncpy (state->desc,"SuperH Sleep Mode [SF]" , -CPUIDLE_DESC_LEN ); +snprintf (state->name,CPUIDLE_NAME_LEN ,"SuperH [SF]" ); +snprintf (state->desc,CPUIDLE_DESC_LEN , +"SuperH Sleep Mode [SF]" ); +snprintf (state->abbr,CPUIDLE_ABBR_LEN ,"SHF" ); state->exit_latency =100 ; state->target_residency =1 *2 ; state->power_usage =1 ;@@ -102,9 +104,10 @@ void sh_mobile_setup_cpuidle(void)if (sh_mobile_sleep_supported &SUSP_SH_STANDBY ) { state = &dev->states[i++]; -snprintf (state->name,CPUIDLE_NAME_LEN ,"C2" ); -strncpy (state->desc,"SuperH Mobile Standby Mode [SF]" , -CPUIDLE_DESC_LEN ); +snprintf (state->name,CPUIDLE_NAME_LEN ,"SuperH Standby [SF]" ); +snprintf (state->desc,CPUIDLE_DESC_LEN , +"SuperH Mobile Standby Mode [SF]" ); +snprintf (state->abbr,CPUIDLE_ABBR_LEN ,"SHS" ); state->exit_latency =2300 ; state->target_residency =1 *2 ; state->power_usage =1 ;drivers/acpi/processor_idle.c +3
-0@@ -1016,6 +1016,7 @@ static int acpi_processor_setup_cpuidle(struct acpi_processor *pr)switch (cx->type) {case ACPI_STATE_C1 :snprintf (state->name,CPUIDLE_NAME_LEN ,"C1" ); +snprintf (state->abbr,CPUIDLE_ABBR_LEN ,"C1" ); state->flags |=CPUIDLE_FLAG_SHALLOW ;if (cx->entry_method ==ACPI_CSTATE_FFH ) state->flags |=CPUIDLE_FLAG_TIME_VALID ;@@ -1026,6 +1027,7 @@ static int acpi_processor_setup_cpuidle(struct acpi_processor *pr)case ACPI_STATE_C2 :snprintf (state->name,CPUIDLE_NAME_LEN ,"C2" ); +snprintf (state->abbr,CPUIDLE_ABBR_LEN ,"C2" ); state->flags |=CPUIDLE_FLAG_BALANCED ; state->flags |=CPUIDLE_FLAG_TIME_VALID ; state->enter = acpi_idle_enter_simple;@@ -1034,6 +1036,7 @@ static int acpi_processor_setup_cpuidle(struct acpi_processor *pr)case ACPI_STATE_C3 :snprintf (state->name,CPUIDLE_NAME_LEN ,"C3" ); +snprintf (state->abbr,CPUIDLE_ABBR_LEN ,"C3" ); state->flags |=CPUIDLE_FLAG_DEEP ; state->flags |=CPUIDLE_FLAG_TIME_VALID ; state->flags |=CPUIDLE_FLAG_CHECK_BM ;drivers/cpuidle/cpuidle.c +1
-0@@ -268,6 +268,7 @@ static void poll_idle_init(struct cpuidle_device *dev)snprintf (state->name,CPUIDLE_NAME_LEN ,"POLL" );snprintf (state->desc,CPUIDLE_DESC_LEN ,"CPUIDLE CORE POLL IDLE" ); +snprintf (state->abbr,CPUIDLE_ABBR_LEN ,"P" ); state->exit_latency =0 ; state->target_residency =0 ; state->power_usage =-1 ;drivers/cpuidle/sysfs.c +3
-0@@ -249,9 +249,11 @@ define_show_state_ull_function(usage)define_show_state_ull_function (time) define_show_state_str_function(name) define_show_state_str_function(desc) +define_show_state_str_function(abbr) define_one_state_ro(name, show_state_name);define_one_state_ro (desc, show_state_desc); +define_one_state_ro (abbr, show_state_abbr);define_one_state_ro (latency, show_state_exit_latency);define_one_state_ro (power, show_state_power_usage);define_one_state_ro (usage, show_state_usage);@@ -260,6 +262,7 @@ define_one_state_ro(time, show_state_time);static struct attribute *cpuidle_state_default_attrs[] = { &attr_name.attr, &attr_desc.attr, + &attr_abbr.attr, &attr_latency.attr, &attr_power.attr, &attr_usage.attr,drivers/idle/intel_idle.c +11
-0@@ -91,6 +91,7 @@ static struct cpuidle_state nehalem_cstates[MWAIT_MAX_NUM_CSTATES] = { {/* MWAIT C1 */ .name = "NHM-C1", .desc = "MWAIT 0x00", + .abbr = "C1", .driver_data = (void *) 0x00, .flags = CPUIDLE_FLAG_TIME_VALID, .exit_latency = 3,@@ -99,6 +100,7 @@ static struct cpuidle_state nehalem_cstates[MWAIT_MAX_NUM_CSTATES] = { {/* MWAIT C2 */ .name = "NHM-C3", .desc = "MWAIT 0x10", + .abbr = "C3", .driver_data = (void *) 0x10, .flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED, .exit_latency = 20,@@ -107,6 +109,7 @@ static struct cpuidle_state nehalem_cstates[MWAIT_MAX_NUM_CSTATES] = { {/* MWAIT C3 */ .name = "NHM-C6", .desc = "MWAIT 0x20", + .abbr = "C6", .driver_data = (void *) 0x20, .flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED, .exit_latency = 200,@@ -119,6 +122,7 @@ static struct cpuidle_state snb_cstates[MWAIT_MAX_NUM_CSTATES] = { {/* MWAIT C1 */ .name = "SNB-C1", .desc = "MWAIT 0x00", + .abbr = "C1", .driver_data = (void *) 0x00, .flags = CPUIDLE_FLAG_TIME_VALID, .exit_latency = 1,@@ -127,6 +131,7 @@ static struct cpuidle_state snb_cstates[MWAIT_MAX_NUM_CSTATES] = { {/* MWAIT C2 */ .name = "SNB-C3", .desc = "MWAIT 0x10", + .abbr = "C3", .driver_data = (void *) 0x10, .flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED, .exit_latency = 80,@@ -135,6 +140,7 @@ static struct cpuidle_state snb_cstates[MWAIT_MAX_NUM_CSTATES] = { {/* MWAIT C3 */ .name = "SNB-C6", .desc = "MWAIT 0x20", + .abbr = "C6", .driver_data = (void *) 0x20, .flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED, .exit_latency = 104,@@ -143,6 +149,7 @@ static struct cpuidle_state snb_cstates[MWAIT_MAX_NUM_CSTATES] = { {/* MWAIT C4 */ .name = "SNB-C7", .desc = "MWAIT 0x30", + .abbr = "C7", .driver_data = (void *) 0x30, .flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED, .exit_latency = 109,@@ -155,6 +162,7 @@ static struct cpuidle_state atom_cstates[MWAIT_MAX_NUM_CSTATES] = { {/* MWAIT C1 */ .name = "ATM-C1", .desc = "MWAIT 0x00", + .abbr = "C1", .driver_data = (void *) 0x00, .flags = CPUIDLE_FLAG_TIME_VALID, .exit_latency = 1,@@ -163,6 +171,7 @@ static struct cpuidle_state atom_cstates[MWAIT_MAX_NUM_CSTATES] = { {/* MWAIT C2 */ .name = "ATM-C2", .desc = "MWAIT 0x10", + .abbr = "C2", .driver_data = (void *) 0x10, .flags = CPUIDLE_FLAG_TIME_VALID, .exit_latency = 20,@@ -172,6 +181,7 @@ static struct cpuidle_state atom_cstates[MWAIT_MAX_NUM_CSTATES] = { {/* MWAIT C4 */ .name = "ATM-C4", .desc = "MWAIT 0x30", + .abbr = "C4", .driver_data = (void *) 0x30, .flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED, .exit_latency = 100,@@ -181,6 +191,7 @@ static struct cpuidle_state atom_cstates[MWAIT_MAX_NUM_CSTATES] = { {/* MWAIT C6 */ .name = "ATM-C6", .desc = "MWAIT 0x52", + .abbr = "C6", .driver_data = (void *) 0x52, .flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED, .exit_latency = 140,include/linux/cpuidle.h +2
-0@@ -20,6 +20,7 @@#define CPUIDLE_STATE_MAX 8#define CPUIDLE_NAME_LEN 16#define CPUIDLE_DESC_LEN 32 +#define CPUIDLE_ABBR_LEN 3struct cpuidle_device ;@@ -31,6 +32,7 @@ struct cpuidle_device;struct cpuidle_state {char name[CPUIDLE_NAME_LEN ];char desc[CPUIDLE_DESC_LEN ]; +char abbr[CPUIDLE_ABBR_LEN ];void *driver_data;unsigned int flags;
Len Brown
reviewerRe: [PATCH 4/9] cpuidle: Introduce .abbr (abbrevation) for cpuidle states
In reply to Thomas RenningerI'm not fond of inventing a new 3-character abbreviation field for every state because display tools can't handle the existing 16-character name field.
If the display tools can only handle 3 characters, then why not have them simply use the 1st 3 characters of the existing name field? If that is not unique, then re-arrange the strings so that it is unique...
Of course the ACPI part of this patch will not apply, as it depends on patch 1 in this series, which was erroneous. For ACPI, the existing name field is already fine, as C%d fits into 3 characters.
thanks,
Len Brown, Intel Open Source Technology Center
Re: [PATCH 4/9] cpuidle: Introduce .abbr (abbrevation) for cpuidle states
Quoted 3 lines · On Wednesday 12 January 2011 07:56:45 Len Brown wrote:
I'm not fond of inventing a new 3-character abbreviation field for every state because display tools can't handle the existing 16-character name field.
I am also not "fond" of it, but it's a sane and easy solution and appropriate for this issue.
Quoted 3 lines
If the display tools can only handle 3 characters, then why not have them simply use the 1st 3 characters of the existing name field?
You mean use:
C3 NHM
instead of
NHM-C3
for intel_idle?
Then userspace has to parse the two informations glued together, get rid of the whitespace, etc.
But by sysfs convention a separate file must be used if two data are passed to userspace which is the case here.
Quoted 2 lines
If that is not unique,
then re-arrange the strings so that it is unique...
See above, it would unnecessarily make life hard for userspace.
Afaik sysfs entries do not consume resources as long as they do not get accessed.
Quoted 4 lines
Of course the ACPI part of this patch will not apply, as it depends on patch 1 in this series, which was erroneous. For ACPI, the existing name field is already fine, as C%d fits into 3 characters.
For acpi_idle only it would work, but this is (nearly) the only one.
For example for sh arch:
name: SuperH
"SH SuperH" contains two data and should get split up into:
name: SuperH
abbr: SH
By convention the first characters of "description" could be used, but you would again end up in userspace parsing and double info in one sysfs file.
I hope that's enough for convincing, I'd really like to go the .abbr way. Do you give me an acked-by for that one?
Thanks,
Thomas
Len Brown
reviewerRe: [PATCH 4/9] cpuidle: Introduce .abbr (abbrevation) for cpuidle states
Quoted 9 lines
Quoted 3 lines
If the display tools can only handle 3 characters, then why not have them simply use the 1st 3 characters of the existing name field?
You mean use:
C3 NHM
instead of
NHM-C3
forintel_idle?
Yes.
is there a reason that would be a problem?
If only 3 characters are useful,
then I'd rather see you simly do this:
#define CPUIDLE_NAME_LEN 3
Quoted 2 lines
Then userspace has to parse the two informations glued together, get rid of the whitespace, etc.
what "two informations"?
why is kernel bloat the instrument of choice to avoid the expense of string truncation
in user-space tools?
Quoted 2 lines
But by sysfs convention a separate file must be used if two data are passed to userspace which is the case here.
what two data?
It is fine for a string to include space characters.
Quoted 7 lines
Quoted 2 lines
If that is not unique,
then re-arrange the strings so that it is unique...See above, it would unnecessarily make life hard for userspace.
Afaik sysfs entries do not consume resources as long as they do not get accessed.
they clutter the source code,
they create an additional name for something that arguably already has 3 names --
the state #, the name, and the description. I'd rather delete a few of the fields than add a 4th...
Quoted 5 lines
Quoted 4 lines
Of course the ACPI part of this patch will not apply, as it depends on patch 1 in this series, which was erroneous. For ACPI, the existing name field is already fine, as C%d fits into 3 characters.
Quoted 7 lines
For
acpi_idleonly it would work, but this is (nearly) the only one.
For example for sh arch:
name: SuperH
"SH SuperH" contains two data and should get split up into:
name: SuperH
abbr: SH
acpi/arch/sh/kernel/cpu/shmobile/cpuidle.c already uses state->name = "C0", "C1", "C2".
Just use them and be done.
Quoted 6 lines
By convention the first characters of "description" could be used, but you would again end up in userspace parsing and double info in one sysfs file.
I hope that's enough for convincing, I'd really like to go the .abbr way. Do you give me an acked-by for that one?
No.
We should not invent an additional abbreviation field. The tools should use the existing name field. If the existing name field is not sufficient, then the states should simply be enumerated and numbers be shown in the GUI.
thanks,
Len Brown, Intel Open Source Technology Center
Re: [PATCH 4/9] cpuidle: Introduce .abbr (abbrevation) for cpuidle states
Quoted 4 lines · On Wednesday 12 January 2011 23:25:12 Len Brown wrote:
Quoted 3 lines
Quoted 3 lines
If the display tools can only handle 3 characters, then why not have them simply use the 1st 3 characters of the existing name field?
Quoted 8 lines
Quoted 5 lines
You mean use:
C3 NHM
instead of
NHM-C3
forintel_idle?Yes.
is there a reason that would be a problem?
A much more elegant solution came to my mind:
I'll rewrite the perf timechart patch to do:
Title: C-stateName1 [1] , C-stateName2 [2]
and later I will refer to the states by 1, 2, ...
Eventually a:
Description:
[1] C-stateDescription1
[2] C-stateDescription2
...
can be put somewhere as well.
Please ignore this patch.
Stupid that I didn't think of that in the first place.
Thanks,
Thomas
Re: [PATCH 4/9] cpuidle: Introduce .abbr (abbrevation) for cpuidle states
In reply to Len BrownQuoted 4 lines · On Wednesday 12 January 2011 23:25:12 Len Brown wrote:
Quoted 3 lines
Quoted 3 lines
If the display tools can only handle 3 characters, then why not have them simply use the 1st 3 characters of the existing name field?
Quoted 8 lines
Quoted 5 lines
You mean use:
C3 NHM
instead of
NHM-C3
forintel_idle?Yes.
is there a reason that would be a problem?
A much more elegant solution came to my mind:
I'll rewrite the perf timechart patch to do:
Title: C-stateName1 [1] , C-stateName2 [2]
and later I will refer to the states by 1, 2, ...
Eventually a:
Description:
[1] C-stateDescription1
[2] C-stateDescription2
...
can be put somewhere as well.
Please ignore this patch.
Stupid that I didn't think of that in the first place.
Thanks,
Thomas
Re: [PATCH 4/9] cpuidle: Introduce .abbr (abbrevation) for cpuidle states
In reply to Len BrownQuoted 6 lines · Len Brown
Quoted 2 lines
But by sysfs convention a separate file must be used if two data are passed to userspace which is the case here.
what two data?
It is fine for a string to include space characters.
I think Thomas is concerned that although when you actually read a /sys file, you know it's one string, that fact can get easily lost and cause issues down the road. Consider this code:
foo=cat /sys/some/file
bar=cat /sys/other/file
baz=cat /sys/third/file
echo $foo $bar $baz | awk '{print $2 $3}'
Suddenly your output isn't what you expected...
Re: [PATCH 4/9] cpuidle: Introduce .abbr (abbrevation) for cpuidle states
In reply to Len BrownQuoted 6 lines · Len Brown
Quoted 2 lines
But by sysfs convention a separate file must be used if two data are passed to userspace which is the case here.
what two data?
It is fine for a string to include space characters.
I think Thomas is concerned that although when you actually read a /sys file, you know it's one string, that fact can get easily lost and cause issues down the road. Consider this code:
foo=cat /sys/some/file
bar=cat /sys/other/file
baz=cat /sys/third/file
echo $foo $bar $baz | awk '{print $2 $3}'
Suddenly your output isn't what you expected...
Len Brown
reviewerRe: [PATCH 4/9] cpuidle: Introduce .abbr (abbrevation) for cpuidle states
In reply to Thomas RenningerQuoted 9 lines
Quoted 3 lines
If the display tools can only handle 3 characters, then why not have them simply use the 1st 3 characters of the existing name field?
You mean use:
C3 NHM
instead of
NHM-C3
forintel_idle?
Yes.
is there a reason that would be a problem?
If only 3 characters are useful,
then I'd rather see you simly do this:
#define CPUIDLE_NAME_LEN 3
Quoted 2 lines
Then userspace has to parse the two informations glued together, get rid of the whitespace, etc.
what "two informations"?
why is kernel bloat the instrument of choice to avoid the expense of string truncation
in user-space tools?
Quoted 2 lines
But by sysfs convention a separate file must be used if two data are passed to userspace which is the case here.
what two data?
It is fine for a string to include space characters.
Quoted 7 lines
Quoted 2 lines
If that is not unique,
then re-arrange the strings so that it is unique...See above, it would unnecessarily make life hard for userspace.
Afaik sysfs entries do not consume resources as long as they do not get accessed.
they clutter the source code,
they create an additional name for something that arguably already has 3 names --
the state #, the name, and the description. I'd rather delete a few of the fields than add a 4th...
Quoted 5 lines
Quoted 4 lines
Of course the ACPI part of this patch will not apply, as it depends on patch 1 in this series, which was erroneous. For ACPI, the existing name field is already fine, as C%d fits into 3 characters.
Quoted 7 lines
For
acpi_idleonly it would work, but this is (nearly) the only one.
For example for sh arch:
name: SuperH
"SH SuperH" contains two data and should get split up into:
name: SuperH
abbr: SH
acpi/arch/sh/kernel/cpu/shmobile/cpuidle.c already uses state->name = "C0", "C1", "C2".
Just use them and be done.
Quoted 6 lines
By convention the first characters of "description" could be used, but you would again end up in userspace parsing and double info in one sysfs file.
I hope that's enough for convincing, I'd really like to go the .abbr way. Do you give me an acked-by for that one?
No.
We should not invent an additional abbreviation field. The tools should use the existing name field. If the existing name field is not sufficient, then the states should simply be enumerated and numbers be shown in the GUI.
thanks,
Len Brown, Intel Open Source Technology Center
Re: [PATCH 4/9] cpuidle: Introduce .abbr (abbrevation) for cpuidle states
In reply to Len BrownQuoted 3 lines · On Wednesday 12 January 2011 07:56:45 Len Brown wrote:
I'm not fond of inventing a new 3-character abbreviation field for every state because display tools can't handle the existing 16-character name field.
I am also not "fond" of it, but it's a sane and easy solution and appropriate for this issue.
Quoted 3 lines
If the display tools can only handle 3 characters, then why not have them simply use the 1st 3 characters of the existing name field?
You mean use:
C3 NHM
instead of
NHM-C3
for intel_idle?
Then userspace has to parse the two informations glued together, get rid of the whitespace, etc.
But by sysfs convention a separate file must be used if two data are passed to userspace which is the case here.
Quoted 2 lines
If that is not unique,
then re-arrange the strings so that it is unique...
See above, it would unnecessarily make life hard for userspace.
Afaik sysfs entries do not consume resources as long as they do not get accessed.
Quoted 4 lines
Of course the ACPI part of this patch will not apply, as it depends on patch 1 in this series, which was erroneous. For ACPI, the existing name field is already fine, as C%d fits into 3 characters.
For acpi_idle only it would work, but this is (nearly) the only one.
For example for sh arch:
name: SuperH
"SH SuperH" contains two data and should get split up into:
name: SuperH
abbr: SH
By convention the first characters of "description" could be used, but you would again end up in userspace parsing and double info in one sysfs file.
I hope that's enough for convincing, I'd really like to go the .abbr way. Do you give me an acked-by for that one?
Thanks,
Thomas
Len Brown
reviewerRe: [PATCH 4/9] cpuidle: Introduce .abbr (abbrevation) for cpuidle states
In reply to Thomas RenningerI'm not fond of inventing a new 3-character abbreviation field for every state because display tools can't handle the existing 16-character name field.
If the display tools can only handle 3 characters, then why not have them simply use the 1st 3 characters of the existing name field? If that is not unique, then re-arrange the strings so that it is unique...
Of course the ACPI part of this patch will not apply, as it depends on patch 1 in this series, which was erroneous. For ACPI, the existing name field is already fine, as C%d fits into 3 characters.
thanks,
Len Brown, Intel Open Source Technology Center
PATCH 4/9 cpuidle: Introduce .abbr (abbrevation) for cpuidle states
In reply to Thomas Renningerand fill name, description and newly introduced abbrevation consistently (always use snprintf) in all cpuidle drivers.
This is mainly for perf timechart. It draws vector graphics pictures of sleep/idle state usage catching perf cpu_idle events. The string used for the idle state must not exceed 3 chars or you can't see much in these pictures.
The name could get used in the title, the introduced abbrevations inside of the picture and the text must therefore be rather short.
--- arch/arm/mach-at91/cpuidle.c | 12 ++++++++---- arch/arm/mach-davinci/cpuidle.c | 13 +++++++++---- arch/arm/mach-kirkwood/cpuidle.c | 12 ++++++++---- arch/arm/mach-omap2/cpuidle34xx.c | 3 ++- arch/sh/kernel/cpu/shmobile/cpuidle.c | 19 +++++++++++-------- drivers/acpi/processor_idle.c | 3 +++ drivers/cpuidle/cpuidle.c | 1 + drivers/cpuidle/sysfs.c | 3 +++ drivers/idle/intel_idle.c | 11 +++++++++++ include/linux/cpuidle.h | 2 ++ 10 files changed, 58 insertions(+), 21 deletions(-)
arch/arm/mach-at91/cpuidle.c +8 -4
@@ -73,16 +73,20 @@ static int at91_init_cpuidle(void) device->states[0 ].exit_latency =1 ; device->states[0 ].target_residency =10000 ; device->states[0 ].flags =CPUIDLE_FLAG_TIME_VALID ; -strcpy (device->states[0 ].name,"WFI" ); -strcpy (device->states[0 ].desc,"Wait for interrupt" ); +snprintf (device->states[0 ].name,CPUIDLE_NAME_LEN ,"WFI" ); +snprintf (device->states[0 ].desc,CPUIDLE_DESC_LEN , +"Wait for interrupt" ); +snprintf (device->states[0 ].abbr,CPUIDLE_ABBR_LEN ,"W" );/* Wait for interrupt and RAM self refresh state */ device->states[1 ].enter = at91_enter_idle; device->states[1 ].exit_latency =10 ; device->states[1 ].target_residency =10000 ; device->states[1 ].flags =CPUIDLE_FLAG_TIME_VALID ; -strcpy (device->states[1 ].name,"RAM_SR" ); -strcpy (device->states[1 ].desc,"WFI and RAM Self Refresh" ); +snprintf (device->states[1 ].name,CPUIDLE_NAME_LEN ,"RAM SR" ); +snprintf (device->states[1 ].desc,CPUIDLE_DESC_LEN , +"WFI and RAM Self Refresh" ); +snprintf (device->states[1 ].abbr,CPUIDLE_ABBR_LEN ,"WSR" );if (cpuidle_register_device (device)) {printk (KERN_ERR "at91_init_cpuidle: Failed registering\n" );
arch/arm/mach-davinci/cpuidle.c +9 -4
@@ -127,16 +127,21 @@ static int __init davinci_cpuidle_probe(struct platform_device *pdev) device->states[0 ].exit_latency =1 ; device->states[0 ].target_residency =10000 ; device->states[0 ].flags =CPUIDLE_FLAG_TIME_VALID ; -strcpy (device->states[0 ].name,"WFI" ); -strcpy (device->states[0 ].desc,"Wait for interrupt" ); +snprintf (device->states[0 ].name,CPUIDLE_NAME_LEN ,"WFI" ); +snprintf (device->states[0 ].desc,CPUIDLE_DESC_LEN , +"Wait for interrupt" ); +snprintf (device->states[0 ].abbr,CPUIDLE_ABBR_LEN ,"W" );/* Wait for interrupt and DDR self refresh state */ device->states[1 ].enter = davinci_enter_idle; device->states[1 ].exit_latency =10 ; device->states[1 ].target_residency =10000 ; device->states[1 ].flags =CPUIDLE_FLAG_TIME_VALID ; -strcpy (device->states[1 ].name,"DDR SR" ); -strcpy (device->states[1 ].desc,"WFI and DDR Self Refresh" ); +snprintf (device->states[1 ].name,CPUIDLE_NAME_LEN ,"RAM SR" ); +snprintf (device->states[1 ].desc,CPUIDLE_DESC_LEN , +"WFI and RAM Self Refresh" ); +snprintf (device->states[1 ].abbr,CPUIDLE_ABBR_LEN ,"WSR" ); +if (pdata->ddr2_pdown) davinci_states[1 ].flags |=DAVINCI_CPUIDLE_FLAGS_DDR2_PWDN ;cpuidle_set_statedata (&device->states[1 ], &davinci_states[1 ]);
arch/arm/mach-kirkwood/cpuidle.c +8 -4
@@ -75,16 +75,20 @@ static int kirkwood_init_cpuidle(void) device->states[0 ].exit_latency =1 ; device->states[0 ].target_residency =10000 ; device->states[0 ].flags =CPUIDLE_FLAG_TIME_VALID ; -strcpy (device->states[0 ].name,"WFI" ); -strcpy (device->states[0 ].desc,"Wait for interrupt" ); +snprintf (device->states[0 ].name,CPUIDLE_NAME_LEN ,"WFI" ); +snprintf (device->states[0 ].desc,CPUIDLE_DESC_LEN , +"Wait for interrupt" ); +snprintf (device->states[0 ].abbr,CPUIDLE_ABBR_LEN ,"W" );/* Wait for interrupt and DDR self refresh state */ device->states[1 ].enter = kirkwood_enter_idle; device->states[1 ].exit_latency =10 ; device->states[1 ].target_residency =10000 ; device->states[1 ].flags =CPUIDLE_FLAG_TIME_VALID ; -strcpy (device->states[1 ].name,"DDR SR" ); -strcpy (device->states[1 ].desc,"WFI and DDR Self Refresh" ); +snprintf (device->states[1 ].name,CPUIDLE_NAME_LEN ,"RAM SR" ); +snprintf (device->states[1 ].desc,CPUIDLE_DESC_LEN , +"WFI and RAM Self Refresh" ); +snprintf (device->states[1 ].abbr,CPUIDLE_ABBR_LEN ,"WSR" );if (cpuidle_register_device (device)) {printk (KERN_ERR "kirkwood_init_cpuidle: Failed registering\n" );
arch/arm/mach-omap2/cpuidle34xx.c +2 -1
@@ -496,7 +496,8 @@ int __init omap3_idle_init(void) omap3_enter_idle_bm : omap3_enter_idle;if (cx->type ==OMAP3_STATE_C1 ) dev->safe_state = state; -sprintf (state->name,"C%d" , count+1 ); +snprintf (state->name,CPUIDLE_NAME_LEN ,"C%d" , count+1 ); +snprintf (state->abbr,CPUIDLE_ABBR_LEN ,"C%d" , count+1 ); count++; }
arch/sh/kernel/cpu/shmobile/cpuidle.c +11 -8
@@ -75,8 +75,9 @@ void sh_mobile_setup_cpuidle(void) i =CPUIDLE_DRIVER_STATE_START ; state = &dev->states[i++]; -snprintf (state->name,CPUIDLE_NAME_LEN ,"C0" ); -strncpy (state->desc,"SuperH Sleep Mode" ,CPUIDLE_DESC_LEN ); +snprintf (state->name,CPUIDLE_NAME_LEN ,"SuperH" ); +snprintf (state->desc,CPUIDLE_DESC_LEN ,"SuperH Sleep Mode" ); +snprintf (state->abbr,CPUIDLE_ABBR_LEN ,"SH" ); state->exit_latency =1 ; state->target_residency =1 *2 ; state->power_usage =3 ;
@@ -89,9 +90,10 @@ void sh_mobile_setup_cpuidle(void)if (sh_mobile_sleep_supported &SUSP_SH_SF ) { state = &dev->states[i++]; -snprintf (state->name,CPUIDLE_NAME_LEN ,"C1" ); -strncpy (state->desc,"SuperH Sleep Mode [SF]" , -CPUIDLE_DESC_LEN ); +snprintf (state->name,CPUIDLE_NAME_LEN ,"SuperH [SF]" ); +snprintf (state->desc,CPUIDLE_DESC_LEN , +"SuperH Sleep Mode [SF]" ); +snprintf (state->abbr,CPUIDLE_ABBR_LEN ,"SHF" ); state->exit_latency =100 ; state->target_residency =1 *2 ; state->power_usage =1 ;
@@ -102,9 +104,10 @@ void sh_mobile_setup_cpuidle(void)if (sh_mobile_sleep_supported &SUSP_SH_STANDBY ) { state = &dev->states[i++]; -snprintf (state->name,CPUIDLE_NAME_LEN ,"C2" ); -strncpy (state->desc,"SuperH Mobile Standby Mode [SF]" , -CPUIDLE_DESC_LEN ); +snprintf (state->name,CPUIDLE_NAME_LEN ,"SuperH Standby [SF]" ); +snprintf (state->desc,CPUIDLE_DESC_LEN , +"SuperH Mobile Standby Mode [SF]" ); +snprintf (state->abbr,CPUIDLE_ABBR_LEN ,"SHS" ); state->exit_latency =2300 ; state->target_residency =1 *2 ; state->power_usage =1 ;
drivers/acpi/processor_idle.c +3 -0
@@ -1016,6 +1016,7 @@ static int acpi_processor_setup_cpuidle(struct acpi_processor *pr)switch (cx->type) {case ACPI_STATE_C1 :snprintf (state->name,CPUIDLE_NAME_LEN ,"C1" ); +snprintf (state->abbr,CPUIDLE_ABBR_LEN ,"C1" ); state->flags |=CPUIDLE_FLAG_SHALLOW ;if (cx->entry_method ==ACPI_CSTATE_FFH ) state->flags |=CPUIDLE_FLAG_TIME_VALID ;
@@ -1026,6 +1027,7 @@ static int acpi_processor_setup_cpuidle(struct acpi_processor *pr)case ACPI_STATE_C2 :snprintf (state->name,CPUIDLE_NAME_LEN ,"C2" ); +snprintf (state->abbr,CPUIDLE_ABBR_LEN ,"C2" ); state->flags |=CPUIDLE_FLAG_BALANCED ; state->flags |=CPUIDLE_FLAG_TIME_VALID ; state->enter = acpi_idle_enter_simple;
@@ -1034,6 +1036,7 @@ static int acpi_processor_setup_cpuidle(struct acpi_processor *pr)case ACPI_STATE_C3 :snprintf (state->name,CPUIDLE_NAME_LEN ,"C3" ); +snprintf (state->abbr,CPUIDLE_ABBR_LEN ,"C3" ); state->flags |=CPUIDLE_FLAG_DEEP ; state->flags |=CPUIDLE_FLAG_TIME_VALID ; state->flags |=CPUIDLE_FLAG_CHECK_BM ;
drivers/cpuidle/cpuidle.c +1 -0
@@ -268,6 +268,7 @@ static void poll_idle_init(struct cpuidle_device *dev)snprintf (state->name,CPUIDLE_NAME_LEN ,"POLL" );snprintf (state->desc,CPUIDLE_DESC_LEN ,"CPUIDLE CORE POLL IDLE" ); +snprintf (state->abbr,CPUIDLE_ABBR_LEN ,"P" ); state->exit_latency =0 ; state->target_residency =0 ; state->power_usage =-1 ;
drivers/cpuidle/sysfs.c +3 -0
@@ -249,9 +249,11 @@ define_show_state_ull_function(usage)define_show_state_ull_function (time) define_show_state_str_function(name) define_show_state_str_function(desc) +define_show_state_str_function(abbr) define_one_state_ro(name, show_state_name);define_one_state_ro (desc, show_state_desc); +define_one_state_ro (abbr, show_state_abbr);define_one_state_ro (latency, show_state_exit_latency);define_one_state_ro (power, show_state_power_usage);define_one_state_ro (usage, show_state_usage);
@@ -260,6 +262,7 @@ define_one_state_ro(time, show_state_time);static struct attribute *cpuidle_state_default_attrs[] = { &attr_name.attr, &attr_desc.attr, + &attr_abbr.attr, &attr_latency.attr, &attr_power.attr, &attr_usage.attr,
drivers/idle/intel_idle.c +11 -0
@@ -91,6 +91,7 @@ static struct cpuidle_state nehalem_cstates[MWAIT_MAX_NUM_CSTATES] = { {/* MWAIT C1 */ .name = "NHM-C1", .desc = "MWAIT 0x00", + .abbr = "C1", .driver_data = (void *) 0x00, .flags = CPUIDLE_FLAG_TIME_VALID, .exit_latency = 3,
@@ -99,6 +100,7 @@ static struct cpuidle_state nehalem_cstates[MWAIT_MAX_NUM_CSTATES] = { {/* MWAIT C2 */ .name = "NHM-C3", .desc = "MWAIT 0x10", + .abbr = "C3", .driver_data = (void *) 0x10, .flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED, .exit_latency = 20,
@@ -107,6 +109,7 @@ static struct cpuidle_state nehalem_cstates[MWAIT_MAX_NUM_CSTATES] = { {/* MWAIT C3 */ .name = "NHM-C6", .desc = "MWAIT 0x20", + .abbr = "C6", .driver_data = (void *) 0x20, .flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED, .exit_latency = 200,
@@ -119,6 +122,7 @@ static struct cpuidle_state snb_cstates[MWAIT_MAX_NUM_CSTATES] = { {/* MWAIT C1 */ .name = "SNB-C1", .desc = "MWAIT 0x00", + .abbr = "C1", .driver_data = (void *) 0x00, .flags = CPUIDLE_FLAG_TIME_VALID, .exit_latency = 1,
@@ -127,6 +131,7 @@ static struct cpuidle_state snb_cstates[MWAIT_MAX_NUM_CSTATES] = { {/* MWAIT C2 */ .name = "SNB-C3", .desc = "MWAIT 0x10", + .abbr = "C3", .driver_data = (void *) 0x10, .flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED, .exit_latency = 80,
@@ -135,6 +140,7 @@ static struct cpuidle_state snb_cstates[MWAIT_MAX_NUM_CSTATES] = { {/* MWAIT C3 */ .name = "SNB-C6", .desc = "MWAIT 0x20", + .abbr = "C6", .driver_data = (void *) 0x20, .flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED, .exit_latency = 104,
@@ -143,6 +149,7 @@ static struct cpuidle_state snb_cstates[MWAIT_MAX_NUM_CSTATES] = { {/* MWAIT C4 */ .name = "SNB-C7", .desc = "MWAIT 0x30", + .abbr = "C7", .driver_data = (void *) 0x30, .flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED, .exit_latency = 109,
@@ -155,6 +162,7 @@ static struct cpuidle_state atom_cstates[MWAIT_MAX_NUM_CSTATES] = { {/* MWAIT C1 */ .name = "ATM-C1", .desc = "MWAIT 0x00", + .abbr = "C1", .driver_data = (void *) 0x00, .flags = CPUIDLE_FLAG_TIME_VALID, .exit_latency = 1,
@@ -163,6 +171,7 @@ static struct cpuidle_state atom_cstates[MWAIT_MAX_NUM_CSTATES] = { {/* MWAIT C2 */ .name = "ATM-C2", .desc = "MWAIT 0x10", + .abbr = "C2", .driver_data = (void *) 0x10, .flags = CPUIDLE_FLAG_TIME_VALID, .exit_latency = 20,
@@ -172,6 +181,7 @@ static struct cpuidle_state atom_cstates[MWAIT_MAX_NUM_CSTATES] = { {/* MWAIT C4 */ .name = "ATM-C4", .desc = "MWAIT 0x30", + .abbr = "C4", .driver_data = (void *) 0x30, .flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED, .exit_latency = 100,
@@ -181,6 +191,7 @@ static struct cpuidle_state atom_cstates[MWAIT_MAX_NUM_CSTATES] = { {/* MWAIT C6 */ .name = "ATM-C6", .desc = "MWAIT 0x52", + .abbr = "C6", .driver_data = (void *) 0x52, .flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED, .exit_latency = 140,
include/linux/cpuidle.h +2 -0
@@ -20,6 +20,7 @@#define CPUIDLE_STATE_MAX 8#define CPUIDLE_NAME_LEN 16#define CPUIDLE_DESC_LEN 32 +#define CPUIDLE_ABBR_LEN 3struct cpuidle_device ;
@@ -31,6 +32,7 @@ struct cpuidle_device;struct cpuidle_state {char name[CPUIDLE_NAME_LEN ];char desc[CPUIDLE_DESC_LEN ]; +char abbr[CPUIDLE_ABBR_LEN ];void *driver_data;unsigned int flags;
Signature · 1 line
1.7.3.1
PATCH 5/9 acpi: processor->cpuidle: Only set cpuidle check_bm flag if pr->flags.bm_check is set
In reply to Thomas Renninger--- drivers/acpi/processor_idle.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/acpi/processor_idle.c +2 -1
@@ -1039,7 +1039,8 @@ static int acpi_processor_setup_cpuidle(struct acpi_processor *pr)snprintf (state->abbr,CPUIDLE_ABBR_LEN ,"C3" ); state->flags |=CPUIDLE_FLAG_DEEP ; state->flags |=CPUIDLE_FLAG_TIME_VALID ; - state->flags |=CPUIDLE_FLAG_CHECK_BM ; +if (pr->flags.bm_check) + state->flags |=CPUIDLE_FLAG_CHECK_BM ; state->enter = pr->flags.bm_check ? acpi_idle_enter_bm : acpi_idle_enter_simple;
Signature · 1 line
1.7.3.1
Len Brown
reviewerRe: [PATCH 5/9] acpi: processor->cpuidle: Only set cpuidle check_bm flag if pr->flags.bm_check is set
Quoted 9 lines · Thomas Renninger
drivers/acpi/processor_idle.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)drivers/acpi/processor_idle.c +0
-0
drivers/acpi/processor_idle.c static int acpi_processor_setup_cpuidle(struct acpi_processor *pr) · line 1046
Quoted 9 lines
drivers/acpi/processor_idle.c +2
-1@@ -1039,7 +1039,8 @@ static int acpi_processor_setup_cpuidle(struct acpi_processor *pr)snprintf (state->abbr,CPUIDLE_ABBR_LEN ,"C3" ); state->flags |=CPUIDLE_FLAG_DEEP ; state->flags |=CPUIDLE_FLAG_TIME_VALID ; - state->flags |=CPUIDLE_FLAG_CHECK_BM ; +if (pr->flags.bm_check) + state->flags |=CPUIDLE_FLAG_CHECK_BM ; state->enter = pr->flags.bm_check ? acpi_idle_enter_bm : acpi_idle_enter_simple;
While it is logical, this patch is a NO-OP, since nobody ever checks for state->flags |= CPUIDLE_FLAG_CHECK_BM -- not cpuidle, and not the platform driver.
ie. it would be better to delete use of this flag from this file.
This points out a problem w/ cpuidle, of course.
Who owns and defines state->flags -- cpuidle and its governors, or the cpuidle drivers?
cpuidle and its governors look only at...CPUIDLE_FLAG_TIME_VALID and CPUIDLE_FLAG_IGNORE
cpuidle sets, but never looks at, CPUIDLE_FLAG_POLL
only intel_idle uses CPUIDLE_FLAG_TLB_FLUSHED,
so it should probably define it.
only OMAP uses CPUIDLE_FLAG_CHECK_BM,
so it should define it (or create a flag
that actually says what they mean here)
CPUIDLE_FLAG_SHALLOW, CPUIDLE_FLAG_BALANCED, CPUIDLE_FLAG_DEEP are set in various architectures, but never checked, so they should be deleted.
thanks,
Len Brown, Intel Open Source Technology Center
Len Brown
reviewerPATCH 1/1 ACPI: processor_idle: delete use of NOP CPUIDLE_FLAGs
From: Len Brown <[email protected]>
CPUIDLE_FLAG_SHALLOWCPUIDLE_FLAG_BALANCEDCPUIDLE_FLAG_DEEPCPUIDLE_FLAG_CHECK_BM
were set by acpi_processor_setup_cpuidle(),
but never used by cpuidle or by acpi_idle.
So stop setting them.
--- drivers/acpi/processor_idle.c | 4 ---- 1 files changed, 0 insertions(+), 4 deletions(-)
drivers/acpi/processor_idle.c +0 -4
@@ -1023,7 +1023,6 @@ static int acpi_processor_setup_cpuidle(struct acpi_processor *pr) state->flags =0 ;switch (cx->type) {case ACPI_STATE_C1 : - state->flags |=CPUIDLE_FLAG_SHALLOW ;if (cx->entry_method ==ACPI_CSTATE_FFH ) state->flags |=CPUIDLE_FLAG_TIME_VALID ;
@@ -1032,16 +1031,13 @@ static int acpi_processor_setup_cpuidle(struct acpi_processor *pr)break ;case ACPI_STATE_C2 : - state->flags |=CPUIDLE_FLAG_BALANCED ; state->flags |=CPUIDLE_FLAG_TIME_VALID ; state->enter = acpi_idle_enter_simple; dev->safe_state = state;break ;case ACPI_STATE_C3 : - state->flags |=CPUIDLE_FLAG_DEEP ; state->flags |=CPUIDLE_FLAG_TIME_VALID ; - state->flags |=CPUIDLE_FLAG_CHECK_BM ; state->enter = pr->flags.bm_check ? acpi_idle_enter_bm : acpi_idle_enter_simple;
Signature · 1 line
1.7.4.rc1.7.g2cf08
Len Brown
reviewerPATCH 1/1 cpuidle: delete NOP CPUIDLE_FLAG_POLL
From: Len Brown <[email protected]>
it serves no purpose
--- drivers/cpuidle/cpuidle.c | 2 +- include/linux/cpuidle.h | 1 - 2 files changed, 1 insertions(+), 2 deletions(-)
drivers/cpuidle/cpuidle.c +1 -1
@@ -186,7 +186,7 @@ static void poll_idle_init(struct cpuidle_device *dev) state->exit_latency =0 ; state->target_residency =0 ; state->power_usage =-1 ; - state->flags =CPUIDLE_FLAG_POLL ; + state->flags =0 ; state->enter = poll_idle; }#else
include/linux/cpuidle.h +0 -1
@@ -48,7 +48,6 @@ struct cpuidle_state {/* Idle State Flags */ #define CPUIDLE_FLAG_TIME_VALID (0x01)/* is residency time measurable? */ #define CPUIDLE_FLAG_CHECK_BM (0x02)/* BM activity will exit state */ -#define CPUIDLE_FLAG_POLL (0x10)/* no latency, no savings */ #define CPUIDLE_FLAG_SHALLOW (0x20)/* low latency, minimal savings */ #define CPUIDLE_FLAG_BALANCED (0x40)/* medium latency, moderate savings */ #define CPUIDLE_FLAG_DEEP (0x80)/* high latency, large savings */
Signature · 1 line
1.7.4.rc1.7.g2cf08
Len Brown
reviewerPATCH 1/1 SH, cpuidle: delete use of NOP CPUIDLE_FLAGS_SHALLOW
From: Len Brown <[email protected]>
set but not checked.
--- arch/sh/kernel/cpu/shmobile/cpuidle.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
arch/sh/kernel/cpu/shmobile/cpuidle.c +0 -1
@@ -81,7 +81,6 @@ void sh_mobile_setup_cpuidle(void) state->target_residency =1 *2 ; state->power_usage =3 ; state->flags =0 ; - state->flags |=CPUIDLE_FLAG_SHALLOW ; state->flags |=CPUIDLE_FLAG_TIME_VALID ; state->enter = cpuidle_sleep_enter;
Signature · 1 line
1.7.4.rc1.7.g2cf08
Len Brown
reviewerPATCH 1/1 cpuidle: delete unused CPUIDLE_FLAG_SHALLOW, BALANCED, DEEP definitions
From: Len Brown <[email protected]>
--- include/linux/cpuidle.h | 3 --- 1 files changed, 0 insertions(+), 3 deletions(-)
include/linux/cpuidle.h +0 -3
@@ -48,9 +48,6 @@ struct cpuidle_state {/* Idle State Flags */ #define CPUIDLE_FLAG_TIME_VALID (0x01)/* is residency time measurable? */ #define CPUIDLE_FLAG_CHECK_BM (0x02)/* BM activity will exit state */ -#define CPUIDLE_FLAG_SHALLOW (0x20)/* low latency, minimal savings */ -#define CPUIDLE_FLAG_BALANCED (0x40)/* medium latency, moderate savings */ -#define CPUIDLE_FLAG_DEEP (0x80)/* high latency, large savings */ #define CPUIDLE_FLAG_IGNORE (0x100)/* ignore during this idle period */ #define CPUIDLE_FLAG_TLB_FLUSHED (0x200)/* tlb will be flushed */
Signature · 1 line
1.7.4.rc1.7.g2cf08
Len Brown
reviewerPATCH 1/1 cpuidle: delete unused CPUIDLE_FLAG_SHALLOW, BALANCED, DEEP definitions
In reply to Len BrownFrom: Len Brown <[email protected]>
--- include/linux/cpuidle.h | 3 --- 1 files changed, 0 insertions(+), 3 deletions(-)
include/linux/cpuidle.h +0 -3
@@ -48,9 +48,6 @@ struct cpuidle_state {/* Idle State Flags */ #define CPUIDLE_FLAG_TIME_VALID (0x01)/* is residency time measurable? */ #define CPUIDLE_FLAG_CHECK_BM (0x02)/* BM activity will exit state */ -#define CPUIDLE_FLAG_SHALLOW (0x20)/* low latency, minimal savings */ -#define CPUIDLE_FLAG_BALANCED (0x40)/* medium latency, moderate savings */ -#define CPUIDLE_FLAG_DEEP (0x80)/* high latency, large savings */ #define CPUIDLE_FLAG_IGNORE (0x100)/* ignore during this idle period */ #define CPUIDLE_FLAG_TLB_FLUSHED (0x200)/* tlb will be flushed */
Signature · 1 line
1.7.4.rc1.7.g2cf08
Len Brown
reviewerPATCH 1/1 cpuidle: CPUIDLE_FLAG_TLB_FLUSHED is specific to intel_idle
In reply to Len BrownFrom: Len Brown <[email protected]>
--- drivers/idle/intel_idle.c | 8 ++++++++ include/linux/cpuidle.h | 1 - 2 files changed, 8 insertions(+), 1 deletions(-)
drivers/idle/intel_idle.c +8 -0
@@ -82,6 +82,14 @@ static int intel_idle(struct cpuidle_device *dev, struct cpuidle_state *state);static struct cpuidle_state *cpuidle_state_table;/* +* Set this flag for states where the HW flushes the TLB for us +* and so we don't need cross-calls to keep it consistent. +* If this flag is set, SW flushes the TLB, so even if the +* HW doesn't do the flushing, this flag is safe to use. +*/ +#define CPUIDLE_FLAG_TLB_FLUSHED 0x10000 + +/* * States are indexed by the cstate number, * which is also the index into the MWAIT hint array. * Thus C0 is a dummy.
include/linux/cpuidle.h +0 -1
@@ -49,7 +49,6 @@ struct cpuidle_state {#define CPUIDLE_FLAG_TIME_VALID (0x01)/* is residency time measurable? */ #define CPUIDLE_FLAG_CHECK_BM (0x02)/* BM activity will exit state */ #define CPUIDLE_FLAG_IGNORE (0x100)/* ignore during this idle period */ -#define CPUIDLE_FLAG_TLB_FLUSHED (0x200)/* tlb will be flushed */ #define CPUIDLE_DRIVER_FLAGS_MASK (0xFFFF0000)
Signature · 1 line
1.7.4.rc1.7.g2cf08
Len Brown
reviewerPATCH 1/1 cpuidle: CPUIDLE_FLAG_CHECK_BM is omap3_idle specific
From: Len Brown <[email protected]>
--- arch/arm/mach-omap2/cpuidle34xx.c | 2 ++ include/linux/cpuidle.h | 1 - 2 files changed, 2 insertions(+), 1 deletions(-)
arch/arm/mach-omap2/cpuidle34xx.c +2 -0
@@ -47,6 +47,8 @@#define OMAP3_STATE_MAX OMAP3_STATE_C7 +#define CPUIDLE_FLAG_CHECK_BM 0x10000/* use omap3_enter_idle_bm() */ +struct omap3_processor_cx {u8 valid;u8 type;
include/linux/cpuidle.h +0 -1
@@ -47,7 +47,6 @@ struct cpuidle_state {/* Idle State Flags */ #define CPUIDLE_FLAG_TIME_VALID (0x01)/* is residency time measurable? */ -#define CPUIDLE_FLAG_CHECK_BM (0x02)/* BM activity will exit state */ #define CPUIDLE_FLAG_IGNORE (0x100)/* ignore during this idle period */ #define CPUIDLE_DRIVER_FLAGS_MASK (0xFFFF0000)
Signature · 1 line
1.7.4.rc1.7.g2cf08
Len Brown
reviewerPATCH 1/1 cpuidle: CPUIDLE_FLAG_CHECK_BM is omap3_idle specific
In reply to Len BrownFrom: Len Brown <[email protected]>
--- arch/arm/mach-omap2/cpuidle34xx.c | 2 ++ include/linux/cpuidle.h | 1 - 2 files changed, 2 insertions(+), 1 deletions(-)
arch/arm/mach-omap2/cpuidle34xx.c +2 -0
@@ -47,6 +47,8 @@#define OMAP3_STATE_MAX OMAP3_STATE_C7 +#define CPUIDLE_FLAG_CHECK_BM 0x10000/* use omap3_enter_idle_bm() */ +struct omap3_processor_cx {u8 valid;u8 type;
include/linux/cpuidle.h +0 -1
@@ -47,7 +47,6 @@ struct cpuidle_state {/* Idle State Flags */ #define CPUIDLE_FLAG_TIME_VALID (0x01)/* is residency time measurable? */ -#define CPUIDLE_FLAG_CHECK_BM (0x02)/* BM activity will exit state */ #define CPUIDLE_FLAG_IGNORE (0x100)/* ignore during this idle period */ #define CPUIDLE_DRIVER_FLAGS_MASK (0xFFFF0000)
Signature · 1 line
1.7.4.rc1.7.g2cf08
Len Brown
reviewerPATCH 1/1 cpuidle: CPUIDLE_FLAG_TLB_FLUSHED is specific to intel_idle
In reply to Len BrownFrom: Len Brown <[email protected]>
--- drivers/idle/intel_idle.c | 8 ++++++++ include/linux/cpuidle.h | 1 - 2 files changed, 8 insertions(+), 1 deletions(-)
drivers/idle/intel_idle.c +8 -0
@@ -82,6 +82,14 @@ static int intel_idle(struct cpuidle_device *dev, struct cpuidle_state *state);static struct cpuidle_state *cpuidle_state_table;/* +* Set this flag for states where the HW flushes the TLB for us +* and so we don't need cross-calls to keep it consistent. +* If this flag is set, SW flushes the TLB, so even if the +* HW doesn't do the flushing, this flag is safe to use. +*/ +#define CPUIDLE_FLAG_TLB_FLUSHED 0x10000 + +/* * States are indexed by the cstate number, * which is also the index into the MWAIT hint array. * Thus C0 is a dummy.
include/linux/cpuidle.h +0 -1
@@ -49,7 +49,6 @@ struct cpuidle_state {#define CPUIDLE_FLAG_TIME_VALID (0x01)/* is residency time measurable? */ #define CPUIDLE_FLAG_CHECK_BM (0x02)/* BM activity will exit state */ #define CPUIDLE_FLAG_IGNORE (0x100)/* ignore during this idle period */ -#define CPUIDLE_FLAG_TLB_FLUSHED (0x200)/* tlb will be flushed */ #define CPUIDLE_DRIVER_FLAGS_MASK (0xFFFF0000)
Signature · 1 line
1.7.4.rc1.7.g2cf08
Len Brown
reviewerPATCH 1/1 SH, cpuidle: delete use of NOP CPUIDLE_FLAGS_SHALLOW
In reply to Len BrownFrom: Len Brown <[email protected]>
set but not checked.
--- arch/sh/kernel/cpu/shmobile/cpuidle.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
arch/sh/kernel/cpu/shmobile/cpuidle.c +0 -1
@@ -81,7 +81,6 @@ void sh_mobile_setup_cpuidle(void) state->target_residency =1 *2 ; state->power_usage =3 ; state->flags =0 ; - state->flags |=CPUIDLE_FLAG_SHALLOW ; state->flags |=CPUIDLE_FLAG_TIME_VALID ; state->enter = cpuidle_sleep_enter;
Signature · 1 line
1.7.4.rc1.7.g2cf08
Len Brown
reviewerPATCH 1/1 cpuidle: delete NOP CPUIDLE_FLAG_POLL
In reply to Len BrownFrom: Len Brown <[email protected]>
it serves no purpose
--- drivers/cpuidle/cpuidle.c | 2 +- include/linux/cpuidle.h | 1 - 2 files changed, 1 insertions(+), 2 deletions(-)
drivers/cpuidle/cpuidle.c +1 -1
@@ -186,7 +186,7 @@ static void poll_idle_init(struct cpuidle_device *dev) state->exit_latency =0 ; state->target_residency =0 ; state->power_usage =-1 ; - state->flags =CPUIDLE_FLAG_POLL ; + state->flags =0 ; state->enter = poll_idle; }#else
include/linux/cpuidle.h +0 -1
@@ -48,7 +48,6 @@ struct cpuidle_state {/* Idle State Flags */ #define CPUIDLE_FLAG_TIME_VALID (0x01)/* is residency time measurable? */ #define CPUIDLE_FLAG_CHECK_BM (0x02)/* BM activity will exit state */ -#define CPUIDLE_FLAG_POLL (0x10)/* no latency, no savings */ #define CPUIDLE_FLAG_SHALLOW (0x20)/* low latency, minimal savings */ #define CPUIDLE_FLAG_BALANCED (0x40)/* medium latency, moderate savings */ #define CPUIDLE_FLAG_DEEP (0x80)/* high latency, large savings */
Signature · 1 line
1.7.4.rc1.7.g2cf08
Len Brown
reviewerPATCH 1/1 ACPI: processor_idle: delete use of NOP CPUIDLE_FLAGs
In reply to Len BrownFrom: Len Brown <[email protected]>
CPUIDLE_FLAG_SHALLOWCPUIDLE_FLAG_BALANCEDCPUIDLE_FLAG_DEEPCPUIDLE_FLAG_CHECK_BM
were set by acpi_processor_setup_cpuidle(),
but never used by cpuidle or by acpi_idle.
So stop setting them.
--- drivers/acpi/processor_idle.c | 4 ---- 1 files changed, 0 insertions(+), 4 deletions(-)
drivers/acpi/processor_idle.c +0 -4
@@ -1023,7 +1023,6 @@ static int acpi_processor_setup_cpuidle(struct acpi_processor *pr) state->flags =0 ;switch (cx->type) {case ACPI_STATE_C1 : - state->flags |=CPUIDLE_FLAG_SHALLOW ;if (cx->entry_method ==ACPI_CSTATE_FFH ) state->flags |=CPUIDLE_FLAG_TIME_VALID ;
@@ -1032,16 +1031,13 @@ static int acpi_processor_setup_cpuidle(struct acpi_processor *pr)break ;case ACPI_STATE_C2 : - state->flags |=CPUIDLE_FLAG_BALANCED ; state->flags |=CPUIDLE_FLAG_TIME_VALID ; state->enter = acpi_idle_enter_simple; dev->safe_state = state;break ;case ACPI_STATE_C3 : - state->flags |=CPUIDLE_FLAG_DEEP ; state->flags |=CPUIDLE_FLAG_TIME_VALID ; - state->flags |=CPUIDLE_FLAG_CHECK_BM ; state->enter = pr->flags.bm_check ? acpi_idle_enter_bm : acpi_idle_enter_simple;
Signature · 1 line
1.7.4.rc1.7.g2cf08
Len Brown
reviewerRe: [PATCH 5/9] acpi: processor->cpuidle: Only set cpuidle check_bm flag if pr->flags.bm_check is set
In reply to Thomas RenningerQuoted 9 lines · Thomas Renninger
drivers/acpi/processor_idle.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)drivers/acpi/processor_idle.c +0
-0
drivers/acpi/processor_idle.c static int acpi_processor_setup_cpuidle(struct acpi_processor *pr) · line 1046
Quoted 9 lines
drivers/acpi/processor_idle.c +2
-1@@ -1039,7 +1039,8 @@ static int acpi_processor_setup_cpuidle(struct acpi_processor *pr)snprintf (state->abbr,CPUIDLE_ABBR_LEN ,"C3" ); state->flags |=CPUIDLE_FLAG_DEEP ; state->flags |=CPUIDLE_FLAG_TIME_VALID ; - state->flags |=CPUIDLE_FLAG_CHECK_BM ; +if (pr->flags.bm_check) + state->flags |=CPUIDLE_FLAG_CHECK_BM ; state->enter = pr->flags.bm_check ? acpi_idle_enter_bm : acpi_idle_enter_simple;
While it is logical, this patch is a NO-OP, since nobody ever checks for state->flags |= CPUIDLE_FLAG_CHECK_BM -- not cpuidle, and not the platform driver.
ie. it would be better to delete use of this flag from this file.
This points out a problem w/ cpuidle, of course.
Who owns and defines state->flags -- cpuidle and its governors, or the cpuidle drivers?
cpuidle and its governors look only at...CPUIDLE_FLAG_TIME_VALID and CPUIDLE_FLAG_IGNORE
cpuidle sets, but never looks at, CPUIDLE_FLAG_POLL
only intel_idle uses CPUIDLE_FLAG_TLB_FLUSHED,
so it should probably define it.
only OMAP uses CPUIDLE_FLAG_CHECK_BM,
so it should define it (or create a flag
that actually says what they mean here)
CPUIDLE_FLAG_SHALLOW, CPUIDLE_FLAG_BALANCED, CPUIDLE_FLAG_DEEP are set in various architectures, but never checked, so they should be deleted.
thanks,
Len Brown, Intel Open Source Technology Center
PATCH 5/9 acpi: processor->cpuidle: Only set cpuidle check_bm flag if pr->flags.bm_check is set
In reply to Thomas Renninger--- drivers/acpi/processor_idle.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/acpi/processor_idle.c +2 -1
@@ -1039,7 +1039,8 @@ static int acpi_processor_setup_cpuidle(struct acpi_processor *pr)snprintf (state->abbr,CPUIDLE_ABBR_LEN ,"C3" ); state->flags |=CPUIDLE_FLAG_DEEP ; state->flags |=CPUIDLE_FLAG_TIME_VALID ; - state->flags |=CPUIDLE_FLAG_CHECK_BM ; +if (pr->flags.bm_check) + state->flags |=CPUIDLE_FLAG_CHECK_BM ; state->enter = pr->flags.bm_check ? acpi_idle_enter_bm : acpi_idle_enter_simple;
Signature · 1 line
1.7.3.1
PATCH 6/9 perf (userspace): Fix variable clash with glibc time() func
In reply to Thomas Renninger--- tools/perf/util/svghelper.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)
tools/perf/util/svghelper.c +3 -2
@@ -43,11 +43,12 @@ static double cpu2y(int cpu)return cpu2slot (cpu) *SLOT_MULT ; } -static double time2pixels (u64 time) +static double time2pixels (u64 __time) {double X ; -X =1.0 * svg_page_width * (time - first_time) / (last_time - first_time); +X =1.0 * svg_page_width * + (__time - first_time) / (last_time - first_time);return X ; }
Signature · 1 line
1.7.3.1
PATCH 7/9 perf (userspace): Introduce --verbose param for perf timechart
In reply to Thomas Renningerby making use of the already available global verbose variable from util/debug.h (similar to perf diff or perf top).
Some already introduced if (verbose) condtitions in util/svnhelper.c will also be activated with that one.
--- tools/perf/builtin-timechart.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)
tools/perf/builtin-timechart.c +7 -0
@@ -31,6 +31,7 @@#include "util/event.h" #include "util/session.h" #include "util/svghelper.h" +#include "util/debug.h" #define SUPPORT_OLD_POWER_EVENTS 1#define PWR_EVENT_EXIT -1
@@ -382,6 +383,10 @@ static void c_state_end(int cpu, u64 timestamp) pwr->next = power_events; power_events = pwr; +if (verbose) +printf ("CPU: %d - start_time: %llu - end_time: %llu\n" , + power_events->cpu, power_events->start_time, + power_events->end_time); }static void p_state_change (int cpu,u64 timestamp,u64 new_freq)
@@ -1069,6 +1074,8 @@ parse_process(const struct option *opt __used, const char *arg, int __used unset }static const struct option options[] = { +OPT_INCR ('v' ,"verbose" , &verbose, +"print extended debug info to stdout" ),OPT_STRING ('i' ,"input" , &input_name,"file" ,"input file name" ), OPT_STRING('o', "output", &output_name, "file",
Signature · 1 line
1.7.3.1
PATCH 8/9 perf timechart: Map power:cpu_idle events to the corresponding cpuidle state
In reply to Thomas RenningerBefore, power:cpu_idle events were very specific X86 Intel mwait events. This got fixed with previous patches and cpu_idle events are now thrown by all cpuidle drivers and can be mapped to the corresponding cpuidle state in /sys.
This patch reads out the corresponding cpuidle name of a cpu_idle event and uses it in the title line of the chart (c-states Cx in x86, omap2
- DDR self refresh states for various arm archs).
It also reads out the corresponding abbr(eviation) and uses the string to draw the cpu idle occurences. This needs a short (3 letter) string to keep the overview in the chart.
--- tools/perf/util/include/linux/cpuidle.h | 20 ++++ tools/perf/util/svghelper.c | 149 +++++++++++++++++++++++++++--- 2 files changed, 154 insertions(+), 15 deletions(-) create mode 100644 tools/perf/util/include/linux/cpuidle.h
tools/perf/util/include/linux/cpuidle.h new file +20 -0
@@ -0,0 +1,20 @@ +#ifndef __PERF_CPUIDLE_H_ +#define __PERF_CPUIDLE_H_ + +/* This comes from include/linux/cpuidle.h kernel header **********/ +#define CPUIDLE_STATE_MAX 8 +#define CPUIDLE_NAME_LEN 16 +#define CPUIDLE_DESC_LEN 32 +#define CPUIDLE_ABBR_LEN 3 +/******************************************************************/ + +struct cpuidle_state { +char name[CPUIDLE_NAME_LEN +1 ]; +char abbr[CPUIDLE_ABBR_LEN +1 ]; +}; + +extern struct cpuidle_state cpuidle_states[CPUIDLE_STATE_MAX ]; + +extern unsigned int cpuidle_info_max; + +#endif
tools/perf/util/svghelper.c +134 -15
193 lines not on this page · raw message
Signature · 1 line
1.7.3.1
Re: [PATCH 8/9] perf timechart: Map power:cpu_idle events to the corresponding cpuidle state
Argh, forgot guilt refresh on this one.
The changelog could be a bit more detailed by adding:
Quoted 5 lines · On Friday 07 January 2011 11:29:49 Thomas Renninger wrote:
Before, power:cpu_idle events were very specific X86 Intel mwait events. This got fixed with previous patches and
cpu_idleevents are now thrown by all cpuidle drivers and can be mapped to the corresponding cpuidle state in /sys.
Quoted 7 lines
This patch reads out the corresponding cpuidle name of a
cpu_idleevent and uses it in the title line of the chart (c-states Cx in x86, omap2
- DDR self refresh states for various arm archs).It also reads out the corresponding abbr(eviation) and uses the string to draw the cpu idle occurences. This needs a short (3 letter) string to keep the overview in the chart.
All features/fixes this patch includes:
- Read up cpuidle events from sysfs if available
and thus make them architecture independent
- Use (free) green color to display idle events in the chart, red is also used by "Blocked IO" event(s)
- Fix wrong class="rect.cX" to class="cX" idle box svg drawing definitions. This fixes up black idle drawings for eog (eye of gnome) and firefox (inkscape somehow could handle the broken case).
Thomas
Re: [PATCH 8/9] perf timechart: Map power:cpu_idle events to the corresponding cpuidle state
In reply to Thomas RenningerArgh, forgot guilt refresh on this one.
The changelog could be a bit more detailed by adding:
Quoted 5 lines · On Friday 07 January 2011 11:29:49 Thomas Renninger wrote:
Before, power:cpu_idle events were very specific X86 Intel mwait events. This got fixed with previous patches and
cpu_idleevents are now thrown by all cpuidle drivers and can be mapped to the corresponding cpuidle state in /sys.
Quoted 7 lines
This patch reads out the corresponding cpuidle name of a
cpu_idleevent and uses it in the title line of the chart (c-states Cx in x86, omap2
- DDR self refresh states for various arm archs).It also reads out the corresponding abbr(eviation) and uses the string to draw the cpu idle occurences. This needs a short (3 letter) string to keep the overview in the chart.
All features/fixes this patch includes:
- Read up cpuidle events from sysfs if available
and thus make them architecture independent
- Use (free) green color to display idle events in the chart, red is also used by "Blocked IO" event(s)
- Fix wrong class="rect.cX" to class="cX" idle box svg drawing definitions. This fixes up black idle drawings for eog (eye of gnome) and firefox (inkscape somehow could handle the broken case).
Thomas
PATCH 8/9 perf timechart: Map power:cpu_idle events to the corresponding cpuidle state
In reply to Thomas RenningerBefore, power:cpu_idle events were very specific X86 Intel mwait events. This got fixed with previous patches and cpu_idle events are now thrown by all cpuidle drivers and can be mapped to the corresponding cpuidle state in /sys.
This patch reads out the corresponding cpuidle name of a cpu_idle event and uses it in the title line of the chart (c-states Cx in x86, omap2
- DDR self refresh states for various arm archs).
It also reads out the corresponding abbr(eviation) and uses the string to draw the cpu idle occurences. This needs a short (3 letter) string to keep the overview in the chart.
--- tools/perf/util/include/linux/cpuidle.h | 20 ++++ tools/perf/util/svghelper.c | 149 +++++++++++++++++++++++++++--- 2 files changed, 154 insertions(+), 15 deletions(-) create mode 100644 tools/perf/util/include/linux/cpuidle.h
tools/perf/util/include/linux/cpuidle.h new file +20 -0
@@ -0,0 +1,20 @@ +#ifndef __PERF_CPUIDLE_H_ +#define __PERF_CPUIDLE_H_ + +/* This comes from include/linux/cpuidle.h kernel header **********/ +#define CPUIDLE_STATE_MAX 8 +#define CPUIDLE_NAME_LEN 16 +#define CPUIDLE_DESC_LEN 32 +#define CPUIDLE_ABBR_LEN 3 +/******************************************************************/ + +struct cpuidle_state { +char name[CPUIDLE_NAME_LEN +1 ]; +char abbr[CPUIDLE_ABBR_LEN +1 ]; +}; + +extern struct cpuidle_state cpuidle_states[CPUIDLE_STATE_MAX ]; + +extern unsigned int cpuidle_info_max; + +#endif
tools/perf/util/svghelper.c +134 -15
193 lines not on this page · raw message
Signature · 1 line
1.7.3.1
PATCH 9/9 perf: timechart: Fix memleak
In reply to Thomas RenningerThere are others, but these are not worth it, e.g. built up power event list which gets destroyed on program exit anyway or some bytes when trace events get parsed.
This one showed by far the biggest memory waste, was easy to fix and could help when parsing huge trace event records.
Found with valgrind, fixes:
==43509== 1,402 bytes in 251 blocks are definitely lost in loss record 61 of 74
==43509== at 0x4C261D7: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==43509== by 0x61573B1: strdup (in /lib64/libc-2.11.1.so) ==43509== by 0x41DD3D: draw_wakeups (builtin-timechart.c:706) ==43509== by 0x41E7C9: write_svg_file (builtin-timechart.c:957) ==43509== by 0x41E87E: __cmd_timechart (builtin-timechart.c:989) ==43509== by 0x41EB3C: cmd_timechart (builtin-timechart.c:1097) ==43509== by 0x40D776: run_builtin (perf.c:286) ==43509== by 0x40D993: handle_internal_command (perf.c:357) ==43509== by 0x40DAD2: run_argv (perf.c:401) ==43509== by 0x40DCB3: main (perf.c:487) ==43509== ==43509== 2,826 bytes in 429 blocks are definitely lost in loss record 63 of 74 ==43509== at 0x4C261D7: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==43509== by 0x61573B1: strdup (in /lib64/libc-2.11.1.so) ==43509== by 0x41DD70: draw_wakeups (builtin-timechart.c:710) ==43509== by 0x41E7C9: write_svg_file (builtin-timechart.c:957) ==43509== by 0x41E87E: __cmd_timechart (builtin-timechart.c:989) ==43509== by 0x41EB3C: cmd_timechart (builtin-timechart.c:1097) ==43509== by 0x40D776: run_builtin (perf.c:286) ==43509== by 0x40D993: handle_internal_command (perf.c:357) ==43509== by 0x40DAD2: run_argv (perf.c:401) ==43509== by 0x40DCB3: main (perf.c:487) --- tools/perf/builtin-timechart.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-)
tools/perf/builtin-timechart.c +8 -0
@@ -696,10 +696,14 @@ static void draw_wakeups(void)if (c->Y && c->start_time <= we->time && c->end_time >= we->time) {if (p->pid == we->waker && !from) { from = c->Y; +if (task_from) +free (task_from); task_from =strdup (c->comm); }if (p->pid == we->wakee && !to) { to = c->Y; +if (task_to) +free (task_to); task_to =strdup (c->comm); } }
@@ -709,10 +713,14 @@ static void draw_wakeups(void)while (c) {if (p->pid == we->waker && !from) { from = c->Y; +if (task_from) +free (task_from); task_from =strdup (c->comm); }if (p->pid == we->wakee && !to) { to = c->Y; +if (task_to) +free (task_to); task_to =strdup (c->comm); } c = c->next;
Signature · 1 line
1.7.3.1