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] add memory barriers to IPI related code

To: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel][PATCH] add memory barriers to IPI related code
From: Dave Winchell <dwinchell@xxxxxxxxxxxxxxx>
Date: Thu, 23 Oct 2008 14:23:13 -0400
Cc: "dan.magenheimer@xxxxxxxxxx" <dan.magenheimer@xxxxxxxxxx>, Dave Winchell <dwinchell@xxxxxxxxxxxxxxx>, "Langsdorf, Mark" <mark.langsdorf@xxxxxxx>, Keir Fraser <keir.fraser@xxxxxxxxxxxxx>
Delivery-date: Thu, 23 Oct 2008 11:12:06 -0700
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
User-agent: Mozilla Thunderbird 1.0.7-1.1.fc4 (X11/20050929)
Hi Keir,

We have been seeing some hangs in call function and
tlb shootdown. In our case the machine was an Intel Tylersburg.

One failure mode is this early return in smp_call_function_interrupt:

    if ( !cpu_isset(smp_processor_id(), call_data->selected) )
        return;

Without a mb(), the target processor takes this path as it doesn't yet see the update to call_data->selected from the initiating processor. Then the initiator waits for ever
to get an acknowledgment from this processor.

On the initiating side, I added the mb()'s to the send_IPI functions, x2apic already
having one.

On the target side, I added the mb()'s in the individual target functions.

Regards,
Dave

diff -r 4129f0f2f2ba xen/arch/x86/smp.c
--- a/xen/arch/x86/smp.c        Fri Oct 17 14:15:37 2008 +0100
+++ b/xen/arch/x86/smp.c        Mon Oct 20 10:53:24 2008 -0400
@@ -93,6 +93,8 @@ void send_IPI_mask_flat(cpumask_t cpumas
     /* An IPI with no target generates a send accept error from P5/P6 APICs. */
     WARN_ON(mask == 0);
 
+    mb();
+
     local_irq_save(flags);
 
     /*
@@ -123,6 +125,8 @@ void send_IPI_mask_phys(cpumask_t mask, 
 {
     unsigned long cfg, flags;
     unsigned int query_cpu;
+
+    mb();
 
     local_irq_save(flags);
 
@@ -160,6 +164,7 @@ static unsigned int flush_flags;
 
 fastcall void smp_invalidate_interrupt(void)
 {
+    mb();
     ack_APIC_irq();
     perfc_incr(ipis);
     irq_enter();
@@ -337,17 +342,22 @@ void smp_send_stop(void)
 
 fastcall void smp_event_check_interrupt(struct cpu_user_regs *regs)
 {
+    mb();
     ack_APIC_irq();
     perfc_incr(ipis);
 }
 
 fastcall void smp_call_function_interrupt(struct cpu_user_regs *regs)
 {
-    void (*func)(void *info) = call_data->func;
-    void *info = call_data->info;
-
+    void (*func)(void *info);
+    void *info;
+
+    mb();
     ack_APIC_irq();
     perfc_incr(ipis);
+
+    func = call_data->func;
+    info = call_data->info;
 
     if ( !cpu_isset(smp_processor_id(), call_data->selected) )
         return;
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>