All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] arm64: Implement cpu_relax as yield
@ 2015-03-02 19:19 ` Peter Crosthwaite
  0 siblings, 0 replies; 6+ messages in thread
From: Peter Crosthwaite @ 2015-03-02 19:19 UTC (permalink / raw)
  To: linux-arm-kernel, linux-kernel
  Cc: will.deacon, catalin.marinas, michals, peter.crosthwaite

ARM64 has the yield nop hint which has the intended semantics of
cpu_relax. Implement.

The immediate application is ARM CPU emulators. An emulator can take
advantage of the yield hint to de-prioritise an emulated CPU in favor
of other emulation tasks. QEMU A64 SMP emulation has yield awareness,
and sees a significant boot time performance increase with this change.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Acked-by: Will Deacon <will.deacon@arm.com>
---
 arch/arm64/include/asm/processor.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/include/asm/processor.h b/arch/arm64/include/asm/processor.h
index f9be30e..ac2381d 100644
--- a/arch/arm64/include/asm/processor.h
+++ b/arch/arm64/include/asm/processor.h
@@ -126,7 +126,11 @@ extern void release_thread(struct task_struct *);
 
 unsigned long get_wchan(struct task_struct *p);
 
-#define cpu_relax()			barrier()
+static inline void cpu_relax(void)
+{
+	asm volatile("yield" ::: "memory");
+}
+
 #define cpu_relax_lowlatency()                cpu_relax()
 
 /* Thread switching */
-- 
2.3.0.1.g27a12f1


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

* [PATCH] arm64: Implement cpu_relax as yield
@ 2015-03-02 19:19 ` Peter Crosthwaite
  0 siblings, 0 replies; 6+ messages in thread
From: Peter Crosthwaite @ 2015-03-02 19:19 UTC (permalink / raw)
  To: linux-arm-kernel

ARM64 has the yield nop hint which has the intended semantics of
cpu_relax. Implement.

The immediate application is ARM CPU emulators. An emulator can take
advantage of the yield hint to de-prioritise an emulated CPU in favor
of other emulation tasks. QEMU A64 SMP emulation has yield awareness,
and sees a significant boot time performance increase with this change.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Acked-by: Will Deacon <will.deacon@arm.com>
---
 arch/arm64/include/asm/processor.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/include/asm/processor.h b/arch/arm64/include/asm/processor.h
index f9be30e..ac2381d 100644
--- a/arch/arm64/include/asm/processor.h
+++ b/arch/arm64/include/asm/processor.h
@@ -126,7 +126,11 @@ extern void release_thread(struct task_struct *);
 
 unsigned long get_wchan(struct task_struct *p);
 
-#define cpu_relax()			barrier()
+static inline void cpu_relax(void)
+{
+	asm volatile("yield" ::: "memory");
+}
+
 #define cpu_relax_lowlatency()                cpu_relax()
 
 /* Thread switching */
-- 
2.3.0.1.g27a12f1

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

* Re: [PATCH] arm64: Implement cpu_relax as yield
  2015-03-02 19:19 ` Peter Crosthwaite
@ 2015-03-25  9:58   ` Peter Crosthwaite
  -1 siblings, 0 replies; 6+ messages in thread
From: Peter Crosthwaite @ 2015-03-25  9:58 UTC (permalink / raw)
  To: linux-arm-kernel, linux-kernel
  Cc: Will Deacon, Catalin Marinas, michals, Peter Crosthwaite

Ping!

Anything I need to do or send to to get a merge on this?

Regards,
Peter

