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

[Xen-changelog] [xen-unstable] x86: Fix cache flush bug of cpu offline



# HG changeset patch
# User Liu, Jinsong <jinsong.liu@xxxxxxxxx>
# Date 1299863881 0
# Node ID 552c3059264e1a4c9cebf22277ae1232f59c863e
# Parent  6c5e68521f1dc5c55efd11f9d0a29a9f6666191e
x86: Fix cache flush bug of cpu offline

Current xen cpu offline logic flush cache too early, which potentially
break cache coherency.  wbinvd should be the last ops before cpu going
into dead, otherwise cache may be dirty, i.e, something like setting
an A bit on page tables. Pointed out by Arjan van de Ven.

Signed-off-by: Liu, Jinsong <jinsong.liu@xxxxxxxxx>
---


diff -r 6c5e68521f1d -r 552c3059264e xen/arch/x86/acpi/cpu_idle.c
--- a/xen/arch/x86/acpi/cpu_idle.c      Fri Mar 11 16:27:33 2011 +0000
+++ b/xen/arch/x86/acpi/cpu_idle.c      Fri Mar 11 17:18:01 2011 +0000
@@ -561,11 +561,14 @@
     if ( (cx = &power->states[power->count-1]) == NULL )
         goto default_halt;
 
+    /*
+     * cache must be flashed as the last ops before cpu going into dead,
+     * otherwise, cpu may dead with dirty data breaking cache coherency,
+     * leading to strange errors.
+     */
+    wbinvd();
     for ( ; ; )
     {
-        if ( !power->flags.bm_check && cx->type == ACPI_STATE_C3 )
-            ACPI_FLUSH_CPU_CACHE();
-
         switch ( cx->entry_method )
         {
             case ACPI_CSTATE_EM_FFH:
@@ -579,6 +582,7 @@
     }
 
 default_halt:
+    wbinvd();
     for ( ; ; )
         halt();
 }
diff -r 6c5e68521f1d -r 552c3059264e xen/arch/x86/domain.c
--- a/xen/arch/x86/domain.c     Fri Mar 11 16:27:33 2011 +0000
+++ b/xen/arch/x86/domain.c     Fri Mar 11 17:18:01 2011 +0000
@@ -93,6 +93,12 @@
 
 static void default_dead_idle(void)
 {
+    /*
+     * cache must be flashed as the last ops before cpu going into dead,
+     * otherwise, cpu may dead with dirty data breaking cache coherency,
+     * leading to strange errors.
+     */
+    wbinvd();
     for ( ; ; )
         halt();
 }
@@ -100,7 +106,6 @@
 static void play_dead(void)
 {
     local_irq_disable();
-    wbinvd();
 
     /*
      * NOTE: After cpu_exit_clear, per-cpu variables are no longer accessible,

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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