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] [PATCH] Restore, comment, correct memory barriers in xen

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: Re: [Xen-devel] [PATCH] Restore, comment, correct memory barriers in xenstored.
From: David Hopwood <david.nospam.hopwood@xxxxxxxxxxxxxxxx>
Date: Fri, 14 Oct 2005 03:26:36 +0100
Delivery-date: Fri, 14 Oct 2005 02:23:57 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <1129131355.8218.89.camel@xxxxxxxxxxxxxxxxxxxxx>
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>
References: <1129131355.8218.89.camel@xxxxxxxxxxxxxxxxxxxxx>
Reply-to: david.nospam.hopwood@xxxxxxxxxxxxxxxx
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mozilla Thunderbird 1.0.6 (Windows/20050716)
Rusty Russell wrote:
>       Keir moved barriers,
>       Competence questions are raised:
>       Correctness withers.
> 
[...]
> +             /* Make sure we read header before we write data
> +              * (implied by data-dependency, but let's play safe). */
> +             mb();
> +
>               memcpy(dst, data, avail);
>               data += avail;
>               len -= avail;
> +
> +             /* Other side must not see new header until data is there. */
> +             wmb();
>               update_output_chunk(out, avail);

Perhaps the barriers were removed on the basis that they are not needed on
x86. But if so, that reasoning is incorrect, because memcpy might use SSE
string writes which have weaker memory ordering. See the P4 arch manual,
volume 3, section 7.2.3. The code also has to work on other platforms as
well, of course.

-- 
David Hopwood <david.nospam.hopwood@xxxxxxxxxxxxxxxx>


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

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