[RFC][PATCH 7/7] locking,asm-generic: Remove generic rwsem add and rwsem update definitions

2016-05-16 Thread Jason Low
The rwsem count has been converted to an atomic variable and we now directly use atomic_long_add() and atomic_long_add_return() on the count, so we can remove the asm-generic implementation of rwsem_atomic_add() and rwsem_atomic_update(). Signed-off-by: Jason Low --- include/asm-generic/rwsem.h

Re: [PATCH] asm-generic: rwsem: de-PPCify rwsem.h

2014-03-07 Thread Arnd Bergmann
; > This patch updates the ifdefs and comments to architecturally neutral > versions. > > Cc: Arnd Bergmann > Acked-by: Richard Kuo > Signed-off-by: Will Deacon > --- > > Hi Arnd, > > Any chance you could queue this for 3.15 please? It means I can easily > move

[PATCH] asm-generic: rwsem: de-PPCify rwsem.h

2014-03-07 Thread Will Deacon
versions. Cc: Arnd Bergmann Acked-by: Richard Kuo Signed-off-by: Will Deacon --- Hi Arnd, Any chance you could queue this for 3.15 please? It means I can easily move arm64 over to the asm-generic rwsem implementation afterwards. Cheers, Will include/asm-generic/rwsem.h | 10 +- 1

Re: [PATCH 1/2] asm-generic: rwsem: ensure sem->cnt is only accessed via atomic_long_*

2014-02-28 Thread Will Deacon
On Fri, Feb 28, 2014 at 12:50:06PM +, Peter Hurley wrote: > On 02/28/2014 07:13 AM, Will Deacon wrote: > > diff --git a/include/asm-generic/rwsem.h b/include/asm-generic/rwsem.h > > index 603a0a11e592..2b6401f9e428 100644 > > --- a/include/asm-generic/rwsem.h > > +++ b/include/asm-generic/rwsem

Re: [PATCH 1/2] asm-generic: rwsem: ensure sem->cnt is only accessed via atomic_long_*

2014-02-28 Thread Peter Hurley
On 02/28/2014 07:13 AM, Will Deacon wrote: On Thu, Feb 27, 2014 at 05:28:24AM +, Davidlohr Bueso wrote: On Fri, 2014-02-21 at 17:22 +, Will Deacon wrote: The asm-generic rwsem implementation directly acceses sem->cnt when performing a __down_read_trylock operation. Whilst this

Re: [PATCH 1/2] asm-generic: rwsem: ensure sem->cnt is only accessed via atomic_long_*

2014-02-28 Thread Will Deacon
On Thu, Feb 27, 2014 at 05:28:24AM +, Davidlohr Bueso wrote: > On Fri, 2014-02-21 at 17:22 +, Will Deacon wrote: > > The asm-generic rwsem implementation directly acceses sem->cnt when > > performing a __down_read_trylock operation. Whilst this is probably safe > >

Re: [PATCH 1/2] asm-generic: rwsem: ensure sem->cnt is only accessed via atomic_long_*

2014-02-27 Thread Will Deacon
On Thu, Feb 27, 2014 at 05:28:24AM +, Davidlohr Bueso wrote: > On Fri, 2014-02-21 at 17:22 +, Will Deacon wrote: > > The asm-generic rwsem implementation directly acceses sem->cnt when > > performing a __down_read_trylock operation. Whilst this is probably safe > >

Re: [PATCH 1/2] asm-generic: rwsem: ensure sem->cnt is only accessed via atomic_long_*

2014-02-26 Thread Davidlohr Bueso
On Fri, 2014-02-21 at 17:22 +, Will Deacon wrote: > The asm-generic rwsem implementation directly acceses sem->cnt when > performing a __down_read_trylock operation. Whilst this is probably safe > on all architectures, we should stick to the atomic_long_* API and use > atomic_lo

Re: [PATCH 2/2] asm-generic: rwsem: de-PPCify rwsem.h

2014-02-26 Thread rkuo
On Fri, Feb 21, 2014 at 05:22:27PM +, Will Deacon wrote: > asm-generic/rwsem.h used to live under arch/powerpc. During its > liberation to common code, a few references to its former home where > preserved, in particular the definition of RWSEM_ACTIVE_MASK is > predicated on CONFIG_PPC64. > >

