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

[Xen-changelog] [xen-4.0-testing] x86/HPET: fix initialization order



# HG changeset patch
# User Jan Beulich <jbeulich@xxxxxxxxxx>
# Date 1299936485 0
# Node ID f637d2ec63b354300deb13a7daff895bef64d4f9
# Parent  7ddf29d515fbe339a236d76ca4328e3f3b8c9b8b
x86/HPET: fix initialization order

At least the legacy path can enter its interrupt handler callout while
initialization is still in progress - that handler checks whether
->event_handler is non-NULL, and hence all other initialization must
happen before setting this field.

Do the same to the MSI initialization just in case (and to keep the
code in sync).

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>
Acked-by: Wei Gang <gang.wei@xxxxxxxxx>
xen-unstable changeset:   23030:87aa1277eae0
xen-unstable date:        Sat Mar 12 13:19:02 2011 +0000
---


diff -r 7ddf29d515fb -r f637d2ec63b3 xen/arch/x86/hpet.c
--- a/xen/arch/x86/hpet.c       Thu Mar 10 18:39:48 2011 +0000
+++ b/xen/arch/x86/hpet.c       Sat Mar 12 13:28:05 2011 +0000
@@ -567,8 +567,9 @@
                                          1000000000ul, 32);
             hpet_events[i].shift = 32;
             hpet_events[i].next_event = STIME_MAX;
+            spin_lock_init(&hpet_events[i].lock);
+            wmb();
             hpet_events[i].event_handler = handle_hpet_broadcast;
-            spin_lock_init(&hpet_events[i].lock);
         }
 
         if ( num_hpets_used < num_possible_cpus() )
@@ -605,10 +606,11 @@
     legacy_hpet_event.mult = div_sc((unsigned long)hpet_rate, 1000000000ul, 
32);
     legacy_hpet_event.shift = 32;
     legacy_hpet_event.next_event = STIME_MAX;
-    legacy_hpet_event.event_handler = handle_hpet_broadcast;
     legacy_hpet_event.idx = 0;
     legacy_hpet_event.flags = 0;
     spin_lock_init(&legacy_hpet_event.lock);
+    wmb();
+    legacy_hpet_event.event_handler = handle_hpet_broadcast;
 
     for_each_possible_cpu(i)
         per_cpu(cpu_bc_channel, i) = &legacy_hpet_event;

_______________________________________________
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®.