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

Re: [Xen-devel] evtchn_do_upcall() barrier between upcall_pending and pe

To: Keir Fraser <keir.fraser@xxxxxxxxxxxxx>
Subject: Re: [Xen-devel] evtchn_do_upcall() barrier between upcall_pending and pending_sel
From: Samuel Thibault <samuel.thibault@xxxxxxxxxxxxx>
Date: Thu, 8 May 2008 11:34:30 +0100
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Thu, 08 May 2008 03:34:55 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <C44893C7.2067B%keir.fraser@xxxxxxxxxxxxx>
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/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Mail-followup-to: Samuel Thibault <samuel.thibault@xxxxxxxxxxxxx>, Keir Fraser <keir.fraser@xxxxxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxx
References: <20080508101829.GC4365@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> <C44893C7.2067B%keir.fraser@xxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.12-2006-07-14
Keir Fraser, le Thu 08 May 2008 11:25:59 +0100, a écrit :
> Makes sense, yes.

Here are fixes then.



evtchn: Use wmb instead of rmb to enforce ordering between
evtchn_upcall_pending and evtchn_pending_sel stores.
 
Signed-off-by: Samuel Thibault <samuel.thibault@xxxxxxxxxxxxx>

diff -r e39cf97647af drivers/xen/core/evtchn.c
--- a/drivers/xen/core/evtchn.c Mon May 05 10:17:41 2008 +0100
+++ b/drivers/xen/core/evtchn.c Thu May 08 11:33:59 2008 +0100
@@ -246,7 +246,7 @@ asmlinkage void evtchn_do_upcall(struct 
 
 #ifndef CONFIG_X86 /* No need for a barrier -- XCHG is a barrier on x86. */
                /* Clear master flag /before/ clearing selector flag. */
-               rmb();
+               wmb();
 #endif
                l1 = xchg(&vcpu_info->evtchn_pending_sel, 0);
 


minios: in non-x86 case, use wmb to enforce ordering between
evtchn_upcall_pending and evtchn_pending_sel stores.

Signed-off-by: Samuel Thibault <samuel.thibault@xxxxxxxxxxxxx>

diff -r 4965e711fee8 extras/mini-os/hypervisor.c
--- a/extras/mini-os/hypervisor.c       Wed May 07 15:36:32 2008 +0100
+++ b/extras/mini-os/hypervisor.c       Thu May 08 11:31:35 2008 +0100
@@ -46,7 +46,11 @@ void do_hypervisor_callback(struct pt_re
     in_callback = 1;
    
     vcpu_info->evtchn_upcall_pending = 0;
-    /* NB. No need for a barrier here -- XCHG is a barrier on x86. */
+    /* NB x86. No need for a barrier here -- XCHG is a barrier on x86. */
+#if !defined(__i386__) && !defined(__x86_64__)
+    /* clear master flag /before/ clearing selector flag. */
+    wmb();
+#endif
     l1 = xchg(&vcpu_info->evtchn_pending_sel, 0);
     while ( l1 != 0 )
     {

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

<Prev in Thread] Current Thread [Next in Thread>