On Tue, Nov 25, 2014 at 2:19 AM, Taylor R Campbell
<campbell+netbsd-tech-k...@mumble.net> wrote:
>    Date: Mon, 24 Nov 2014 16:44:41 +0000 (UTC)
>    From: Eduardo Horvath <e...@netbsd.org>
>
>    I enhanced membar_ops with proper memory barriers and then was looking at
>    the mutex code.  Unfortunately, I didn't get very far.  It seemed at the
>    time that the mutex code has two hooks for memory barriers after the
>    atomic operations, however it's missing memory barrier hooks to ensure
>    consistency before accessing the lock.
>
> What exactly is the consistency you need before accessing the lock?

Besides that, other necessary memory barriers I have figured out:

- cpu_simple_lock
  - lock/unlock should ensure membar_enter/membar_exit equivalent
- mutex
  - spin
    - enter/exit should ensure membar_enter/membar_exit equivalent
  - adaptive
    - Provide MUTEX_RECEIVE, MUTEX_GIVE -> membar_enter, membar_exit
- rw
  - enter/exit should ensure membar_enter/membar_exit equivalent
- membar_ops
  - Implement these
- Other synchronization
  - Relies on membar_ops, should work if membar_ops is done right

I'd start with using full-sync everywhere and see what happens.

Reply via email to