Skip to contentSkip to conversation

x86/cpuidle: restrict scope of mwait_ptr in acpi_dead_idle()

PATCH In review Jan Beulich 2 participants 2 messages Mar 6, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/cpuidle: restrict scope of mwait_ptr in acpi_dead_idle()

... just to make sure it doesn't get used improperly (resulting from the discussion around what became c/s 24968:8964c223836c).

xen/arch/x86/acpi/cpu_idle.c +2 -3
@@ -565,7 +565,6 @@ static void acpi_dead_idle(void)
 {
     struct acpi_processor_power *power;
     struct acpi_processor_cx *cx;
-    void *mwait_ptr;
 
     if ( (power = processor_powers[smp_processor_id()]) == NULL )
         goto default_halt;
@@ -573,10 +572,10 @@ static void acpi_dead_idle(void)
     if ( (cx = &power->states[power->count-1]) == NULL )
         goto default_halt;
 
-    mwait_ptr = (void *)&mwait_wakeup(smp_processor_id());
-
     if ( cx->entry_method == ACPI_CSTATE_EM_FFH )
     {
+        void *mwait_ptr = &mwait_wakeup(smp_processor_id());
+
         /*
          * Cache must be flushed as the last operation before sleeping.
          * Otherwise, CPU may still hold dirty data, breaking cache coherency,

x86/cpuidle: restrict scope of mwait_ptr in acpi_dead_idle()

... just to make sure it doesn't get used improperly (resulting from the discussion around what became c/s 24968:8964c223836c).

xen/arch/x86/acpi/cpu_idle.c +2 -3
@@ -565,7 +565,6 @@ static void acpi_dead_idle(void)
 {
     struct acpi_processor_power *power;
     struct acpi_processor_cx *cx;
-    void *mwait_ptr;
 
     if ( (power = processor_powers[smp_processor_id()]) == NULL )
         goto default_halt;
@@ -573,10 +572,10 @@ static void acpi_dead_idle(void)
     if ( (cx = &power->states[power->count-1]) == NULL )
         goto default_halt;
 
-    mwait_ptr = (void *)&mwait_wakeup(smp_processor_id());
-
     if ( cx->entry_method == ACPI_CSTATE_EM_FFH )
     {
+        void *mwait_ptr = &mwait_wakeup(smp_processor_id());
+
         /*
          * Cache must be flushed as the last operation before sleeping.
          * Otherwise, CPU may still hold dirty data, breaking cache coherency,

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

Acked-by on v1 1/1
#1 lore raw
Quoted 4 lines · Jan Beulich

... just to make sure it doesn't get used improperly (resulting from the discussion around what became c/s 24968:8964c223836c).

Quoted 31 lines
xen/arch/x86/acpi/cpu_idle.c +2 -3
@@ -565,7 +565,6 @@ static void acpi_dead_idle(void)
 {
     struct acpi_processor_power *power;
     struct acpi_processor_cx *cx;
-    void *mwait_ptr;
 
     if ( (power = processor_powers[smp_processor_id()]) == NULL )
         goto default_halt;
@@ -573,10 +572,10 @@ static void acpi_dead_idle(void)
     if ( (cx = &power->states[power->count-1]) == NULL )
         goto default_halt;
 
-    mwait_ptr = (void *)&mwait_wakeup(smp_processor_id());
-
     if ( cx->entry_method == ACPI_CSTATE_EM_FFH )
     {
+        void *mwait_ptr = &mwait_wakeup(smp_processor_id());
+
         /*
          * Cache must be flushed as the last operation before sleeping.
          * Otherwise, CPU may still hold dirty data, breaking cache

coherency,

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel