Re: [PATCH v5 17/18] READ_ONCE: Use data_race() to avoid KCSAN instrumentation

From: Will Deacon
Date: Tue May 12 2020 - 05:49:22 EST


On Tue, May 12, 2020 at 10:23:06AM +0200, Peter Zijlstra wrote:
> On Mon, May 11, 2020 at 09:41:49PM +0100, Will Deacon wrote:
>
> > + data_race(({ __WRITE_ONCE(*__xp, val); 0; })); \
>
> That had me blink for a little, I see how we got there, but urgh.

I tried for a while to see if data_race() could act differently if the
expression was type-compatible with 'void' and, while I got something that
mostly worked, it would fire unexpectedly in a few places where the
expression was most definitely not void (e.g. dereferencing a vma pointer)
so I gave up :(

> Anyway, it's all in *much* better shape now than it was, so no real
> copmlaints.

Thanks.

Will