linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH bpf-next] powerpc/bpf: Fix warning for unused ori31_emitted
@ 2025-06-19 14:26 Luis Gerhorst
  2025-06-19 14:35 ` Christophe Leroy
  2025-06-19 17:00 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Luis Gerhorst @ 2025-06-19 14:26 UTC (permalink / raw)
  To: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
	Martin KaFai Lau, Eduard Zingerman, Song Liu, Yonghong Song,
	John Fastabend, KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa,
	Hari Bathini, Christophe Leroy, Naveen N Rao, Madhavan Srinivasan,
	Michael Ellerman, Nicholas Piggin, Luis Gerhorst, bpf,
	linuxppc-dev, linux-kernel
  Cc: kernel test robot

Without this, the compiler (clang21) might emit a warning under W=1
because the variable ori31_emitted is set but never used if
CONFIG_PPC_BOOK3S_64=n.

Without this patch:

$ make -j $(nproc) W=1 ARCH=powerpc SHELL=/bin/bash arch/powerpc/net
  [...]
  CC      arch/powerpc/net/bpf_jit_comp.o
  CC      arch/powerpc/net/bpf_jit_comp64.o
../arch/powerpc/net/bpf_jit_comp64.c: In function 'bpf_jit_build_body':
../arch/powerpc/net/bpf_jit_comp64.c:417:28: warning: variable 'ori31_emitted' set but not used [-Wunused-but-set-variable]
  417 |         bool sync_emitted, ori31_emitted;
      |                            ^~~~~~~~~~~~~
  AR      arch/powerpc/net/built-in.a

With this patch:

  [...]
  CC      arch/powerpc/net/bpf_jit_comp.o
  CC      arch/powerpc/net/bpf_jit_comp64.o
  AR      arch/powerpc/net/built-in.a

Fixes: dff883d9e93a ("bpf, arm64, powerpc: Change nospec to include v1 barrier")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202506180402.uUXwVoSH-lkp@intel.com/
Signed-off-by: Luis Gerhorst <luis.gerhorst@fau.de>
---
 arch/powerpc/net/bpf_jit_comp64.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/arch/powerpc/net/bpf_jit_comp64.c b/arch/powerpc/net/bpf_jit_comp64.c
index 3665ff8bb4bc..a25a6ffe7d7c 100644
--- a/arch/powerpc/net/bpf_jit_comp64.c
+++ b/arch/powerpc/net/bpf_jit_comp64.c
@@ -820,13 +820,12 @@ int bpf_jit_build_body(struct bpf_prog *fp, u32 *image, u32 *fimage, struct code
 		case BPF_ST | BPF_NOSPEC:
 			sync_emitted = false;
 			ori31_emitted = false;
-#ifdef CONFIG_PPC_E500
-			if (!bpf_jit_bypass_spec_v1()) {
+			if (IS_ENABLED(CONFIG_PPC_E500) &&
+			    !bpf_jit_bypass_spec_v1()) {
 				EMIT(PPC_RAW_ISYNC());
 				EMIT(PPC_RAW_SYNC());
 				sync_emitted = true;
 			}
-#endif
 			if (!bpf_jit_bypass_spec_v4()) {
 				switch (stf_barrier) {
 				case STF_BARRIER_EIEIO:
@@ -849,10 +848,10 @@ int bpf_jit_build_body(struct bpf_prog *fp, u32 *image, u32 *fimage, struct code
 					break;
 				}
 			}
-#ifdef CONFIG_PPC_BOOK3S_64
-			if (!bpf_jit_bypass_spec_v1() && !ori31_emitted)
+			if (IS_ENABLED(CONFIG_PPC_BOOK3S_64) &&
+			    !bpf_jit_bypass_spec_v1() &&
+			    !ori31_emitted)
 				EMIT(PPC_RAW_ORI(_R31, _R31, 0));
-#endif
 			break;
 
 		/*

base-commit: cd7312a78f36e981939abe1cd1f21d355e083dfe
-- 
2.49.0


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

* Re: [PATCH bpf-next] powerpc/bpf: Fix warning for unused ori31_emitted
  2025-06-19 14:26 [PATCH bpf-next] powerpc/bpf: Fix warning for unused ori31_emitted Luis Gerhorst
@ 2025-06-19 14:35 ` Christophe Leroy
  2025-06-19 17:00 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Christophe Leroy @ 2025-06-19 14:35 UTC (permalink / raw)
  To: Luis Gerhorst, Alexei Starovoitov, Daniel Borkmann,
	Andrii Nakryiko, Martin KaFai Lau, Eduard Zingerman, Song Liu,
	Yonghong Song, John Fastabend, KP Singh, Stanislav Fomichev,
	Hao Luo, Jiri Olsa, Hari Bathini, Naveen N Rao,
	Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin, bpf,
	linuxppc-dev, linux-kernel
  Cc: kernel test robot



