WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH 1/4] x86/HPET: fix initialization order

To: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH 1/4] x86/HPET: fix initialization order
From: "Jan Beulich" <JBeulich@xxxxxxxxxx>
Date: Fri, 11 Mar 2011 15:33:26 +0000
Cc: Gang Wei <gang.wei@xxxxxxxxx>
Delivery-date: Fri, 11 Mar 2011 07:33:03 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
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>

--- 2011-03-09.orig/xen/arch/x86/hpet.c
+++ 2011-03-09/xen/arch/x86/hpet.c
@@ -597,9 +597,10 @@ void hpet_broadcast_init(void)
                                          1000000000ul, 32);
             hpet_events[i].shift = 32;
             hpet_events[i].next_event = STIME_MAX;
-            hpet_events[i].event_handler = handle_hpet_broadcast;
             spin_lock_init(&hpet_events[i].lock);
             rwlock_init(&hpet_events[i].cpumask_lock);
+            wmb();
+            hpet_events[i].event_handler = handle_hpet_broadcast;
         }
 
         return;
@@ -630,11 +631,12 @@ void hpet_broadcast_init(void)
     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);
     rwlock_init(&legacy_hpet_event.cpumask_lock);
+    wmb();
+    legacy_hpet_event.event_handler = handle_hpet_broadcast;
 
     if ( !force_hpet_broadcast )
         pv_rtc_handler = handle_rtc_once;



Attachment: x86-hpet-init.patch
Description: Text document

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>