From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Ross Lagerwall <ross.lagerwall@citrix.com>
Cc: Keir Fraser <keir@xen.org>,
Ian Campbell <ian.campbell@citrix.com>,
Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
Liu Jinsong <jinsong.liu@alibaba-inc.com>,
Ian Jackson <ian.jackson@eu.citrix.com>,
xen-devel@lists.xen.org, Jan Beulich <jbeulich@suse.com>
Subject: Re: [PATCH 2/4] x86/mwait_idle: Allow limiting the sub C-state
Date: Wed, 18 Jun 2014 16:23:39 +0100 [thread overview]
Message-ID: <53A1AEFB.5080602@citrix.com> (raw)
In-Reply-To: <1403103855-23080-3-git-send-email-ross.lagerwall@citrix.com>
On 18/06/14 16:04, Ross Lagerwall wrote:
> Allow limiting the sub C-state using a new command-line parameter, max_substate.
> The limit only applies to the highest legal C-state. For example:
> max_cstate = 1, max_substate = 0 ==> C0, C1 okay, but not C1E
> max_cstate = 1, max_substate = 1 ==> C0, C1 and C1E okay, but not C2
> max_cstate = 2, max_substate = 0 ==> C0, C1, C1E, C2 okay, but not C3
> max_cstate = 2, max_substate = 1 ==> C0, C1, C1E, C2 okay, but not C3
>
> Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
At the very least, please patch docs/misc/xen-command-line.markdown
However, the name "max_substate" is far too generic on its own.
"max_csubstate" would be better, but still not as easily identifiable on
its own as "max_cstate".
> ---
> xen/arch/x86/acpi/cpu_idle.c | 3 +++
> xen/arch/x86/cpu/mwait-idle.c | 4 +++-
> xen/include/xen/acpi.h | 2 ++
> 3 files changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/xen/arch/x86/acpi/cpu_idle.c b/xen/arch/x86/acpi/cpu_idle.c
> index b05fb39..96909b3 100644
> --- a/xen/arch/x86/acpi/cpu_idle.c
> +++ b/xen/arch/x86/acpi/cpu_idle.c
> @@ -106,6 +106,8 @@ static uint64_t (*__read_mostly tick_to_ns)(uint64_t) = acpi_pm_tick_to_ns;
> void (*__read_mostly pm_idle_save)(void);
> unsigned int max_cstate __read_mostly = ACPI_PROCESSOR_MAX_POWER - 1;
> integer_param("max_cstate", max_cstate);
> +unsigned int max_substate __read_mostly = ACPI_PROCESSOR_MAX_POWER - 1;
> +integer_param("max_substate", max_substate);
> static bool_t __read_mostly local_apic_timer_c2_ok;
> boolean_param("lapic_timer_c2_ok", local_apic_timer_c2_ok);
>
> @@ -240,6 +242,7 @@ static void print_acpi_power(uint32_t cpu, struct acpi_processor_power *power)
> last_state_idx = power->last_state ? power->last_state->idx : -1;
> printk("active state:\t\tC%d\n", last_state_idx);
> printk("max_cstate:\t\tC%d\n", max_cstate);
> + printk("max_substate:\t\t%d\n", max_substate);
%u
The preceding line is also wrong with its formatting parameter.
> printk("states:\n");
>
> for ( i = 1; i < power->count; i++ )
> diff --git a/xen/arch/x86/cpu/mwait-idle.c b/xen/arch/x86/cpu/mwait-idle.c
> index 38172e5..90c8aea 100644
> --- a/xen/arch/x86/cpu/mwait-idle.c
> +++ b/xen/arch/x86/cpu/mwait-idle.c
> @@ -330,7 +330,9 @@ static void mwait_idle(void)
> (next_state = cpuidle_current_governor->select(power)) > 0) {
> do {
> cx = &power->states[next_state];
> - } while (cx->type > max_cstate && --next_state);
> + } while ((cx->type > max_cstate || (cx->type == max_cstate &&
> + MWAIT_HINT2SUBSTATE(cx->address) > max_substate)) &&
> + --next_state);
> if (!next_state)
> cx = NULL;
> menu_get_trace_data(&exp, &pred);
> diff --git a/xen/include/xen/acpi.h b/xen/include/xen/acpi.h
> index aedec65..b49c4fc 100644
> --- a/xen/include/xen/acpi.h
> +++ b/xen/include/xen/acpi.h
> @@ -140,6 +140,8 @@ static inline void acpi_set_cstate_limit(unsigned int new_limit)
> max_cstate = new_limit;
> return;
> }
> +
> +extern unsigned int max_substate;
This should live next to the extern for max_cstate.
~Andrew
> #else
> static inline unsigned int acpi_get_cstate_limit(void) { return 0; }
> static inline void acpi_set_cstate_limit(unsigned int new_limit) { return; }
next prev parent reply other threads:[~2014-06-18 15:23 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-18 15:04 [PATCH 0/4] Support controlling the maximum sub C-State Ross Lagerwall
2014-06-18 15:04 ` [PATCH 1/4] x86/mwait_idle: Fix trace output Ross Lagerwall
2014-06-18 15:04 ` [PATCH 2/4] x86/mwait_idle: Allow limiting the sub C-state Ross Lagerwall
2014-06-18 15:23 ` Andrew Cooper [this message]
2014-06-18 15:51 ` Jan Beulich
2014-06-18 15:04 ` [PATCH 3/4] tools/libxc: Alow getting and setting the max sub C-State Ross Lagerwall
2014-06-18 15:16 ` Andrew Cooper
2014-06-18 16:00 ` Jan Beulich
2014-06-18 15:04 ` [PATCH 4/4] xenpm: " Ross Lagerwall
2014-06-18 15:28 ` Andrew Cooper
2014-06-18 15:16 ` [PATCH 0/4] Support controlling the maximum " Konrad Rzeszutek Wilk
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=53A1AEFB.5080602@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=ian.campbell@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=jbeulich@suse.com \
--cc=jinsong.liu@alibaba-inc.com \
--cc=keir@xen.org \
--cc=ross.lagerwall@citrix.com \
--cc=stefano.stabellini@eu.citrix.com \
--cc=xen-devel@lists.xen.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.