linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Len Brown <lenb@kernel.org>
To: Thomas Renninger <trenn@suse.de>
Cc: linux-perf-users@vger.kernel.org, mingo@elte.hu,
	arjan@linux.intel.com, j-pihet@ti.com,
	linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/9] acpi: Use ACPI C-state type instead of enumeration value to export cpuidle state name
Date: Fri, 07 Jan 2011 15:45:18 -0500 (EST)	[thread overview]
Message-ID: <alpine.LFD.2.02.1101071529100.20609@x980> (raw)
In-Reply-To: <1294396190-23031-2-git-send-email-trenn@suse.de>

On Fri, 7 Jan 2011, Thomas Renninger wrote:

> 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.

> Signed-off-by: Thomas Renninger <trenn@suse.de>
> CC: arjan@linux.intel.com
> CC: lenb@kernel.org
> CC: linux-acpi@vger.kernel.org
> CC: linux-kernel@vger.kernel.org
> ---
>  drivers/acpi/processor_idle.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
> index dcb38f8..104ae77 100644
> --- a/drivers/acpi/processor_idle.c
> +++ b/drivers/acpi/processor_idle.c
> @@ -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;
> -- 
> 1.7.3.1
> 

  reply	other threads:[~2011-01-07 20:45 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-07 10:29 [PATCH 0/9] Make cpu_idle events architecture independent Thomas Renninger
2011-01-07 10:29 ` [PATCH 1/9] acpi: Use ACPI C-state type instead of enumeration value to export cpuidle state name Thomas Renninger
2011-01-07 20:45   ` Len Brown [this message]
2011-01-09 12:30     ` Thomas Renninger
2011-01-12  6:36       ` Len Brown
2011-01-12 12:33         ` Thomas Renninger
2011-01-12 22:41           ` Len Brown
2011-01-07 10:29 ` [PATCH 2/9] cpuidle: Rename X86 specific idle poll state[0] from C0 to POLL Thomas Renninger
2011-01-12  6:37   ` Len Brown
2011-01-07 10:29 ` [PATCH 3/9] X86/perf: fix power:cpu_idle double end events and throw cpu_idle events from the cpuidle layer Thomas Renninger
2011-01-12  6:42   ` Len Brown
2011-01-12 15:16     ` Thomas Renninger
2011-01-12 23:12       ` Len Brown
2011-01-07 10:29 ` [PATCH 4/9] cpuidle: Introduce .abbr (abbrevation) for cpuidle states Thomas Renninger
2011-01-07 21:23   ` Kevin Hilman
2011-01-12  6:56   ` Len Brown
2011-01-12 13:37     ` Thomas Renninger
2011-01-12 22:25       ` Len Brown
2011-01-12 23:39         ` Thomas Renninger
2011-01-13 15:42         ` Valdis.Kletnieks
2011-01-07 10:29 ` [PATCH 5/9] acpi: processor->cpuidle: Only set cpuidle check_bm flag if pr->flags.bm_check is set Thomas Renninger
2011-01-12  7:17   ` Len Brown
2011-01-12  7:30     ` [PATCH] ACPI: processor_idle: delete use of NOP CPUIDLE_FLAGs Len Brown
2011-01-12  7:37       ` [PATCH] cpuidle: delete NOP CPUIDLE_FLAG_POLL Len Brown
2011-01-12  8:00         ` [PATCH] SH, cpuidle: delete use of NOP CPUIDLE_FLAGS_SHALLOW Len Brown
2011-01-12  8:01           ` [PATCH] cpuidle: delete unused CPUIDLE_FLAG_SHALLOW, BALANCED, DEEP definitions Len Brown
2011-01-12  8:02           ` [PATCH] cpuidle: CPUIDLE_FLAG_TLB_FLUSHED is specific to intel_idle Len Brown
2011-01-12  8:04             ` [PATCH] cpuidle: CPUIDLE_FLAG_CHECK_BM is omap3_idle specific Len Brown
2011-01-07 10:29 ` [PATCH 6/9] perf (userspace): Fix variable clash with glibc time() func Thomas Renninger
2011-01-07 10:29 ` [PATCH 7/9] perf (userspace): Introduce --verbose param for perf timechart Thomas Renninger
2011-01-07 10:29 ` [PATCH 8/9] perf timechart: Map power:cpu_idle events to the corresponding cpuidle state Thomas Renninger
2011-01-07 10:52   ` Thomas Renninger
2011-01-07 10:29 ` [PATCH 9/9] perf: timechart: Fix memleak Thomas Renninger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LFD.2.02.1101071529100.20609@x980 \
    --to=lenb@kernel.org \
    --cc=arjan@linux.intel.com \
    --cc=j-pihet@ti.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=trenn@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).