x86/cpuidle: publish new states only after fully initializing them
PATCH 1/1 x86/cpuidle: publish new states only after fully initializing them
Since state information coming from Dom0 can arrive at any time, on any CPU, we ought to make sure that a new state is fully initialized before the target CPU might be using it.
Once touching that code, also do minor cleanup: A missing (but benign) "break" and some white space adjustments.
xen/arch/x86/acpi/cpu_idle.c +6 -3
@@ -912,7 +912,7 @@ static void set_cx( acpi_power->cpu, xen_cx->type);return ; } - cx = &acpi_power->states[acpi_power->count++]; + cx = &acpi_power->states[acpi_power->count]; cx->type = xen_cx->type;break ; }
@@ -937,11 +937,14 @@ static void set_cx(break ;default : cx->entry_method =ACPI_CSTATE_EM_NONE ; +break ; } - cx->latency = xen_cx->latency; - + cx->latency = xen_cx->latency; cx->target_residency = cx->latency * latency_factor; + +smp_wmb (); + acpi_power->count++;if ( cx->type ==ACPI_STATE_C1 || cx->type ==ACPI_STATE_C2 ) acpi_power->safe_state = cx; }
x86/cpuidle: publish new states only after fully initializing them
Since state information coming from Dom0 can arrive at any time, on any CPU, we ought to make sure that a new state is fully initialized before the target CPU might be using it.
Once touching that code, also do minor cleanup: A missing (but benign) "break" and some white space adjustments.
xen/arch/x86/acpi/cpu_idle.c +6 -3
@@ -912,7 +912,7 @@ static void set_cx( acpi_power->cpu, xen_cx->type);return ; } - cx = &acpi_power->states[acpi_power->count++]; + cx = &acpi_power->states[acpi_power->count]; cx->type = xen_cx->type;break ; }
@@ -937,11 +937,14 @@ static void set_cx(break ;default : cx->entry_method =ACPI_CSTATE_EM_NONE ; +break ; } - cx->latency = xen_cx->latency; - + cx->latency = xen_cx->latency; cx->target_residency = cx->latency * latency_factor; + +smp_wmb (); + acpi_power->count++;if ( cx->type ==ACPI_STATE_C1 || cx->type ==ACPI_STATE_C2 ) acpi_power->safe_state = cx; }
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 8 lines · Jan Beulich
Since state information coming from Dom0 can arrive at any time, on any CPU, we ought to make sure that a new state is fully initialized before the target CPU might be using it.
Once touching that code, also do minor cleanup: A missing (but benign) "break" and some white space adjustments.
Signed-off-by Jan Beulich <[email protected]>
Quoted 34 lines
xen/arch/x86/acpi/cpu_idle.c +6
-3@@ -912,7 +912,7 @@ static void set_cx( acpi_power->cpu, xen_cx->type);return ; } - cx = &acpi_power->states[acpi_power->count++]; + cx = &acpi_power->states[acpi_power->count]; cx->type = xen_cx->type;break ; }@@ -937,11 +937,14 @@ static void set_cx(break ;default : cx->entry_method =ACPI_CSTATE_EM_NONE ; +break ; } - cx->latency = xen_cx->latency; - + cx->latency = xen_cx->latency; cx->target_residency = cx->latency * latency_factor; + +smp_wmb (); + acpi_power->count++;if ( cx->type ==ACPI_STATE_C1 || cx->type ==ACPI_STATE_C2 ) acpi_power->safe_state = cx; }
Quoted 4 lines
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 9 lines · Jan Beulich
Since state information coming from Dom0 can arrive at any time, on any CPU, we ought to make sure that a new state is fully initialized before the target CPU might be using it.
Once touching that code, also do minor cleanup: A missing (but benign) "break" and some white space adjustments.
Signed-off-by Jan Beulich <[email protected]>