[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8092b8aa-bb1c-0266-b308-5cebfb25e2ef@zytor.com>
Date: Fri, 29 Mar 2019 14:51:26 -0700
From: "H. Peter Anvin" <hpa@...or.com>
To: paulmck@...ux.ibm.com
Cc: Alexander Potapenko <glider@...gle.com>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...nel.org>,
LKML <linux-kernel@...r.kernel.org>,
Dmitriy Vyukov <dvyukov@...gle.com>,
James Y Knight <jyknight@...gle.com>
Subject: Re: Potentially missing "memory" clobbers in bitops.h for x86
On 3/29/19 2:09 PM, Paul E. McKenney wrote:
>>
>> Note: the atomic versions of these functions obviously need to have
>> "volatile" and the clobber anyway, as they are by definition barriers
>> and moving memory operations around them would be a very serious error.
>
> The atomic functions that return void don't need to order anything except
> the input and output arguments. The oddness with clear_bit() is that the
> memory changed isn't necessarily the quantity referenced by the argument,
> if the number of bits specified is large.
>
> So (for example) atomic_inc() does not need a "memory" clobber, right?
>
I don't believe that is true: the code calling it has a reasonable
expectation that previous memory operations have finished and later
memory operations have not started from the point of view of another
processor. You are more of an expert on memory ordering than I am, but
I'm 89% sure that there is plenty of code in the kernel which makes that
assumption.
-hpa
Powered by blists - more mailing lists