[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] Restore, comment, correct memory barriers in xenstored.



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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.