All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* evtchn_do_upcall() barrier between upcall_pending and pending_sel
@ 2008-05-08 10:18 Samuel Thibault
  2008-05-08 10:25 ` Keir Fraser
  0 siblings, 1 reply; 3+ messages in thread
From: Samuel Thibault @ 2008-05-08 10:18 UTC (permalink / raw
  To: xen-devel

Hello,

In evtchn_do_upcall() there is a barrier between setting upcall_pending
and pending_sel, which makes sense to avoid losing events, however I
don't understand why it is a rmb(). memory-barriers.txt says that rmb()
only provides ordering of reads, not stores.  Shouldn't that be a wmb()
instead then?

Samuel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: evtchn_do_upcall() barrier between upcall_pending and pending_sel
  2008-05-08 10:18 evtchn_do_upcall() barrier between upcall_pending and pending_sel Samuel Thibault
@ 2008-05-08 10:25 ` Keir Fraser
  2008-05-08 10:34   ` Samuel Thibault
  0 siblings, 1 reply; 3+ messages in thread
From: Keir Fraser @ 2008-05-08 10:25 UTC (permalink / raw
  To: Samuel Thibault, xen-devel

Makes sense, yes.

 -- Keir

On 8/5/08 11:18, "Samuel Thibault" <samuel.thibault@eu.citrix.com> wrote:

> Hello,
> 
> In evtchn_do_upcall() there is a barrier between setting upcall_pending
> and pending_sel, which makes sense to avoid losing events, however I
> don't understand why it is a rmb(). memory-barriers.txt says that rmb()
> only provides ordering of reads, not stores.  Shouldn't that be a wmb()
> instead then?
> 
> Samuel
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: evtchn_do_upcall() barrier between upcall_pending and pending_sel
  2008-05-08 10:25 ` Keir Fraser
@ 2008-05-08 10:34   ` Samuel Thibault
  0 siblings, 0 replies; 3+ messages in thread
From: Samuel Thibault @ 2008-05-08 10:34 UTC (permalink / raw
  To: Keir Fraser; +Cc: xen-devel

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@eu.citrix.com>

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@eu.citrix.com>

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 )
     {

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-05-08 10:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-08 10:18 evtchn_do_upcall() barrier between upcall_pending and pending_sel Samuel Thibault
2008-05-08 10:25 ` Keir Fraser
2008-05-08 10:34   ` Samuel Thibault

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.