public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] prefetch result for ARM64 atomic ops
@ 2014-04-14 17:55 Pranith Kumar
  2014-04-14 18:04 ` Joe Perches
  0 siblings, 1 reply; 5+ messages in thread
From: Pranith Kumar @ 2014-04-14 17:55 UTC (permalink / raw)
  To: catalin.marinas, will.deacon; +Cc: LKML

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

diff --git a/arch/arm64/include/asm/atomic.h b/arch/arm64/include/asm/atomic.h
index 0237f08..82271ee 100644
--- a/arch/arm64/include/asm/atomic.h
+++ b/arch/arm64/include/asm/atomic.h
@@ -48,6 +48,7 @@ static inline void atomic_add(int i, atomic_t *v)
     unsigned long tmp;
     int result;

+    prefetchw(&v->counter);
     asm volatile("// atomic_add\n"
 "1:    ldxr    %w0, %2\n"
 "    add    %w0, %w0, %w3\n"
@@ -62,6 +63,7 @@ static inline int atomic_add_return(int i, atomic_t *v)
     unsigned long tmp;
     int result;

+    prefetchw(&v->counter);
     asm volatile("// atomic_add_return\n"
 "1:    ldxr    %w0, %2\n"
 "    add    %w0, %w0, %w3\n"
@@ -80,6 +82,7 @@ static inline void atomic_sub(int i, atomic_t *v)
     unsigned long tmp;
     int result;

+    prefetchw(&v->counter);
     asm volatile("// atomic_sub\n"
 "1:    ldxr    %w0, %2\n"
 "    sub    %w0, %w0, %w3\n"
@@ -94,6 +97,7 @@ static inline int atomic_sub_return(int i, atomic_t *v)
     unsigned long tmp;
     int result;

+    prefetchw(&v->counter);
     asm volatile("// atomic_sub_return\n"
 "1:    ldxr    %w0, %2\n"
 "    sub    %w0, %w0, %w3\n"
@@ -113,6 +117,7 @@ static inline int atomic_cmpxchg(atomic_t *ptr,
int old, int new)
     int oldval;

     smp_mb();
+    prefetchw(&v->counter);

     asm volatile("// atomic_cmpxchg\n"
 "1:    ldxr    %w1, %2\n"
@@ -170,6 +175,7 @@ static inline void atomic64_add(u64 i, atomic64_t *v)
     long result;
     unsigned long tmp;

+    prefetchw(&v->counter);
     asm volatile("// atomic64_add\n"
 "1:    ldxr    %0, %2\n"
 "    add    %0, %0, %3\n"
@@ -184,6 +190,7 @@ static inline long atomic64_add_return(long i,
atomic64_t *v)
     long result;
     unsigned long tmp;

+    prefetchw(&v->counter);
     asm volatile("// atomic64_add_return\n"
 "1:    ldxr    %0, %2\n"
 "    add    %0, %0, %3\n"
@@ -202,6 +209,7 @@ static inline void atomic64_sub(u64 i, atomic64_t *v)
     long result;
     unsigned long tmp;

+    prefetchw(&v->counter);
     asm volatile("// atomic64_sub\n"
 "1:    ldxr    %0, %2\n"
 "    sub    %0, %0, %3\n"
@@ -216,6 +224,7 @@ static inline long atomic64_sub_return(long i,
atomic64_t *v)
     long result;
     unsigned long tmp;

+    prefetchw(&v->counter);
     asm volatile("// atomic64_sub_return\n"
 "1:    ldxr    %0, %2\n"
 "    sub    %0, %0, %3\n"
@@ -235,6 +244,7 @@ static inline long atomic64_cmpxchg(atomic64_t
*ptr, long old, long new)
     unsigned long res;

     smp_mb();
+    prefetchw(&v->counter);

     asm volatile("// atomic64_cmpxchg\n"
 "1:    ldxr    %1, %2\n"
@@ -258,6 +268,7 @@ static inline long atomic64_dec_if_positive(atomic64_t *v)
     long result;
     unsigned long tmp;

+    prefetchw(&v->counter);
     asm volatile("// atomic64_dec_if_positive\n"
 "1:    ldxr    %0, %2\n"
 "    subs    %0, %0, #1\n"
-- 
1.9.1


-- 
Pranith

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

* Re: [PATCH 1/1] prefetch result for ARM64 atomic ops
  2014-04-14 17:55 [PATCH 1/1] prefetch result for ARM64 atomic ops Pranith Kumar
@ 2014-04-14 18:04 ` Joe Perches
  2014-04-14 18:11   ` Pranith Kumar
  0 siblings, 1 reply; 5+ messages in thread
From: Joe Perches @ 2014-04-14 18:04 UTC (permalink / raw)
  To: Pranith Kumar; +Cc: catalin.marinas, will.deacon, LKML

On Mon, 2014-04-14 at 13:55 -0400, Pranith Kumar wrote:

Are there some benchmark comparison results
you neglected to attach?

> diff --git a/arch/arm64/include/asm/atomic.h b/arch/arm64/include/asm/atomic.h
[]
> @@ -235,6 +244,7 @@ static inline long atomic64_cmpxchg(atomic64_t
> *ptr, long old, long new)
>      unsigned long res;
> 
>      smp_mb();
> +    prefetchw(&v->counter);

Does this compile?



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

* Re: [PATCH 1/1] prefetch result for ARM64 atomic ops
  2014-04-14 18:04 ` Joe Perches
