lkml.org 
[lkml]   [2014]   [Nov]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] arch: Introduce read_acquire()

On 11/12/2014 02:15 AM, Peter Zijlstra wrote:
> On Tue, Nov 11, 2014 at 01:12:32PM -0800, Alexander Duyck wrote:
>>> Minor nit on naming, but load_acquire would match what we do with barriers,
>>> where you simply drop the smp_ prefix if you want the thing to work on UP
>>> systems too.
>> The problem is this is slightly different, load_acquire in my mind would use
>> a mb() call, I only use a rmb(). That is why I chose read_acquire as the
>> name.
> acquire is not about rmb vs mb, do read up on
> Documentation/memory-barriers.txt. Its a distinctly different semantic.
> Some archs simply lack the means of implementing this semantics and have
> to revert to mb (stronger is always allowed).
>
> Using the read vs load to wreck the acquire semantics is just insane.

Actually I have been reading up on it as I wasn't familiar with C11.
Most of what I was doing was actually based on the documentation in
barriers.txt which was referring to memory operations not loads/stores
when referring to the acquire/release so I assumed the full memory
barrier was required. I wasn't aware that smp_load_acquire was only
supposed to be ordering loads, or that smp_ store_release only applied
to stores.I will probably go back and re-implement this patch as
introducing load_acquire and add store_release as well. I figure it is
possible that a device could be doing something like reading a linked
list in memory ("Example combining sync and lwsync"
http://www.ibm.com/developerworks/systems/articles/powerpc.html#N102B1)
and then you would need both the store_release and the wmb() to deal
with system memory vs system memory ordering, and system memory vs MMIO.

Base drivers have been doing this kind of stuff for a while. The
problem is we have been doing it using barriers that are heavier than
they need to be. For example the reason why I am wanting to shift to
using something like an acquire operation is because the current barrier
we have been using, rmb(), is far heavier than we need for system memory
vs system memory ordering on systems such as PowerPC. What I am looking
for with the load_acquire/store_release is to allow for the use of
lighter weight barriers for updates that only affect system memory.

Thanks,

Alex




\
 
 \ /
  Last update: 2014-11-12 17:01    [W:0.060 / U:10.420 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site