BPF List
 help / color / mirror / Atom feed
* [PATCH bpf-next] libbpf: fix powerpc's stack register definition in bpf_tracing.h
@ 2025-10-20 20:36 Andrii Nakryiko
  2025-10-23 14:57 ` Naveen N Rao
  2025-10-23 18:30 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Andrii Nakryiko @ 2025-10-20 20:36 UTC (permalink / raw)
  To: bpf, ast, daniel, martin.lau; +Cc: andrii, kernel-team, Naveen N Rao

retsnoop's build on powerpc (ppc64le) architecture ([0]) failed due to
wrong definition of PT_REGS_SP() macro. Looking at powerpc's
implementation of stack unwinding in perf_callchain_user_64() clearly
shows that stack pointer register is gpr[1].

Fix libbpf's definition of __PT_SP_REG for powerpc to fix all this.

  [0] https://kojipkgs.fedoraproject.org/work/tasks/1544/137921544/build.log

Fixes: 138d6153a139 ("samples/bpf: Enable powerpc support")
Cc: Naveen N Rao <naveen@kernel.org>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
---
 tools/lib/bpf/bpf_tracing.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/lib/bpf/bpf_tracing.h b/tools/lib/bpf/bpf_tracing.h
index a8f6cd4841b0..dbe32a5d02cd 100644
--- a/tools/lib/bpf/bpf_tracing.h
+++ b/tools/lib/bpf/bpf_tracing.h
@@ -311,7 +311,7 @@ struct pt_regs___arm64 {
 #define __PT_RET_REG regs[31]
 #define __PT_FP_REG __unsupported__
 #define __PT_RC_REG gpr[3]
-#define __PT_SP_REG sp
+#define __PT_SP_REG gpr[1]
 #define __PT_IP_REG nip
 
 #elif defined(bpf_target_sparc)
-- 
2.47.3


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

* Re: [PATCH bpf-next] libbpf: fix powerpc's stack register definition in bpf_tracing.h
  2025-10-20 20:36 [PATCH bpf-next] libbpf: fix powerpc's stack register definition in bpf_tracing.h Andrii Nakryiko
@ 2025-10-23 14:57 ` Naveen N Rao
  2025-10-23 18:30 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Naveen N Rao @ 2025-10-23 14:57 UTC (permalink / raw)
  To: Andrii Nakryiko; +Cc: bpf, ast, daniel, martin.lau, kernel-team, Hari Bathini

On Mon, Oct 20, 2025 at 01:36:43PM -0700, Andrii Nakryiko wrote:
> retsnoop's build on powerpc (ppc64le) architecture ([0]) failed due to
> wrong definition of PT_REGS_SP() macro. Looking at powerpc's
> implementation of stack unwinding in perf_callchain_user_64() clearly
> shows that stack pointer register is gpr[1].
> 
> Fix libbpf's definition of __PT_SP_REG for powerpc to fix all this.
> 
>   [0] https://kojipkgs.fedoraproject.org/work/tasks/1544/137921544/build.log
> 
> Fixes: 138d6153a139 ("samples/bpf: Enable powerpc support")
> Cc: Naveen N Rao <naveen@kernel.org>
> Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
> ---
>  tools/lib/bpf/bpf_tracing.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/lib/bpf/bpf_tracing.h b/tools/lib/bpf/bpf_tracing.h
> index a8f6cd4841b0..dbe32a5d02cd 100644
> --- a/tools/lib/bpf/bpf_tracing.h
> +++ b/tools/lib/bpf/bpf_tracing.h
> @@ -311,7 +311,7 @@ struct pt_regs___arm64 {
>  #define __PT_RET_REG regs[31]
>  #define __PT_FP_REG __unsupported__
>  #define __PT_RC_REG gpr[3]
> -#define __PT_SP_REG sp
> +#define __PT_SP_REG gpr[1]
>  #define __PT_IP_REG nip

:facepalm:

Thanks for fixing this.
Reviewed-by: Naveen N Rao (AMD) <naveen@kernel.org>

- Naveen


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

* Re: [PATCH bpf-next] libbpf: fix powerpc's stack register definition in bpf_tracing.h
  2025-10-20 20:36 [PATCH bpf-next] libbpf: fix powerpc's stack register definition in bpf_tracing.h Andrii Nakryiko
  2025-10-23 14:57 ` Naveen N Rao
@ 2025-10-23 18:30 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-10-23 18:30 UTC (permalink / raw)
  To: Andrii Nakryiko; +Cc: bpf, ast, daniel, martin.lau, kernel-team, naveen

Hello:

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

On Mon, 20 Oct 2025 13:36:43 -0700 you wrote:
> retsnoop's build on powerpc (ppc64le) architecture ([0]) failed due to
> wrong definition of PT_REGS_SP() macro. Looking at powerpc's
> implementation of stack unwinding in perf_callchain_user_64() clearly
> shows that stack pointer register is gpr[1].
> 
> Fix libbpf's definition of __PT_SP_REG for powerpc to fix all this.
> 
> [...]

Here is the summary with links:
  - [bpf-next] libbpf: fix powerpc's stack register definition in bpf_tracing.h
    https://git.kernel.org/bpf/bpf/c/7221b9caf84b

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-10-23 18:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-20 20:36 [PATCH bpf-next] libbpf: fix powerpc's stack register definition in bpf_tracing.h Andrii Nakryiko
2025-10-23 14:57 ` Naveen N Rao
2025-10-23 18:30 ` 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