[PATCH 2/2] asm-generic: rwsem: de-PPCify rwsem.h

2014-02-21 Thread Will Deacon
asm-generic/rwsem.h used to live under arch/powerpc. During its liberation to common code, a few references to its former home where preserved, in particular the definition of RWSEM_ACTIVE_MASK is predicated on CONFIG_PPC64. This patch updates the ifdefs and comments to architecturally neutral ver

[PATCH 1/2] asm-generic: rwsem: ensure sem->cnt is only accessed via atomic_long_*

2014-02-21 Thread Will Deacon
The asm-generic rwsem implementation directly acceses sem->cnt when performing a __down_read_trylock operation. Whilst this is probably safe on all architectures, we should stick to the atomic_long_* API and use atomic_long_read instead. Signed-off-by: Will Deacon --- include/asm-gene

[PATCH 1/4] sparc64: use generic rwsem spinlocks rt

2014-01-05 Thread Allen Pais
This patch enables the use of generic rwsem spinlocks to support RT on sparc64 Acked-by: David S. Miller Signed-off-by: Allen Pais --- arch/sparc/Kconfig |6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig index 6787bd3..554995d

Re: [PATCH 1/3] sparc64: use generic rwsem spinlocks rt

2013-12-16 Thread Allen Pais
> > davem won't apply this because the PREEMPT_RT symbol is not available > upstream. I referred to patch two+. Yes, I thought it'd be good get a review from him. - Allen -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kern

Re: [PATCH 1/3] sparc64: use generic rwsem spinlocks rt

2013-12-16 Thread Sebastian Andrzej Siewior
On 12/16/2013 05:07 AM, Allen Pais wrote: > --- a/arch/sparc/Kconfig > +++ b/arch/sparc/Kconfig > @@ -179,12 +179,10 @@ config NR_CPUS > source kernel/Kconfig.hz > > config RWSEM_GENERIC_SPINLOCK > - bool > - default y if SPARC32 > + def_bool PREEMPT_RT_FULL > > config RWSEM_XCHG

[PATCH 1/3] sparc64: use generic rwsem spinlocks rt

2013-12-15 Thread Allen Pais
Signed-off-by: Allen Pais --- arch/sparc/Kconfig |6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig index 6787bd3..554995d 100644 --- a/arch/sparc/Kconfig +++ b/arch/sparc/Kconfig @@ -179,12 +179,10 @@ config NR_CPUS source kerne

Re: [patch][rfc] rwsem: generic rwsem

2006-12-08 Thread David Howells
Nick Piggin <[EMAIL PROTECTED]> wrote: > > Look at how the counter works in the XADD-based version. That's the way > > it is *because* I'm using XADD. That's quite limiting. > > Not really. ll/sc architectures "emulate" xadd the same as they would > emulate a spinlock. There is nothing suboptim

Re: [patch][rfc] rwsem: generic rwsem

2006-12-07 Thread Nick Piggin
On Tue, Dec 05, 2006 at 08:36:22PM +, David Howells wrote: > Nick Piggin <[EMAIL PROTECTED]> wrote: > > > Either approach works, and one is better than the current two approaches. > > >From one point of view that's true. But from other points of view, it isn't. > > > > have be implemented b

Re: [patch][rfc] rwsem: generic rwsem

2006-12-05 Thread David Howells
Nick Piggin <[EMAIL PROTECTED]> wrote: > Either approach works, and one is better than the current two approaches. >From one point of view that's true. But from other points of view, it isn't. > > have be implemented by spinlock on some archs, and so your approach is > > really not optimal in s

Re: [patch][rfc] rwsem: generic rwsem