On Tue, Mar 3, 2015 at 12:49 AM, Peter Crosthwaite
<peter.crosthwaite@xilinx.com> wrote:
> ARM64 has the yield nop hint which has the intended semantics of
> cpu_relax. Implement.
>
> The immediate application is ARM CPU emulators. An emulator can take
> advantage of the yield hint to de-prioritise an emulated CPU in favor
> of other emulation tasks. QEMU A64 SMP emulation has yield awareness,
> and sees a significant boot time performance increase with this change.
>
> Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
> Acked-by: Will Deacon <will.deacon@arm.com>
> ---
>  arch/arm64/include/asm/processor.h | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm64/include/asm/processor.h b/arch/arm64/include/asm/processor.h
> index f9be30e..ac2381d 100644
> --- a/arch/arm64/include/asm/processor.h
> +++ b/arch/arm64/include/asm/processor.h
> @@ -126,7 +126,11 @@ extern void release_thread(struct task_struct *);
>
>  unsigned long get_wchan(struct task_struct *p);
>
> -#define cpu_relax()                    barrier()
> +static inline void cpu_relax(void)
> +{
> +       asm volatile("yield" ::: "memory");
> +}
> +
>  #define cpu_relax_lowlatency()                cpu_relax()
>
>  /* Thread switching */
> --
> 2.3.0.1.g27a12f1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

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

* [PATCH] arm64: Implement cpu_relax as yield
@ 2015-03-25  9:58   ` Peter Crosthwaite
  0 siblings, 0 replies; 6+ messages in thread
From: Peter Crosthwaite @ 2015-03-25  9:58 UTC (permalink / raw)
  To: linux-arm-kernel

Ping!

Anything I need to do or send to to get a merge on this?

Regards,
Peter

On Tue, Mar 3, 2015 at 12:49 AM, Peter Crosthwaite
<peter.crosthwaite@xilinx.com> wrote:
> ARM64 has the yield nop hint which has the intended semantics of
> cpu_relax. Implement.
>
> The immediate application is ARM CPU emulators. An emulator can take
> advantage of the yield hint to de-prioritise an emulated CPU in favor
> of other emulation tasks. QEMU A64 SMP emulation has yield awareness,
> and sees a significant boot time performance increase with this change.
>
> Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
> Acked-by: Will Deacon <will.deacon@arm.com>
> ---
>  arch/arm64/include/asm/processor.h | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm64/include/asm/processor.h b/arch/arm64/include/asm/processor.h
> index f9be30e..ac2381d 100644
> --- a/arch/arm64/include/asm/processor.h
> +++ b/arch/arm64/include/asm/processor.h
> @@ -126,7 +126,11 @@ extern void release_thread(struct task_struct *);
>
>  unsigned long get_wchan(struct task_struct *p);
>
> -#define cpu_relax()                    barrier()
> +static inline void cpu_relax(void)
> +{
> +       asm volatile("yield" ::: "memory");
> +}
> +
>  #define cpu_relax_lowlatency()                cpu_relax()
>
>  /* Thread switching */
> --
> 2.3.0.1.g27a12f1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

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

* Re: [PATCH] arm64: Implement cpu_relax as yield
  2015-03-25  9:58   ` Peter Crosthwaite
@ 2015-03-25 11:31     ` Will Deacon
  -1 siblings, 0 replies; 6+ messages in thread
From: Will Deacon @ 2015-03-25 11:31 UTC (permalink / raw)
  To: Peter Crosthwaite
  Cc: linux-arm-kernel, linux-kernel, Catalin Marinas, michals

On Wed, Mar 25, 2015 at 09:58:26AM +0000, Peter Crosthwaite wrote:
> Ping!
> 
> Anything I need to do or send to to get a merge on this?

It's queued for 4.1 and should already be in linux-next.

Cheers,

Will

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

* [PATCH] arm64: Implement cpu_relax as yield
@ 2015-03-25 11:31     ` Will Deacon
  0 siblings, 0 replies; 6+ messages in thread
From: Will Deacon @ 2015-03-25 11:31 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Mar 25, 2015 at 09:58:26AM +0000, Peter Crosthwaite wrote:
> Ping!
> 
> Anything I need to do or send to to get a merge on this?

It's queued for 4.1 and should already be in linux-next.

Cheers,

Will

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

end of thread, other threads:[~2015-03-25 11:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-02 19:19 [PATCH] arm64: Implement cpu_relax as yield Peter Crosthwaite
2015-03-02 19:19 ` Peter Crosthwaite
2015-03-25  9:58 ` Peter Crosthwaite
2015-03-25  9:58   ` Peter Crosthwaite
2015-03-25 11:31   ` Will Deacon
2015-03-25 11:31     ` Will Deacon

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.