All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH] x86: Use ACCESS_ONCE() for atomic_read()
@ 2014-09-22 19:53 Pranith Kumar
  2014-09-22 20:07 ` Peter Zijlstra
  0 siblings, 1 reply; 5+ messages in thread
From: Pranith Kumar @ 2014-09-22 19:53 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, H. Peter Anvin,
	maintainer:X86 ARCHITECTURE...,
	Peter Zijlstra, Paul E. McKenney, open list:X86 ARCHITECTURE...

Use the much easier to read ACCESS_ONCE() which is basically the same thing as
the cast to volatile.

Please note the change in volatile cast: ACCESS_ONCE(v)->counter to
ACCESS_ONCE(v->counter).

Signed-off-by: Pranith Kumar <bobby.prani@gmail.com>
---
 arch/x86/include/asm/atomic.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/include/asm/atomic.h b/arch/x86/include/asm/atomic.h
index fa92e93..dea3434 100644
--- a/arch/x86/include/asm/atomic.h
+++ b/arch/x86/include/asm/atomic.h
@@ -24,7 +24,7 @@
  */
 static inline int atomic_read(const atomic_t *v)
 {
-	return (*(volatile int *)&(v)->counter);
+	return ACCESS_ONCE(v->counter);
 }
 
 /**
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [RFC PATCH] x86: Use ACCESS_ONCE() for atomic_read()
  2014-09-22 19:53 [RFC PATCH] x86: Use ACCESS_ONCE() for atomic_read() Pranith Kumar
@ 2014-09-22 20:07 ` Peter Zijlstra
  2014-09-22 20:20   ` Pranith Kumar
  2014-09-23 13:32   ` Pranith Kumar
  0 siblings, 2 replies; 5+ messages in thread
From: Peter Zijlstra @ 2014-09-22 20:07 UTC (permalink / raw)
  To: Pranith Kumar
  Cc: Thomas Gleixner, Ingo Molnar, H. Peter Anvin,
	maintainer:X86 ARCHITECTURE...,
	Paul E. McKenney, open list:X86 ARCHITECTURE...

On Mon, Sep 22, 2014 at 03:53:09PM -0400, Pranith Kumar wrote:
> Use the much easier to read ACCESS_ONCE() which is basically the same thing as
> the cast to volatile.
> 
> Please note the change in volatile cast: ACCESS_ONCE(v)->counter to
> ACCESS_ONCE(v->counter).
> 
> Signed-off-by: Pranith Kumar <bobby.prani@gmail.com>
> ---
>  arch/x86/include/asm/atomic.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

If you want to do something like so, then be consistent and do them all.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFC PATCH] x86: Use ACCESS_ONCE() for atomic_read()
  2014-09-22 20:07 ` Peter Zijlstra
@ 2014-09-22 20:20   ` Pranith Kumar
  2014-09-23 13:32   ` Pranith Kumar
  1 sibling, 0 replies; 5+ messages in thread
From: Pranith Kumar @ 2014-09-22 20:20 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: Thomas Gleixner, Ingo Molnar, H. Peter Anvin,
	maintainer:X86 ARCHITECTURE...,
	Paul E. McKenney, open list:X86 ARCHITECTURE...

On Mon, Sep 22, 2014 at 4:07 PM, Peter Zijlstra <peterz@infradead.org> wrote:
> On Mon, Sep 22, 2014 at 03:53:09PM -0400, Pranith Kumar wrote:
>> Use the much easier to read ACCESS_ONCE() which is basically the same thing as
>> the cast to volatile.
>>
>> Please note the change in volatile cast: ACCESS_ONCE(v)->counter to
>> ACCESS_ONCE(v->counter).
>>
>> Signed-off-by: Pranith Kumar <bobby.prani@gmail.com>
>> ---
>>  arch/x86/include/asm/atomic.h | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> If you want to do something like so, then be consistent and do them all.

Sure, I will change this in all architectures and send in an updated patch.

Thanks!
-- 
Pranith

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFC PATCH] x86: Use ACCESS_ONCE() for atomic_read()
  2014-09-22 20:07 ` Peter Zijlstra
  2014-09-22 20:20   ` Pranith Kumar
@ 2014-09-23 13:32   ` Pranith Kumar
  2014-09-23 14:09     ` Peter Zijlstra
  1 sibling, 1 reply; 5+ messages in thread
From: Pranith Kumar @ 2014-09-23 13:32 UTC (permalink / raw)
  To: Peter Zijlstra; +Cc: open list:X86 ARCHITECTURE...

On Mon, Sep 22, 2014 at 4:07 PM, Peter Zijlstra <peterz@infradead.org> wrote:
> On Mon, Sep 22, 2014 at 03:53:09PM -0400, Pranith Kumar wrote:
>> Use the much easier to read ACCESS_ONCE() which is basically the same thing as
>> the cast to volatile.
>>
>> Please note the change in volatile cast: ACCESS_ONCE(v)->counter to
>> ACCESS_ONCE(v->counter).
>>
>> Signed-off-by: Pranith Kumar <bobby.prani@gmail.com>
>> ---
>>  arch/x86/include/asm/atomic.h | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> If you want to do something like so, then be consistent and do them all.

Hi Peter,

The changelog across all archs is as follows

18 files changed, 24 insertions(+), 24 deletions(-)

Do you think it is better to send it as one patch or break up into
patch for each arch?

-- 
Pranith

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFC PATCH] x86: Use ACCESS_ONCE() for atomic_read()
  2014-09-23 13:32   ` Pranith Kumar
@ 2014-09-23 14:09     ` Peter Zijlstra
  0 siblings, 0 replies; 5+ messages in thread
From: Peter Zijlstra @ 2014-09-23 14:09 UTC (permalink / raw)
  To: Pranith Kumar; +Cc: open list:X86 ARCHITECTURE...

On Tue, Sep 23, 2014 at 09:32:05AM -0400, Pranith Kumar wrote:
> On Mon, Sep 22, 2014 at 4:07 PM, Peter Zijlstra <peterz@infradead.org> wrote:
> > On Mon, Sep 22, 2014 at 03:53:09PM -0400, Pranith Kumar wrote:
> >> Use the much easier to read ACCESS_ONCE() which is basically the same thing as
> >> the cast to volatile.
> >>
> >> Please note the change in volatile cast: ACCESS_ONCE(v)->counter to
> >> ACCESS_ONCE(v->counter).
> >>
> >> Signed-off-by: Pranith Kumar <bobby.prani@gmail.com>
> >> ---
> >>  arch/x86/include/asm/atomic.h | 2 +-
> >>  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > If you want to do something like so, then be consistent and do them all.
> 
> Hi Peter,
> 
> The changelog across all archs is as follows
> 
> 18 files changed, 24 insertions(+), 24 deletions(-)
> 
> Do you think it is better to send it as one patch or break up into
> patch for each arch?

I'd send it as a single patch, its small enough as is, and basically
just a 'style' update.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-09-23 14:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-22 19:53 [RFC PATCH] x86: Use ACCESS_ONCE() for atomic_read() Pranith Kumar
2014-09-22 20:07 ` Peter Zijlstra
2014-09-22 20:20   ` Pranith Kumar
2014-09-23 13:32   ` Pranith Kumar
2014-09-23 14:09     ` Peter Zijlstra

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.