2006-12-04 Thread Nick Piggin
On Mon, Dec 04, 2006 at 12:55:16PM +, David Howells wrote: > Nick Piggin <[EMAIL PROTECTED]> wrote: > > > Move to an architecture independent rwsem implementation, using the > > better of the two rwsem implementations (ie. the one which doesn't > > take a spinlock to take an uncontested rwsem)

Re: [patch][rfc] rwsem: generic rwsem

2006-12-04 Thread David Howells
Nick Piggin <[EMAIL PROTECTED]> wrote: > Move to an architecture independent rwsem implementation, using the > better of the two rwsem implementations (ie. the one which doesn't > take a spinlock to take an uncontested rwsem) as a basis. This gives > us a single rwsem design instead of two. Sigh.

Re: [patch][rfc] rwsem: generic rwsem

2006-12-04 Thread Nick Piggin
On Mon, Dec 04, 2006 at 11:06:07AM +0100, Nick Piggin wrote: > (resending with correct ML addresses, sorry) > > Hi, > > This patch needs review and testing from the architecture guys, but > I would like to consider it because of the obvious maintenance benefits. Hah, very important detail: patch

Re: [andrea@suse.de: Re: generic rwsem [Re: Alpha "process table hang"]]

2001-04-25 Thread Jamie Lokier
Linus Torvalds wrote: > For i386 and i486, there is no reason to try to maintain a complex fast > case. The machines are unquestionably going away - we should strive to not > burden them unnecessarily, but we should _not_ try to save two cycles. ... > Icache is also precious on the 386, which has

Re: generic rwsem [Re: Alpha "process table hang"]

2001-04-23 Thread Andrea Arcangeli
On Mon, Apr 23, 2001 at 06:27:23PM -0500, Bob McElrath wrote: > Well, take that back, I just got it to hang. Again, this is 2.4.4pre3 > with alpha-numa-3 and rwsem-generic-4. I saw it upon starting mozilla. > I also saw some scary filesystem errors that may or may not be related: > Apr 23 18

Re: generic rwsem [Re: Alpha "process table hang"]

2001-04-23 Thread Bob McElrath
Andrea Arcangeli [[EMAIL PROTECTED]] wrote: > On Thu, Apr 19, 2001 at 11:21:17AM -0500, Bob McElrath wrote: > > I'm at 2 days uptime now, and have not seen the process-table-hang. > > Looks like this fixed it. Previously I would get a hang in the first > > day or so. I'm using your alpha-numa-3

Re: x86 rwsem in 2.4.4pre[234] are still buggy [was Re: rwsembenchmarks [Re: generic rwsem [Re: Alpha "process table hang"]]]

2001-04-21 Thread Linus Torvalds
On Sat, 21 Apr 2001, Russell King wrote: > > Erm, spin_lock()? What if up_read or up_write gets called from interrupt > context (is this allowed)? Currently that is not allowed. We allow it for regular semaphores, but not for rw-semaphores. We may some day have to revisit that issue, but I s

Re: x86 rwsem in 2.4.4pre[234] are still buggy [was Re: rwsem benchmarks [Re: generic rwsem [Re: Alpha "process table hang"]]]

2001-04-21 Thread Andrea Arcangeli
On Sat, Apr 21, 2001 at 03:37:42PM +0100, Russell King wrote: > On Sat, Apr 21, 2001 at 04:03:27PM +0200, Andrea Arcangeli wrote: > > On Fri, Apr 20, 2001 at 04:45:32PM -0700, Linus Torvalds wrote: > > > I would suggest the following: > > > > > > - the generic semaphores should use the lock that

Re: x86 rwsem in 2.4.4pre[234] are still buggy [was Re: rwsem benchmarks [Re: generic rwsem [Re: Alpha "process table hang"]]]

2001-04-21 Thread Andrea Arcangeli
On Sat, Apr 21, 2001 at 03:37:05PM +0100, [EMAIL PROTECTED] wrote: > Andrea Arcangeli writes: > > That it is allowed by my generic code that does spin_lock_irq in down_* and > > spin_lock_irqsave in up_* but it's disallowed by the weaker semantics of the ^

Re: x86 rwsem in 2.4.4pre[234] are still buggy [was Re: rwsem benchmarks [Re: generic rwsem [Re: Alpha "process table hang"]]]

2001-04-21 Thread Russell King
On Sat, Apr 21, 2001 at 04:03:27PM +0200, Andrea Arcangeli wrote: > On Fri, Apr 20, 2001 at 04:45:32PM -0700, Linus Torvalds wrote: > > I would suggest the following: > > > > - the generic semaphores should use the lock that already exists in the > >wait-queue as the semaphore spinlock. > >

Re: x86 rwsem in 2.4.4pre[234] are still buggy [was Re: rwsem benchmarks [Re: generic rwsem [Re: Alpha "process table hang"]]]

2001-04-21 Thread rmk
Andrea Arcangeli writes: > That it is allowed by my generic code that does spin_lock_irq in down_* and > spin_lock_irqsave in up_* but it's disallowed by the weaker semantics of the > generic and x86 semaphores 2.4.4pre[2345] (or + David's last patch). Hang on, who's code is in 2.4.4-pre5? It cl

Re: x86 rwsem in 2.4.4pre[234] are still buggy [was Re: rwsem benchmarks [Re: generic rwsem [Re: Alpha "process table hang"]]]

2001-04-21 Thread Andrea Arcangeli
On Sat, Apr 21, 2001 at 03:17:37PM +0100, Russell King wrote: > On Sat, Apr 21, 2001 at 04:03:27PM +0200, Andrea Arcangeli wrote: > > On Fri, Apr 20, 2001 at 04:45:32PM -0700, Linus Torvalds wrote: > > > I would suggest the following: > > > > > > - the generic semaphores should use the lock that

Re: x86 rwsem in 2.4.4pre[234] are still buggy [was Re: rwsem benchmarks [Re: generic rwsem [Re: Alpha "process table hang"]]]

2001-04-21 Thread Russell King
On Sat, Apr 21, 2001 at 04:03:27PM +0200, Andrea Arcangeli wrote: > On Fri, Apr 20, 2001 at 04:45:32PM -0700, Linus Torvalds wrote: > > I would suggest the following: > > > > - the generic semaphores should use the lock that already exists in the > >wait-queue as the semaphore spinlock. > >

Re: x86 rwsem in 2.4.4pre[234] are still buggy [was Re: rwsem benchmarks [Re: generic rwsem [Re: Alpha "process table hang"]]]

2001-04-21 Thread Andrea Arcangeli
On Fri, Apr 20, 2001 at 04:45:32PM -0700, Linus Torvalds wrote: > I would suggest the following: > > - the generic semaphores should use the lock that already exists in the >wait-queue as the semaphore spinlock. Ok, that is what my generic code does. > - the generic semaphores should _not

Re: x86 rwsem in 2.4.4pre[234] are still buggy [was Re: rwsembenchmarks [Re: generic rwsem [Re: Alpha "process table hang"]]]

2001-04-20 Thread Linus Torvalds
On Fri, 20 Apr 2001, Andrea Arcangeli wrote: > > While dropping the list_empty check to speed up the fast path I faced the same > complexity of the 2.4.4pre4 lib/rwsem.c and so before reinventing the wheel I > read how the problem was solved in 2.4.4pre4. I would suggest the following: - the

Re: [andrea@suse.de: Re: generic rwsem [Re: Alpha "process table hang"]]

2001-04-20 Thread Andrea Arcangeli
On Fri, Apr 20, 2001 at 09:23:47AM +0100, David Howells wrote: > Andrea seems to have changed his mind on the non-inlining in the generic case. I changed my mind because if you benchmark the fast path you will do it without running out of icache (basically only down_* and up_* will be in the icac

Re: [andrea@suse.de: Re: generic rwsem [Re: Alpha "process tablehang"]]

2001-04-20 Thread Linus Torvalds
On Fri, 20 Apr 2001, David Howells wrote: > > The file should only be used for the 80386 and maybe early 80486's where > CMPXCHG doesn't work properly, everything above that can use the XADD > implementation. Why are those not using the generic files? The generic code is obviously more maintain

x86 rwsem in 2.4.4pre[234] are still buggy [was Re: rwsem benchmarks [Re: generic rwsem [Re: Alpha "process table hang"]]]

2001-04-20 Thread Andrea Arcangeli
On Fri, Apr 20, 2001 at 03:42:15AM +0200, Andrea Arcangeli wrote: > I'm uncertain if I should drop the list_empty() check from the fast path and if While dropping the list_empty check to speed up the fast path I faced the same complexity of the 2.4.4pre4 lib/rwsem.c and so before reinventing the

Re: rwsem benchmarks [Re: generic rwsem [Re: Alpha "process table hang"]]

2001-04-20 Thread David Howells
> About the benchmark you wrote it looks good measure to me, thanks. As with all benchmarks, take with one pinch of salt and two of Mindcraft:-) David - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at

Re: [andrea@suse.de: Re: generic rwsem [Re: Alpha "process table hang"]]

2001-04-20 Thread David Howells
Linus Torvalds <[EMAIL PROTECTED]> wrote: > I think Andrea is right. Although this file seems to be entirely > old-fashioned and should never be used, right? I presume you're talking about "include/asm-i386/rwsem-spin.h"... If so, Andrea is right, there is a bug in it (repeated a number of times)

Re: rwsem benchmarks [Re: generic rwsem [Re: Alpha "process table hang"]]

2001-04-19 Thread Andrea Arcangeli
On Fri, Apr 20, 2001 at 12:28:09AM +0100, D . W . Howells wrote: > I benchmarked four different environments: > > (1) 2.4.4-pre3 + Andrea's generic rwsem patch > (2) 2.4.4-pre4 using XADD to implement the rwsems > (3) same as (2) but with a tweak to make rw

rwsem benchmarks [Re: generic rwsem [Re: Alpha "process table hang"]]

2001-04-19 Thread D . W . Howells
ipset. All the tests were run in runlevel 3 with no other applications running. I benchmarked four different environments: (1) 2.4.4-pre3 + Andrea's generic rwsem patch (2) 2.4.4-pre4 using XADD to implement the rwsems (3) same as (2) but with a tweak to make rwsem_w

Re: generic rwsem [Re: Alpha "process table hang"]

2001-04-19 Thread Andrea Arcangeli
On Thu, Apr 19, 2001 at 11:21:17AM -0500, Bob McElrath wrote: > I'm at 2 days uptime now, and have not seen the process-table-hang. > Looks like this fixed it. Previously I would get a hang in the first > day or so. I'm using your alpha-numa-3 and rwsem-generic-4 against > 2.4.4pre3. good, than

Re: generic rwsem [Re: Alpha "process table hang"]

2001-04-19 Thread Bob McElrath
Bob McElrath [[EMAIL PROTECTED]] wrote: > Andrea Arcangeli [[EMAIL PROTECTED]] wrote: > > > > So please try to reproduce the hang with 2.4.4pre3 with those two > > patches applied: > > > > >ftp://ftp.us.kernel.org/pub/linux/kernel/people/andrea/kernels/v2.4/2.4.4pre3aa3/00_alpha-numa-3 > >

Re: generic rwsem [Re: Alpha "process table hang"]

2001-04-18 Thread Andrea Arcangeli
On Wed, Apr 18, 2001 at 12:54:41AM +0100, D . W . Howells wrote: > > It is 36bytes. and on 64bit archs the difference is going to be less. > > You're right - I can't add up (must be too late at night), and I was looking > at wait_queue not wait_queue_head. I suppose that means my implementation

Re: generic rwsem [Re: Alpha "process table hang"]

2001-04-17 Thread D . W . Howells
> It is 36bytes. and on 64bit archs the difference is going to be less. You're right - I can't add up (must be too late at night), and I was looking at wait_queue not wait_queue_head. I suppose that means my implementations are then 20 and 16 bytes respectively. On 64-bit archs the difference

Re: generic rwsem [Re: Alpha "process table hang"]

2001-04-17 Thread Andrea Arcangeli
On Tue, Apr 17, 2001 at 10:48:02PM +0100, D . W . Howells wrote: > I disagree... you want such primitives to be as efficient as possible. The > whole point of having asm/.h files is that you can stuff them full of > dirty tricks specific to certain architectures. Of course you always have t

Re: generic rwsem [Re: Alpha "process table hang"]

2001-04-17 Thread Andrea Arcangeli
On Tue, Apr 17, 2001 at 11:29:23PM +0200, Christoph Hellwig wrote: > Yes! All the objects in export-objs only get additional depencies in > Rules.make - but if they do not get compiled at all that depencies won't > matter either. All other makefile work this way, btw. ok thanks for the confirm.

Re: generic rwsem [Re: Alpha "process table hang"]

2001-04-17 Thread D . W . Howells
> I am sure ppc couldn't race (at least unless up_read/up_write were excuted > from irq/softnet context and that never happens in 2.4.4pre3, see below ;). This is not actually using the rwsem code I wrote at the moment. > And incidentally the above is what (I guess Richard) did on the alpha a

Re: generic rwsem [Re: Alpha "process table hang"]

2001-04-17 Thread Christoph Hellwig
Hi Andrea, In article <[EMAIL PROTECTED]> you wrote: > I didn't exported rwsem.c if CONFIG_RWSEM_GENERIC is set to n as suggested > by Christoph yet because the old code couldn't be buggy and it's not obvious to > me that the other way around is correct (Christoph are you sure we can export an >

Re: generic rwsem [Re: Alpha "process table hang"]

2001-04-17 Thread Andrea Arcangeli
On Tue, Apr 17, 2001 at 08:18:57PM +0100, D . W . Howells wrote: > Andrea, > > > As said the design of the framework to plugin per-arch rwsem implementation > > isn't flexible enough and the generic spinlocks are as well broken, try to > > use them if you can (yes I tried that for the alpha, it

Re: generic rwsem [Re: Alpha "process table hang"]

2001-04-17 Thread D . W . Howells
Andrea, > As said the design of the framework to plugin per-arch rwsem implementation > isn't flexible enough and the generic spinlocks are as well broken, try to > use them if you can (yes I tried that for the alpha, it was just a mess and > it was more productive to rewrite than to fix). Ha

Re: generic rwsem [Re: Alpha "process table hang"]

2001-04-17 Thread Andrea Arcangeli
__DECLARE_RWSEM_GENERIC(name,RW_LOCK_BIAS-1) ^^ #define DECLARE_RWSEM_WRITE_LOCKED(name) __DECLARE_RWSEM_GENERIC(name,0) > > My generic rwsem should be also cleaner and faster than the generic ones in > > 2.4.4pre3 and they can be turned off compl

Re: generic rwsem [Re: Alpha "process table hang"]

2001-04-17 Thread David Howells
e) and I cannot reproduce the hang any > longer. Can you supply a test case that demonstrates it not working? > My generic rwsem should be also cleaner and faster than the generic ones in > 2.4.4pre3 and they can be turned off completly so an architecture can really > takeove

