Re: [PATCH 6/9] asm-generic/bitops/atomic.h: Rewrite using atomic_fetch_*

2018-05-24 Thread Peter Zijlstra
On Fri, May 25, 2018 at 12:06:10AM +0200, Andrea Parri wrote: > Hi Mark, > > > As an aside, If I complete the autogeneration stuff, it'll be possible > > to generate those. I split out the necessary barriers in [1], but I > > still have a lot of other preparatory cleanup to do. > > I do grasp

Re: [PATCH 6/9] asm-generic/bitops/atomic.h: Rewrite using atomic_fetch_*

2018-05-24 Thread Peter Zijlstra
On Fri, May 25, 2018 at 12:06:10AM +0200, Andrea Parri wrote: > Hi Mark, > > > As an aside, If I complete the autogeneration stuff, it'll be possible > > to generate those. I split out the necessary barriers in [1], but I > > still have a lot of other preparatory cleanup to do. > > I do grasp

Re: [PATCH 6/9] asm-generic/bitops/atomic.h: Rewrite using atomic_fetch_*

2018-05-24 Thread Andrea Parri
Hi Mark, > As an aside, If I complete the autogeneration stuff, it'll be possible > to generate those. I split out the necessary barriers in [1], but I > still have a lot of other preparatory cleanup to do. I do grasp the rationale behind that naming:

Re: [PATCH 6/9] asm-generic/bitops/atomic.h: Rewrite using atomic_fetch_*

2018-05-24 Thread Andrea Parri
Hi Mark, > As an aside, If I complete the autogeneration stuff, it'll be possible > to generate those. I split out the necessary barriers in [1], but I > still have a lot of other preparatory cleanup to do. I do grasp the rationale behind that naming:

Re: [PATCH 6/9] asm-generic/bitops/atomic.h: Rewrite using atomic_fetch_*

2018-05-24 Thread Mark Rutland
On Thu, May 24, 2018 at 01:47:39PM +0100, Will Deacon wrote: > On Thu, May 24, 2018 at 02:44:10PM +0200, Peter Zijlstra wrote: > > On Thu, May 24, 2018 at 11:59:43AM +0100, Will Deacon wrote: > > > +static inline void set_bit(unsigned int nr, volatile unsigned long *p) > > > { > > > + p +=

Re: [PATCH 6/9] asm-generic/bitops/atomic.h: Rewrite using atomic_fetch_*

2018-05-24 Thread Mark Rutland
On Thu, May 24, 2018 at 01:47:39PM +0100, Will Deacon wrote: > On Thu, May 24, 2018 at 02:44:10PM +0200, Peter Zijlstra wrote: > > On Thu, May 24, 2018 at 11:59:43AM +0100, Will Deacon wrote: > > > +static inline void set_bit(unsigned int nr, volatile unsigned long *p) > > > { > > > + p +=

Re: [PATCH 6/9] asm-generic/bitops/atomic.h: Rewrite using atomic_fetch_*

2018-05-24 Thread Will Deacon
On Thu, May 24, 2018 at 02:44:10PM +0200, Peter Zijlstra wrote: > On Thu, May 24, 2018 at 11:59:43AM +0100, Will Deacon wrote: > > +static inline void set_bit(unsigned int nr, volatile unsigned long *p) > > { > > + p += BIT_WORD(nr); > > + atomic_long_fetch_or_relaxed(BIT_MASK(nr),

Re: [PATCH 6/9] asm-generic/bitops/atomic.h: Rewrite using atomic_fetch_*

2018-05-24 Thread Will Deacon
On Thu, May 24, 2018 at 02:44:10PM +0200, Peter Zijlstra wrote: > On Thu, May 24, 2018 at 11:59:43AM +0100, Will Deacon wrote: > > +static inline void set_bit(unsigned int nr, volatile unsigned long *p) > > { > > + p += BIT_WORD(nr); > > + atomic_long_fetch_or_relaxed(BIT_MASK(nr),

Re: [PATCH 6/9] asm-generic/bitops/atomic.h: Rewrite using atomic_fetch_*

2018-05-24 Thread Peter Zijlstra
On Thu, May 24, 2018 at 11:59:43AM +0100, Will Deacon wrote: > +static inline void set_bit(unsigned int nr, volatile unsigned long *p) > { > + p += BIT_WORD(nr); > + atomic_long_fetch_or_relaxed(BIT_MASK(nr), (atomic_long_t *)p); > } > > +static inline void clear_bit(unsigned int nr,

Re: [PATCH 6/9] asm-generic/bitops/atomic.h: Rewrite using atomic_fetch_*

2018-05-24 Thread Peter Zijlstra
On Thu, May 24, 2018 at 11:59:43AM +0100, Will Deacon wrote: > +static inline void set_bit(unsigned int nr, volatile unsigned long *p) > { > + p += BIT_WORD(nr); > + atomic_long_fetch_or_relaxed(BIT_MASK(nr), (atomic_long_t *)p); > } > > +static inline void clear_bit(unsigned int nr,

[PATCH 6/9] asm-generic/bitops/atomic.h: Rewrite using atomic_fetch_*

2018-05-24 Thread Will Deacon
The atomic bitops can actually be implemented pretty efficiently using the atomic_fetch_* ops, rather than explicit use of spinlocks. Cc: Peter Zijlstra Cc: Ingo Molnar Signed-off-by: Will Deacon ---

[PATCH 6/9] asm-generic/bitops/atomic.h: Rewrite using atomic_fetch_*

2018-05-24 Thread Will Deacon
The atomic bitops can actually be implemented pretty efficiently using the atomic_fetch_* ops, rather than explicit use of spinlocks. Cc: Peter Zijlstra Cc: Ingo Molnar Signed-off-by: Will Deacon --- include/asm-generic/bitops/atomic.h | 188 +++- 1 file