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-changelog

[Xen-changelog] [xen-unstable] xenbus: Clarify and simplify barrier usag

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] xenbus: Clarify and simplify barrier usage.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 16 Mar 2007 07:40:15 -0700
Delivery-date: Fri, 16 Mar 2007 07:39:02 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Date 1174041745 0
# Node ID 422a61ebac541a40d60eee66e5ddf87d4855201e
# Parent  26a1378d5eced58122ca0f499c23b6697d94e4aa
xenbus: Clarify and simplify barrier usage.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.c |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diff -r 26a1378d5ece -r 422a61ebac54 
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.c
--- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.c    Fri Mar 16 
10:24:56 2007 +0000
+++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.c    Fri Mar 16 
10:42:25 2007 +0000
@@ -110,7 +110,6 @@ int xb_write(const void *data, unsigned 
                /* Read indexes, then verify. */
                cons = intf->req_cons;
                prod = intf->req_prod;
-               mb();
                if (!check_indexes(cons, prod)) {
                        intf->req_cons = intf->req_prod = 0;
                        return -EIO;
@@ -122,15 +121,18 @@ int xb_write(const void *data, unsigned 
                if (avail > len)
                        avail = len;
 
+               /* Must write data /after/ reading the consumer index. */
+               mb();
+
                memcpy(dst, data, avail);
                data += avail;
                len -= avail;
 
-               /* Other side must not see new header until data is there. */
+               /* Other side must not see new producer until data is there. */
                wmb();
                intf->req_prod += avail;
 
-               /* This implies mb() before other side sees interrupt. */
+               /* Implies mb(): other side will see the updated producer. */
                notify_remote_via_evtchn(xen_store_evtchn);
        }
 
@@ -165,7 +167,6 @@ int xb_read(void *data, unsigned len)
                /* Read indexes, then verify. */
                cons = intf->rsp_cons;
                prod = intf->rsp_prod;
-               mb();
                if (!check_indexes(cons, prod)) {
                        intf->rsp_cons = intf->rsp_prod = 0;
                        return -EIO;
@@ -177,7 +178,7 @@ int xb_read(void *data, unsigned len)
                if (avail > len)
                        avail = len;
 
-               /* We must read header before we read data. */
+               /* Must read data /after/ reading the producer index. */
                rmb();
 
                memcpy(data, src, avail);
@@ -190,7 +191,7 @@ int xb_read(void *data, unsigned len)
 
                pr_debug("Finished read of %i bytes (%i to go)\n", avail, len);
 
-               /* Implies mb(): they will see new header. */
+               /* Implies mb(): other side will see the updated consumer. */
                notify_remote_via_evtchn(xen_store_evtchn);
        }
 

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] xenbus: Clarify and simplify barrier usage., Xen patchbot-unstable <=