[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH] x86/mwait_idle: Allow setting the max cstate to C1



From: Ross Lagerwall <rosslagerwall@xxxxxxxxxx>

Following 91413b519631 ("x86/mwait_idle: export both C1 and C1E"), when
setting the max cstate to C1, the C1E cstate is used as well. This is
because MWAIT_HINT2CSTATE returns the same value for C1 and C1E.
Instead, when limiting the cstate, compare max_cstate with the position
in the states array, as the acpi cpu_idle driver does.

Without this patch, there's no way of setting the max cstate to C1 when using
the mwait_idle driver.

Signed-off-by: Ross Lagerwall <rosslagerwall@xxxxxxxxxx>
---
 xen/arch/x86/cpu/mwait-idle.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/xen/arch/x86/cpu/mwait-idle.c b/xen/arch/x86/cpu/mwait-idle.c
index 72a7abf..e4cfc16 100644
--- a/xen/arch/x86/cpu/mwait-idle.c
+++ b/xen/arch/x86/cpu/mwait-idle.c
@@ -328,11 +328,9 @@ static void mwait_idle(void)
 
        if (max_cstate > 0 && power && !sched_has_urgent_vcpu() &&
            (next_state = cpuidle_current_governor->select(power)) > 0) {
-               do {
-                       cx = &power->states[next_state];
-               } while (cx->type > max_cstate && --next_state);
-               if (!next_state)
-                       cx = NULL;
+               cx = &power->states[next_state];
+               if (cx->idx > max_cstate)
+                       cx = &power->states[max_cstate];
                menu_get_trace_data(&exp, &pred);
        }
        if (!cx) {
@@ -585,6 +583,7 @@ static int mwait_idle_cpu_init(struct notifier_block *nfb,
                        setup_clear_cpu_cap(X86_FEATURE_TSC_RELIABLE);
 
                cx = dev->states + dev->count;
+               cx->idx = dev->count;
                cx->type = state;
                cx->address = hint;
                cx->entry_method = ACPI_CSTATE_EM_FFH;
-- 
1.9.3


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.