Re: generic rwsem

2001-04-17 Thread Thorsten Glaser Geuer
Thanks a lot, andrea, this patch (I only applied the rwsem one) finally fixes the rwsem compile problem with gcc-3.0-20010417. Now I can get a working kernel ;-) -mirabilos - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More

Re: generic rwsem [Re: Alpha "process table hang"]

2001-04-17 Thread Christoph Hellwig
In article <[EMAIL PROTECTED]> you wrote: > My generic rwsem should be also cleaner and faster than the generic ones in > 2.4.4pre3 and they can be turned off completly so an architecture can really > takeover with its own asm implementation (while with the 2.4.4pre3 design this

Re: generic rwsem [Re: Alpha "process table hang"]

2001-04-17 Thread Bob McElrath
Andrea Arcangeli [[EMAIL PROTECTED]] wrote: > > So please try to reproduce the hang with 2.4.4pre3 with those two > patches applied: > > >ftp://ftp.us.kernel.org/pub/linux/kernel/people/andrea/kernels/v2.4/2.4.4pre3aa3/00_alpha-numa-3 > >ftp://ftp.us.kernel.org/pub/linux/kernel/peop

generic rwsem [Re: Alpha "process table hang"]

2001-04-17 Thread Andrea Arcangeli
in C that is now adpoted by the ppc port (I added some scalability and locking optimization), and made them generic dropping all the rwsem stuff that is been included into 2.4.4pre[23] (the generic rwsemaphores in those kernels is broken, try to use them in other archs or x86 and you will notice) a