@ 2014-04-14 18:11   ` Pranith Kumar
  2014-04-14 18:29     ` Joe Perches
  0 siblings, 1 reply; 5+ messages in thread
From: Pranith Kumar @ 2014-04-14 18:11 UTC (permalink / raw)
  To: Joe Perches; +Cc: catalin.marinas, LKML

On Mon, Apr 14, 2014 at 2:04 PM, Joe Perches <joe@perches.com> wrote:
> Are there some benchmark comparison results
> you neglected to attach?

I was trying to get these ops to be similar to the 32 bit atomic ops which
all have prefetch. I did not see any reason why we shouldn't do the same
here. But no, no hard numbers yet. Send me a dev board please :)

>
>> diff --git a/arch/arm64/include/asm/atomic.h b/arch/arm64/include/asm/atomic.h
>> +    prefetchw(&v->counter);
>
> Does this compile?
>

Argh, my mistake! I overlooked this. Please find fixed patch below:

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

diff --git a/arch/arm64/include/asm/atomic.h b/arch/arm64/include/asm/atomic.h
index 0237f08..82271ee 100644
--- a/arch/arm64/include/asm/atomic.h
+++ b/arch/arm64/include/asm/atomic.h
@@ -48,6 +48,7 @@ static inline void atomic_add(int i, atomic_t *v)
     unsigned long tmp;
     int result;

