[lkml]   [2021]   [Feb]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH 7/7] xen/evtchn: read producer index only once

On 08/02/2021 10:59, Jürgen Groß wrote:
> On 08.02.21 11:51, Jan Beulich wrote:
> Yes, but I don't see an urgent need to fix that, as there would
> be thousands of accesses in the kernel needing a fix. A compiler
> tearing a naturally aligned access into multiple memory accesses
> would be rejected as buggy from the kernel community IMO.

I would not be so sure. From lwn [1]:

"In the Linux kernel, tearing of plain C-language loads has been
observed even given properly aligned and machine-word-sized loads.)"

And for store tearing:

"Note that this tearing can happen even on properly aligned and
machine-word-sized accesses, and in this particular case, even for
volatile stores. Some might argue that this behavior constitutes a bug
in the compiler, but either way it illustrates the perceived value of
store tearing from a compiler-writer viewpoint. [...] But for properly
aligned machine-sized stores, WRITE_ONCE() will prevent store tearing."



> Juergen

Julien Grall

 \ /
  Last update: 2021-02-08 13:14    [W:0.114 / U:0.840 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site