lkml.org 
[lkml]   [2018]   [Jul]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/2] tools/memory-model: Add write ordering by release-acquire and by locks
On Thu, 5 Jul 2018, Andrea Parri wrote:

> > At any rate, it looks like instead of strengthening the relation, I
> > should write a patch that removes it entirely. I also will add new,
> > stronger relations for use with locking, essentially making spin_lock
> > and spin_unlock be RCsc.
>
> Thank you.
>
> Ah let me put this forward: please keep an eye on the (generic)
>
> queued_spin_lock()
> queued_spin_unlock()
>
> (just to point out an example). Their implementation (in part.,
> the fast-path) suggests that if we will stick to RCsc lock then
> we should also stick to RCsc acq. load from RMW and rel. store.

A very good point. The implementation of those routines uses
atomic_cmpxchg_acquire() to acquire the lock. Unless this is
implemented with an operation or fence that provides write-write
ordering (in conjunction with a suitable release), qspinlocks won't
have the ordering properties that we want.

I'm going to assume that the release operations used for unlocking
don't need to have any extra properties; only the lock-acquire
operations need to be special (i.e., stronger than a normal
smp_load_acquire). This suggests that atomic RMW functions with acquire
semantics should also use this stronger form of acquire.

Does anybody have a different suggestion?

Alan

\
 
 \ /
  Last update: 2018-07-06 22:38    [W:0.147 / U:0.972 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site