From b933f57e634ee27b25d8e69dea887b734f64770c Mon Sep 17 00:00:00 2001 From: Jan Beulich Date: Sat, 12 Mar 2011 13:28:05 +0000 Subject: [PATCH] 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 Acked-by: Wei Gang xen-unstable changeset: 23030:87aa1277eae0 xen-unstable date: Sat Mar 12 13:19:02 2011 +0000 --- xen/arch/x86/hpet.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/hpet.c b/xen/arch/x86/hpet.c index 0e099de8e..c47b52703 100644 --- a/xen/arch/x86/hpet.c +++ b/xen/arch/x86/hpet.c @@ -567,8 +567,9 @@ 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); + wmb(); + hpet_events[i].event_handler = handle_hpet_broadcast; } if ( num_hpets_used < num_possible_cpus() ) @@ -605,10 +606,11 @@ 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); + wmb(); + legacy_hpet_event.event_handler = handle_hpet_broadcast; for_each_possible_cpu(i) per_cpu(cpu_bc_channel, i) = &legacy_hpet_event; -- 2.39.5