+    prefetchw(&v->counter);
     asm volatile("// atomic_add\n"
 "1:    ldxr    %w0, %2\n"
 "    add    %w0, %w0, %w3\n"
@@ -62,6 +63,7 @@ static inline int atomic_add_return(int i, atomic_t *v)
     unsigned long tmp;
     int result;

+    prefetchw(&v->counter);
     asm volatile("// atomic_add_return\n"
 "1:    ldxr    %w0, %2\n"
 "    add    %w0, %w0, %w3\n"
@@ -80,6 +82,7 @@ static inline void atomic_sub(int i, atomic_t *v)
     unsigned long tmp;
     int result;

+    prefetchw(&v->counter);
     asm volatile("// atomic_sub\n"
 "1:    ldxr    %w0, %2\n"
 "    sub    %w0, %w0, %w3\n"
@@ -94,6 +97,7 @@ static inline int atomic_sub_return(int i, atomic_t *v)
     unsigned long tmp;
     int result;

+    prefetchw(&v->counter);
     asm volatile("// atomic_sub_return\n"
 "1:    ldxr    %w0, %2\n"
 "    sub    %w0, %w0, %w3\n"
@@ -113,6 +117,7 @@ static inline int atomic_cmpxchg(atomic_t *ptr,
int old, int new)
     int oldval;

     smp_mb();
+    prefetchw(&v->counter);

     asm volatile("// atomic_cmpxchg\n"
 "1:    ldxr    %w1, %2\n"
@@ -170,6 +175,7 @@ static inline void atomic64_add(u64 i, atomic64_t *v)
     long result;
     unsigned long tmp;

+    prefetchw(&v->counter);
     asm volatile("// atomic64_add\n"
 "1:    ldxr    %0, %2\n"
 "    add    %0, %0, %3\n"
@@ -184,6 +190,7 @@ static inline long atomic64_add_return(long i,
atomic64_t *v)
     long result;
     unsigned long tmp;

+    prefetchw(&v->counter);
     asm volatile("// atomic64_add_return\n"
 "1:    ldxr    %0, %2\n"
 "    add    %0, %0, %3\n"
@@ -202,6 +209,7 @@ static inline void atomic64_sub(u64 i, atomic64_t *v)
     long result;
     unsigned long tmp;

+    prefetchw(&v->counter);
     asm volatile("// atomic64_sub\n"
 "1:    ldxr    %0, %2\n"
 "    sub    %0, %0, %3\n"
@@ -216,6 +224,7 @@ static inline long atomic64_sub_return(long i,
atomic64_t *v)
     long result;
     unsigned long tmp;

+    prefetchw(&v->counter);
     asm volatile("// atomic64_sub_return\n"
 "1:    ldxr    %0, %2\n"
 "    sub    %0, %0, %3\n"
@@ -235,6 +244,7 @@ static inline long atomic64_cmpxchg(atomic64_t
*ptr, long old, long new)
     unsigned long res;

     smp_mb();
+    prefetchw(&v->counter);

     asm volatile("// atomic64_cmpxchg\n"
 "1:    ldxr    %1, %2\n"
@@ -258,6 +268,7 @@ static inline long atomic64_dec_if_positive(atomic64_t *v)
     long result;
     unsigned long tmp;

+    prefetchw(&v->counter);
     asm volatile("// atomic64_dec_if_positive\n"
 "1:    ldxr    %0, %2\n"
 "    subs    %0, %0, #1\n"
-- 
1.9.1


-- 
Pranith

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

* Re: [PATCH 1/1] prefetch result for ARM64 atomic ops
  2014-04-14 18:11   ` Pranith Kumar
@ 2014-04-14 18:29     ` Joe Perches
  2014-04-14 18:32       ` Pranith Kumar
  0 siblings, 1 reply; 5+ messages in thread
From: Joe Perches @ 2014-04-14 18:29 UTC (permalink / raw)
  To: Pranith Kumar; +Cc: catalin.marinas, LKML, tony

On Mon, 2014-04-14 at 14:11 -0400, Pranith Kumar wrote:
> On Mon, Apr 14, 2014 at 2:04 PM, Joe Perches <joe@perches.com> wrote:
> > Are there some benchmark comparison results
> > you neglected to attach?
> 
> I was trying to get these ops to be similar to the 32 bit atomic ops which
> all have prefetch. I did not see any reason why we shouldn't do the same
> here. But no, no hard numbers yet.

Then you should probably send this as an RFC patch.

> >> diff --git a/arch/arm64/include/asm/atomic.h b/arch/arm64/include/asm/atomic.h
> >> +    prefetchw(&v->counter);
> >
> > Does this compile?

> Argh, my mistake! I overlooked this. Please find fixed patch below:
[]
> diff --git a/arch/arm64/include/asm/atomic.h b/arch/arm64/include/asm/atomic.h
[]
> @@ -235,6 +244,7 @@ static inline long atomic64_cmpxchg(atomic64_t
> *ptr, long old, long new)
>      unsigned long res;
> 
>      smp_mb();
> +    prefetchw(&v->counter);

It seems you sent the original patch again, still not compiled.

An arm64 cross-compiler is available here:
http://linuxdriverproject.org/mediawiki/index.php/Cross-compiling_Linux_kernel_on_x86_64#Installing_arm64_cross-compiler

It'd be nice if an arm64 toolchain was on the kernel.org list too
https://www.kernel.org/pub/tools/crosstool/




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

* Re: [PATCH 1/1] prefetch result for ARM64 atomic ops
  2014-04-14 18:29     ` Joe Perches
@ 2014-04-14 18:32       ` Pranith Kumar
  0 siblings, 0 replies; 5+ messages in thread
From: Pranith Kumar @ 2014-04-14 18:32 UTC (permalink / raw)
  To: Joe Perches; +Cc: catalin.marinas, LKML, tony

On 04/14/2014 02:29 PM, Joe Perches wrote:
> 
> Then you should probably send this as an RFC patch.
>

Ok, I will send a new mail with fixed patch.
 

> It seems you sent the original patch again, still not compiled.
> 
> An arm64 cross-compiler is available here:
> http://linuxdriverproject.org/mediawiki/index.php/Cross-compiling_Linux_kernel_on_x86_64#Installing_arm64_cross-compiler
> 
> It'd be nice if an arm64 toolchain was on the kernel.org list too
> https://www.kernel.org/pub/tools/crosstool/
> 

I will check this out.

--
Pranith

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

end of thread, other threads:[~2014-04-14 18:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-14 17:55 [PATCH 1/1] prefetch result for ARM64 atomic ops Pranith Kumar
2014-04-14 18:04 ` Joe Perches
2014-04-14 18:11   ` Pranith Kumar
2014-04-14 18:29     ` Joe Perches
2014-04-14 18:32       ` Pranith Kumar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox