* [PATCH] powerpc: Redefine HMT_xxx macros as empty on PPC32
@ 2021-08-25 13:34 Christophe Leroy
2021-08-26 4:57 ` Michael Ellerman
2021-08-31 13:56 ` Michael Ellerman
0 siblings, 2 replies; 3+ messages in thread
From: Christophe Leroy @ 2021-08-25 13:34 UTC (permalink / raw)
To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman
Cc: linuxppc-dev, linux-kernel
HMT_xxx macros are macros for adjusting thread priority
(hardware multi-threading) are macros inherited from PPC64
via commit 5f7c690728ac ("[PATCH] powerpc: Merged ppc_asm.h")
Those instructions are pointless on PPC32, but some common
fonctions like arch_cpu_idle() use them.
So make them empty on PPC32 to avoid those instructions.
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
arch/powerpc/include/asm/vdso/processor.h | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/arch/powerpc/include/asm/vdso/processor.h b/arch/powerpc/include/asm/vdso/processor.h
index e072577bc7c0..8d79f994b4aa 100644
--- a/arch/powerpc/include/asm/vdso/processor.h
+++ b/arch/powerpc/include/asm/vdso/processor.h
@@ -5,12 +5,21 @@
#ifndef __ASSEMBLY__
/* Macros for adjusting thread priority (hardware multi-threading) */
+#ifdef CONFIG_PPC64
#define HMT_very_low() asm volatile("or 31, 31, 31 # very low priority")
#define HMT_low() asm volatile("or 1, 1, 1 # low priority")
#define HMT_medium_low() asm volatile("or 6, 6, 6 # medium low priority")
#define HMT_medium() asm volatile("or 2, 2, 2 # medium priority")
#define HMT_medium_high() asm volatile("or 5, 5, 5 # medium high priority")
#define HMT_high() asm volatile("or 3, 3, 3 # high priority")
+#else
+#define HMT_very_low()
+#define HMT_low()
+#define HMT_medium_low()
+#define HMT_medium()
+#define HMT_medium_high()
+#define HMT_high()
+#endif
#ifdef CONFIG_PPC64
#define cpu_relax() do { HMT_low(); HMT_medium(); barrier(); } while (0)
--
2.25.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] powerpc: Redefine HMT_xxx macros as empty on PPC32
2021-08-25 13:34 [PATCH] powerpc: Redefine HMT_xxx macros as empty on PPC32 Christophe Leroy
@ 2021-08-26 4:57 ` Michael Ellerman
2021-08-31 13:56 ` Michael Ellerman
1 sibling, 0 replies; 3+ messages in thread
From: Michael Ellerman @ 2021-08-26 4:57 UTC (permalink / raw)
To: Christophe Leroy, Benjamin Herrenschmidt, Paul Mackerras
Cc: linuxppc-dev, linux-kernel
Christophe Leroy <christophe.leroy@csgroup.eu> writes:
> HMT_xxx macros are macros for adjusting thread priority
> (hardware multi-threading) are macros inherited from PPC64
> via commit 5f7c690728ac ("[PATCH] powerpc: Merged ppc_asm.h")
>
> Those instructions are pointless on PPC32, but some common
> fonctions like arch_cpu_idle() use them.
>
> So make them empty on PPC32 to avoid those instructions.
I guess we're pretty sure no 32-bit CPUs do anything with those.
e6500 can run in 32-bit mode, and is 2-way threaded AIUI, so it's
*possible* it could use them.
But I can't find any mention of those special nops in the e6500 core
manual. And actually it does have documentation about thread priority
registers, PPR32, TPRI0/1, but it says they're not used in e6500.
So I guess this seems safe, I'll pick it up.
cheers
> diff --git a/arch/powerpc/include/asm/vdso/processor.h b/arch/powerpc/include/asm/vdso/processor.h
> index e072577bc7c0..8d79f994b4aa 100644
> --- a/arch/powerpc/include/asm/vdso/processor.h
> +++ b/arch/powerpc/include/asm/vdso/processor.h
> @@ -5,12 +5,21 @@
> #ifndef __ASSEMBLY__
>
> /* Macros for adjusting thread priority (hardware multi-threading) */
> +#ifdef CONFIG_PPC64
> #define HMT_very_low() asm volatile("or 31, 31, 31 # very low priority")
> #define HMT_low() asm volatile("or 1, 1, 1 # low priority")
> #define HMT_medium_low() asm volatile("or 6, 6, 6 # medium low priority")
> #define HMT_medium() asm volatile("or 2, 2, 2 # medium priority")
> #define HMT_medium_high() asm volatile("or 5, 5, 5 # medium high priority")
> #define HMT_high() asm volatile("or 3, 3, 3 # high priority")
> +#else
> +#define HMT_very_low()
> +#define HMT_low()
> +#define HMT_medium_low()
> +#define HMT_medium()
> +#define HMT_medium_high()
> +#define HMT_high()
> +#endif
>
> #ifdef CONFIG_PPC64
> #define cpu_relax() do { HMT_low(); HMT_medium(); barrier(); } while (0)
> --
> 2.25.0
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] powerpc: Redefine HMT_xxx macros as empty on PPC32
2021-08-25 13:34 [PATCH] powerpc: Redefine HMT_xxx macros as empty on PPC32 Christophe Leroy
2021-08-26 4:57 ` Michael Ellerman
@ 2021-08-31 13:56 ` Michael Ellerman
1 sibling, 0 replies; 3+ messages in thread
From: Michael Ellerman @ 2021-08-31 13:56 UTC (permalink / raw)
To: Paul Mackerras, Benjamin Herrenschmidt, Christophe Leroy,
Michael Ellerman
Cc: linuxppc-dev, linux-kernel
On Wed, 25 Aug 2021 13:34:45 +0000 (UTC), Christophe Leroy wrote:
> HMT_xxx macros are macros for adjusting thread priority
> (hardware multi-threading) are macros inherited from PPC64
> via commit 5f7c690728ac ("[PATCH] powerpc: Merged ppc_asm.h")
>
> Those instructions are pointless on PPC32, but some common
> fonctions like arch_cpu_idle() use them.
>
> [...]
Applied to powerpc/next.
[1/1] powerpc: Redefine HMT_xxx macros as empty on PPC32
https://git.kernel.org/powerpc/c/8149238ffd210875f5a77e3c654bb59b58da35e3
cheers
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-08-31 13:58 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-08-25 13:34 [PATCH] powerpc: Redefine HMT_xxx macros as empty on PPC32 Christophe Leroy
2021-08-26 4:57 ` Michael Ellerman
2021-08-31 13:56 ` Michael Ellerman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).