Skip to contentSkip to conversation

riscv: Using TOOLCHAIN_HAS_ZIHINTPAUSE marco replace zihintpause

PATCH In review Minda Chen 3 participants 9 messages Aug 2, 2023

Subsystems (2)
lore
Share & tools
lore

Minda Chen

author
#0 lore raw

PATCH 1/1 riscv: Using TOOLCHAIN_HAS_ZIHINTPAUSE marco replace zihintpause

Actually it is a part of Conor's
commit aae538cd03bc ("riscv: fix detection of toolchain Zihintpause support").
It is looks like a merge issue. Samuel's
commit 0b1d60d6dd9e ("riscv: Fix build with CONFIG_CC_OPTIMIZE_FOR_SIZE=y") do not base on Conor's commit and revert to __riscv_zihintpause. So this patch can fix it.

---
 arch/riscv/include/asm/vdso/processor.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/riscv/include/asm/vdso/processor.h +1 -1
index 14f5d27783b8..96b65a5396df 100644
@@ -14,7 +14,7 @@ static inline void cpu_relax(void)
 	__asm__ __volatile__ ("div %0, %0, zero" : "=r" (dummy));
 #endif
 
-#ifdef __riscv_zihintpause
+#ifdef CONFIG_TOOLCHAIN_HAS_ZIHINTPAUSE
 	/*
 	 * Reduce instruction retirement.
 	 * This assumes the PC changes.
Signature · 1 line
2.17.1
Reviewed-by on v1 1/1
#1 lore raw

Hey Minda,

Quoted 4 lines · Minda Chen

Actually it is a part of Conor's
commit aae538cd03bc ("riscv: fix detection of toolchain Zihintpause support").
It is looks like a merge issue.

Yup, spot on.

Quoted 6 lines

Samuel's
commit 0b1d60d6dd9e ("riscv: Fix build with CONFIG_CC_OPTIMIZE_FOR_SIZE=y") do not base on Conor's commit and revert to __riscv_zihintpause. So this patch can fix it.

Did you actually manage to trigger this, or was this by inspection? clang-15 + binutils 2.35 was, IIRC, how we spotted this because that's what the clang-built-linux CI uses to test the LTS kernels from before LLVM's IAS was supported for RISC-V. Seemingly all that needs to be satisfied there is that zihintpause doesn't appear in -march so this has gone unnoticed.

Fixes 3c349eacc559 ("Merge patch "riscv: Fix build with CONFIG_CC_OPTIMIZE_FOR_SIZE=y"")

Thanks,
Conor.

Quoted 20 lines
---
 arch/riscv/include/asm/vdso/processor.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/riscv/include/asm/vdso/processor.h +1 -1
index 14f5d27783b8..96b65a5396df 100644
@@ -14,7 +14,7 @@ static inline void cpu_relax(void)
 	__asm__ __volatile__ ("div %0, %0, zero" : "=r" (dummy));
 #endif
 
-#ifdef __riscv_zihintpause
+#ifdef CONFIG_TOOLCHAIN_HAS_ZIHINTPAUSE
 	/*
 	 * Reduce instruction retirement.
 	 * This assumes the PC changes.
Signature · 1 line
2.17.1

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv

author
#2 lore raw
Quoted 24 lines · Conor Dooley

Hey Minda,

Quoted 4 lines · Minda Chen

Actually it is a part of Conor's
commit aae538cd03bc ("riscv: fix detection of toolchain Zihintpause support").
It is looks like a merge issue.

Yup, spot on.

Quoted 6 lines

Samuel's
commit 0b1d60d6dd9e ("riscv: Fix build with CONFIG_CC_OPTIMIZE_FOR_SIZE=y") do not base on Conor's commit and revert to __riscv_zihintpause. So this patch can fix it.

Did you actually manage to trigger this, or was this by inspection? clang-15 + binutils 2.35 was, IIRC, how we spotted this because that's what the clang-built-linux CI uses to test the LTS kernels from before LLVM's IAS was supported for RISC-V. Seemingly all that needs to be satisfied there is that zihintpause doesn't appear in -march so this has gone unnoticed.

Quoted 6 lines
Fixes 3c349eacc559 ("Merge patch "riscv: Fix build with CONFIG_CC_OPTIMIZE_FOR_SIZE=y"")

Thanks,
Conor.

Thanks, Conor. I found this just by inspection. I found a issue that vdso.so call cpu_relax cause application core dump in kernel 6.1.31. I need Samuel'patch to fix this. And I search the log of processor.h found this issue.

Quoted 20 lines
Quoted 20 lines
---
 arch/riscv/include/asm/vdso/processor.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/riscv/include/asm/vdso/processor.h +1 -1
index 14f5d27783b8..96b65a5396df 100644
@@ -14,7 +14,7 @@ static inline void cpu_relax(void)
 	__asm__ __volatile__ ("div %0, %0, zero" : "=r" (dummy));
 #endif
 
-#ifdef __riscv_zihintpause
+#ifdef CONFIG_TOOLCHAIN_HAS_ZIHINTPAUSE
 	/*
 	 * Reduce instruction retirement.
 	 * This assumes the PC changes.
Signature · 1 line
2.17.1
#3 lore raw
Quoted 30 lines · Minda Chen
Quoted 27 lines · Conor Dooley

Hey Minda,

Quoted 4 lines · Minda Chen

Actually it is a part of Conor's
commit aae538cd03bc ("riscv: fix detection of toolchain Zihintpause support").
It is looks like a merge issue.

Yup, spot on.

Quoted 6 lines

Samuel's
commit 0b1d60d6dd9e ("riscv: Fix build with CONFIG_CC_OPTIMIZE_FOR_SIZE=y") do not base on Conor's commit and revert to __riscv_zihintpause. So this patch can fix it.

Did you actually manage to trigger this, or was this by inspection? clang-15 + binutils 2.35 was, IIRC, how we spotted this because that's what the clang-built-linux CI uses to test the LTS kernels from before LLVM's IAS was supported for RISC-V. Seemingly all that needs to be satisfied there is that zihintpause doesn't appear in -march so this has gone unnoticed.

Fixes 3c349eacc559 ("Merge patch "riscv: Fix build with CONFIG_CC_OPTIMIZE_FOR_SIZE=y"")
Quoted 6 lines
Quoted 3 lines

Thanks,
Conor.

Thanks, Conor. I found this just by inspection. I found a issue that vdso.so call cpu_relax cause application core dump in kernel 6.1.31. I need Samuel'patch to fix this. And I search the log of processor.h found this issue.

That doesn't look like it is fixed in later stable kernels (we are at 6.1.42-rcN right now I think). It sounds we should ask Greg to backport 0b1d60d6dd9e ("riscv: Fix build with CONFIG_CC_OPTIMIZE_FOR_SIZE=y") to 6.1. Does that make sense to you?

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv

author
#4 lore raw
Quoted 34 lines · Conor Dooley
Quoted 33 lines · Minda Chen
Quoted 30 lines · Conor Dooley

Hey Minda,

Quoted 4 lines · Minda Chen

Actually it is a part of Conor's
commit aae538cd03bc ("riscv: fix detection of toolchain Zihintpause support").
It is looks like a merge issue.

Yup, spot on.

Quoted 6 lines

Samuel's
commit 0b1d60d6dd9e ("riscv: Fix build with CONFIG_CC_OPTIMIZE_FOR_SIZE=y") do not base on Conor's commit and revert to __riscv_zihintpause. So this patch can fix it.

Did you actually manage to trigger this, or was this by inspection? clang-15 + binutils 2.35 was, IIRC, how we spotted this because that's what the clang-built-linux CI uses to test the LTS kernels from before LLVM's IAS was supported for RISC-V. Seemingly all that needs to be satisfied there is that zihintpause doesn't appear in -march so this has gone unnoticed.

Fixes 3c349eacc559 ("Merge patch "riscv: Fix build with CONFIG_CC_OPTIMIZE_FOR_SIZE=y"")

Thanks,
Conor.

Quoted 8 lines
Quoted 3 lines

Thanks, Conor. I found this just by inspection. I found a issue that vdso.so call cpu_relax cause application core dump in kernel 6.1.31. I need Samuel'patch to fix this. And I search the log of processor.h found this issue.

That doesn't look like it is fixed in later stable kernels (we are at 6.1.42-rcN right now I think). It sounds we should ask Greg to backport 0b1d60d6dd9e ("riscv: Fix build with CONFIG_CC_OPTIMIZE_FOR_SIZE=y") to 6.1. Does that make sense to you?

Yes. 6.1 is lts kernel. Starfive will use this kernel for a long time. Thanks.

maintainer
#5 lore raw
Quoted 41 lines · Minda Chen
Quoted 38 lines · Conor Dooley
Quoted 36 lines · Minda Chen
Quoted 24 lines · Conor Dooley

Hey Minda,

Quoted 4 lines · Minda Chen

Actually it is a part of Conor's
commit aae538cd03bc ("riscv: fix detection of toolchain Zihintpause support").
It is looks like a merge issue.

Yup, spot on.

Quoted 6 lines

Samuel's
commit 0b1d60d6dd9e ("riscv: Fix build with CONFIG_CC_OPTIMIZE_FOR_SIZE=y") do not base on Conor's commit and revert to __riscv_zihintpause. So this patch can fix it.

Did you actually manage to trigger this, or was this by inspection? clang-15 + binutils 2.35 was, IIRC, how we spotted this because that's what the clang-built-linux CI uses to test the LTS kernels from before LLVM's IAS was supported for RISC-V. Seemingly all that needs to be satisfied there is that zihintpause doesn't appear in -march so this has gone unnoticed.

Quoted 6 lines
Fixes 3c349eacc559 ("Merge patch "riscv: Fix build with CONFIG_CC_OPTIMIZE_FOR_SIZE=y"")

Thanks,
Conor.

Thanks, Conor. I found this just by inspection. I found a issue that vdso.so call cpu_relax cause application core dump in kernel 6.1.31. I need Samuel'patch to fix this. And I search the log of processor.h found this issue.

Quoted 5 lines
Quoted 4 lines

That doesn't look like it is fixed in later stable kernels (we are at 6.1.42-rcN right now I think). It sounds we should ask Greg to backport 0b1d60d6dd9e ("riscv: Fix build with CONFIG_CC_OPTIMIZE_FOR_SIZE=y") to 6.1. Does that make sense to you?

Yes. 6.1 is lts kernel. Starfive will use this kernel for a long time. Thanks.

What is preventing you from moving to a newer kernel version? All of your kernel changes are already properly merged into Linus's tree, right?

thanks,

greg k-h

#6 lore raw
Quoted 46 lines · Greg KH
Quoted 45 lines · Minda Chen
Quoted 42 lines · Conor Dooley
Quoted 30 lines · Minda Chen
Quoted 27 lines · Conor Dooley

Hey Minda,

Quoted 4 lines · Minda Chen

Actually it is a part of Conor's
commit aae538cd03bc ("riscv: fix detection of toolchain Zihintpause support").
It is looks like a merge issue.

Yup, spot on.

Quoted 6 lines

Samuel's
commit 0b1d60d6dd9e ("riscv: Fix build with CONFIG_CC_OPTIMIZE_FOR_SIZE=y") do not base on Conor's commit and revert to __riscv_zihintpause. So this patch can fix it.

Did you actually manage to trigger this, or was this by inspection? clang-15 + binutils 2.35 was, IIRC, how we spotted this because that's what the clang-built-linux CI uses to test the LTS kernels from before LLVM's IAS was supported for RISC-V. Seemingly all that needs to be satisfied there is that zihintpause doesn't appear in -march so this has gone unnoticed.

Fixes 3c349eacc559 ("Merge patch "riscv: Fix build with CONFIG_CC_OPTIMIZE_FOR_SIZE=y"")
Quoted 6 lines
Quoted 3 lines

Thanks,
Conor.

Thanks, Conor. I found this just by inspection. I found a issue that vdso.so call cpu_relax cause application core dump in kernel 6.1.31. I need Samuel'patch to fix this. And I search the log of processor.h found this issue.

That doesn't look like it is fixed in later stable kernels (we are at 6.1.42-rcN right now I think). It sounds we should ask Greg to backport 0b1d60d6dd9e ("riscv: Fix build with CONFIG_CC_OPTIMIZE_FOR_SIZE=y") to 6.1. Does that make sense to you?

Quoted 5 lines
Quoted 1 line

Yes. 6.1 is lts kernel. Starfive will use this kernel for a long time. Thanks.

What is preventing you from moving to a newer kernel version? All of your kernel changes are already properly merged into Linus's tree, right?

Regardless of their reasons, "vdso.so call cpu_relax cause application core dump" is something that we should fix in stable kernels, no?

maintainer
#7 lore raw
Quoted 47 lines · Conor Dooley
Quoted 46 lines · Greg KH
Quoted 45 lines · Minda Chen
Quoted 42 lines · Conor Dooley
Quoted 30 lines · Minda Chen
Quoted 27 lines · Conor Dooley

Hey Minda,

Quoted 4 lines · Minda Chen

Actually it is a part of Conor's
commit aae538cd03bc ("riscv: fix detection of toolchain Zihintpause support").
It is looks like a merge issue.

Yup, spot on.

Quoted 6 lines

Samuel's
commit 0b1d60d6dd9e ("riscv: Fix build with CONFIG_CC_OPTIMIZE_FOR_SIZE=y") do not base on Conor's commit and revert to __riscv_zihintpause. So this patch can fix it.

Did you actually manage to trigger this, or was this by inspection? clang-15 + binutils 2.35 was, IIRC, how we spotted this because that's what the clang-built-linux CI uses to test the LTS kernels from before LLVM's IAS was supported for RISC-V. Seemingly all that needs to be satisfied there is that zihintpause doesn't appear in -march so this has gone unnoticed.

Fixes 3c349eacc559 ("Merge patch "riscv: Fix build with CONFIG_CC_OPTIMIZE_FOR_SIZE=y"")
Quoted 6 lines
Quoted 3 lines

Thanks,
Conor.

Thanks, Conor. I found this just by inspection. I found a issue that vdso.so call cpu_relax cause application core dump in kernel 6.1.31. I need Samuel'patch to fix this. And I search the log of processor.h found this issue.

That doesn't look like it is fixed in later stable kernels (we are at 6.1.42-rcN right now I think). It sounds we should ask Greg to backport 0b1d60d6dd9e ("riscv: Fix build with CONFIG_CC_OPTIMIZE_FOR_SIZE=y") to 6.1. Does that make sense to you?

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

Yes. 6.1 is lts kernel. Starfive will use this kernel for a long time. Thanks.

What is preventing you from moving to a newer kernel version? All of your kernel changes are already properly merged into Linus's tree, right?

Regardless of their reasons, "vdso.so call cpu_relax cause application core dump" is something that we should fix in stable kernels, no?

Yes.

#8 lore raw
Quoted 17 lines · Greg KH
Quoted 16 lines · Conor Dooley
Quoted 15 lines · Greg KH
Quoted 13 lines · Minda Chen
Quoted 11 lines · Conor Dooley
Quoted 5 lines · Minda Chen

On 2023/8/2 14:54, Conor Dooley wrote:

Thanks, Conor. I found this just by inspection. I found a issue that vdso.so call cpu_relax cause application core dump in kernel 6.1.31. I need Samuel'patch to fix this. And I search the log of processor.h found this issue.

That doesn't look like it is fixed in later stable kernels (we are at 6.1.42-rcN right now I think). It sounds we should ask Greg to backport 0b1d60d6dd9e ("riscv: Fix build with CONFIG_CC_OPTIMIZE_FOR_SIZE=y") to 6.1. Does that make sense to you?

Yes. 6.1 is lts kernel. Starfive will use this kernel for a long time. Thanks.

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

What is preventing you from moving to a newer kernel version? All of your kernel changes are already properly merged into Linus's tree, right?

Regardless of their reasons, "vdso.so call cpu_relax cause application core dump" is something that we should fix in stable kernels, no?

Yes.

It doesn't apply cleanly as a cherry-pick onto linux-6.1, so it'll need to be submitted. Maybe Minda can do that, since they've got an already tested version of the patch. Failing that, I will.