[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87ef7n7x9v.fsf@concordia.ellerman.id.au>
Date: Mon, 04 Mar 2019 21:24:12 +1100
From: Michael Ellerman <mpe@...erman.id.au>
To: Nicholas Piggin <npiggin@...il.com>, linux-arch@...r.kernel.org,
Will Deacon <will.deacon@....com>
Cc: Andrea Parri <andrea.parri@...rulasolutions.com>,
Arnd Bergmann <arnd@...db.de>,
Benjamin Herrenschmidt <benh@...nel.crashing.org>,
Rich Felker <dalias@...c.org>,
David Howells <dhowells@...hat.com>,
Daniel Lustig <dlustig@...dia.com>,
linux-kernel@...r.kernel.org,
"Maciej W. Rozycki" <macro@...ux-mips.org>,
Ingo Molnar <mingo@...nel.org>,
Palmer Dabbelt <palmer@...ive.com>,
Paul Burton <paul.burton@...s.com>,
"Paul E. McKenney" <paulmck@...ux.ibm.com>,
Peter Zijlstra <peterz@...radead.org>,
Alan Stern <stern@...land.harvard.edu>,
Tony Luck <tony.luck@...el.com>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Yoshinori Sato <ysato@...rs.sourceforge.jp>
Subject: Re: [PATCH 01/20] asm-generic/mmiowb: Add generic implementation of mmiowb() tracking
Nicholas Piggin <npiggin@...il.com> writes:
> Will Deacon's on March 2, 2019 12:03 am:
>> In preparation for removing all explicit mmiowb() calls from driver
>> code, implement a tracking system in asm-generic based loosely on the
>> PowerPC implementation. This allows architectures with a non-empty
>> mmiowb() definition to have the barrier automatically inserted in
>> spin_unlock() following a critical section containing an I/O write.
>
> Is there a reason to call this "mmiowb"? We already have wmb that
> orders cacheable stores vs mmio stores don't we?
>
> Yes ia64 "sn2" is broken in that case, but that can be fixed (if
> anyone really cares about the platform any more). Maybe that's
> orthogonal to what you're doing here, I just don't like seeing
> "mmiowb" spread.
>
> This series works for spin locks, but you would want a driver to
> be able to use wmb() to order locks vs mmio when using a bit lock
> or a mutex or whatever else.
Without wading into the rest of the discussion, this does raise an
interesting point, ie. what about eg. rwlock's?
They're basically equivalent to spinlocks, and so could reasonably be
expected to have the same behaviour.
But we don't check the io_sync flag in arch_read/write_unlock() etc. and
both of those use lwsync.
Seems like we just forgot they existed? Commit f007cacffc88 ("[POWERPC]
Fix MMIO ops to provide expected barrier behaviour") that added the
io_sync stuff doesn't mention them at all.
Am I missing anything? AFAICS read/write locks were never built on top
of spin locks, so seems like we're just hoping drivers using rwlock do
the right barriers?
cheers
Powered by blists - more mailing lists