Le 19/06/2025 à 16:26, Luis Gerhorst a écrit :
> Without this, the compiler (clang21) might emit a warning under W=1
> because the variable ori31_emitted is set but never used if
> CONFIG_PPC_BOOK3S_64=n.
> 
> Without this patch:
> 
> $ make -j $(nproc) W=1 ARCH=powerpc SHELL=/bin/bash arch/powerpc/net
>    [...]
>    CC      arch/powerpc/net/bpf_jit_comp.o
>    CC      arch/powerpc/net/bpf_jit_comp64.o
> ../arch/powerpc/net/bpf_jit_comp64.c: In function 'bpf_jit_build_body':
> ../arch/powerpc/net/bpf_jit_comp64.c:417:28: warning: variable 'ori31_emitted' set but not used [-Wunused-but-set-variable]
>    417 |         bool sync_emitted, ori31_emitted;
>        |                            ^~~~~~~~~~~~~
>    AR      arch/powerpc/net/built-in.a
> 
> With this patch:
> 
>    [...]
>    CC      arch/powerpc/net/bpf_jit_comp.o
>    CC      arch/powerpc/net/bpf_jit_comp64.o
>    AR      arch/powerpc/net/built-in.a
> 
> Fixes: dff883d9e93a ("bpf, arm64, powerpc: Change nospec to include v1 barrier")
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202506180402.uUXwVoSH-lkp@intel.com/
> Signed-off-by: Luis Gerhorst <luis.gerhorst@fau.de>

Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>

> ---
>   arch/powerpc/net/bpf_jit_comp64.c | 11 +++++------
>   1 file changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/arch/powerpc/net/bpf_jit_comp64.c b/arch/powerpc/net/bpf_jit_comp64.c
> index 3665ff8bb4bc..a25a6ffe7d7c 100644
> --- a/arch/powerpc/net/bpf_jit_comp64.c
> +++ b/arch/powerpc/net/bpf_jit_comp64.c
> @@ -820,13 +820,12 @@ int bpf_jit_build_body(struct bpf_prog *fp, u32 *image, u32 *fimage, struct code
>   		case BPF_ST | BPF_NOSPEC:
>   			sync_emitted = false;
>   			ori31_emitted = false;
> -#ifdef CONFIG_PPC_E500
> -			if (!bpf_jit_bypass_spec_v1()) {
> +			if (IS_ENABLED(CONFIG_PPC_E500) &&
> +			    !bpf_jit_bypass_spec_v1()) {
>   				EMIT(PPC_RAW_ISYNC());
>   				EMIT(PPC_RAW_SYNC());
>   				sync_emitted = true;
>   			}
> -#endif
>   			if (!bpf_jit_bypass_spec_v4()) {
>   				switch (stf_barrier) {
>   				case STF_BARRIER_EIEIO:
> @@ -849,10 +848,10 @@ int bpf_jit_build_body(struct bpf_prog *fp, u32 *image, u32 *fimage, struct code
>   					break;
>   				}
>   			}
> -#ifdef CONFIG_PPC_BOOK3S_64
> -			if (!bpf_jit_bypass_spec_v1() && !ori31_emitted)
> +			if (IS_ENABLED(CONFIG_PPC_BOOK3S_64) &&
> +			    !bpf_jit_bypass_spec_v1() &&
> +			    !ori31_emitted)
>   				EMIT(PPC_RAW_ORI(_R31, _R31, 0));
> -#endif
>   			break;
>   
>   		/*
> 
> base-commit: cd7312a78f36e981939abe1cd1f21d355e083dfe


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

* Re: [PATCH bpf-next] powerpc/bpf: Fix warning for unused ori31_emitted
  2025-06-19 14:26 [PATCH bpf-next] powerpc/bpf: Fix warning for unused ori31_emitted Luis Gerhorst
  2025-06-19 14:35 ` Christophe Leroy
@ 2025-06-19 17:00 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-06-19 17:00 UTC (permalink / raw)
  To: Luis Gerhorst
  Cc: ast, daniel, andrii, martin.lau, eddyz87, song, yonghong.song,
	john.fastabend, kpsingh, sdf, haoluo, jolsa, hbathini,
	christophe.leroy, naveen, maddy, mpe, npiggin, bpf, linuxppc-dev,
	linux-kernel, lkp

Hello:

This patch was applied to bpf/bpf-next.git (master)
by Alexei Starovoitov <ast@kernel.org>:

On Thu, 19 Jun 2025 16:26:47 +0200 you wrote:
> Without this, the compiler (clang21) might emit a warning under W=1
> because the variable ori31_emitted is set but never used if
> CONFIG_PPC_BOOK3S_64=n.
> 
> Without this patch:
> 
> $ make -j $(nproc) W=1 ARCH=powerpc SHELL=/bin/bash arch/powerpc/net
>   [...]
>   CC      arch/powerpc/net/bpf_jit_comp.o
>   CC      arch/powerpc/net/bpf_jit_comp64.o
> ../arch/powerpc/net/bpf_jit_comp64.c: In function 'bpf_jit_build_body':
> ../arch/powerpc/net/bpf_jit_comp64.c:417:28: warning: variable 'ori31_emitted' set but not used [-Wunused-but-set-variable]
>   417 |         bool sync_emitted, ori31_emitted;
>       |                            ^~~~~~~~~~~~~
>   AR      arch/powerpc/net/built-in.a
> 
> [...]

Here is the summary with links:
  - [bpf-next] powerpc/bpf: Fix warning for unused ori31_emitted
    https://git.kernel.org/bpf/bpf-next/c/e30329b8a647

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2025-06-19 16:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-19 14:26 [PATCH bpf-next] powerpc/bpf: Fix warning for unused ori31_emitted Luis Gerhorst
2025-06-19 14:35 ` Christophe Leroy
2025-06-19 17:00 ` patchwork-bot+netdevbpf

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).