bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH bpf 0/3] libbpf/selftests syscall wrapper fixes for RISC-V
@ 2023-10-04 11:09 Björn Töpel
  2023-10-04 11:09 ` [PATCH bpf 1/3] libbpf: Fix syscall access arguments on riscv Björn Töpel
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Björn Töpel @ 2023-10-04 11:09 UTC (permalink / raw)
  To: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
	Mykola Lysenko, bpf, netdev
  Cc: Björn Töpel, linux-kselftest, linux-kernel, Sami Tolvanen

From: Björn Töpel <bjorn@rivosinc.com>

Commit 08d0ce30e0e4 ("riscv: Implement syscall wrappers") introduced
some regressions in libbpf, and the kselftests BPF suite, which are
fixed with these three patches.

Note that there's an outstanding fix [1] for ftrace syscall tracing
which is also a fallout from the commit above.


Björn

[1] https://lore.kernel.org/linux-riscv/20231003182407.32198-1-alexghiti@rivosinc.com/

Alexandre Ghiti (1):
  libbpf: Fix syscall access arguments on riscv

Björn Töpel (2):
  selftests/bpf: Define SYS_PREFIX for riscv
  selftests/bpf: Define SYS_NANOSLEEP_KPROBE_NAME for riscv

 tools/lib/bpf/bpf_tracing.h                  | 2 --
 tools/testing/selftests/bpf/progs/bpf_misc.h | 3 +++
 tools/testing/selftests/bpf/test_progs.h     | 2 ++
 3 files changed, 5 insertions(+), 2 deletions(-)


base-commit: 9077fc228f09c9f975c498c55f5d2e882cd0da59
-- 
2.39.2


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

* [PATCH bpf 1/3] libbpf: Fix syscall access arguments on riscv
  2023-10-04 11:09 [PATCH bpf 0/3] libbpf/selftests syscall wrapper fixes for RISC-V Björn Töpel
@ 2023-10-04 11:09 ` Björn Töpel
  2023-10-04 11:09 ` [PATCH bpf 2/3] selftests/bpf: Define SYS_PREFIX for riscv Björn Töpel
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Björn Töpel @ 2023-10-04 11:09 UTC (permalink / raw)
  To: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
	Mykola Lysenko, bpf, netdev
  Cc: Alexandre Ghiti, linux-kselftest, linux-kernel, Sami Tolvanen

From: Alexandre Ghiti <alexghiti@rivosinc.com>

Since commit 08d0ce30e0e4 ("riscv: Implement syscall wrappers"), riscv
selects ARCH_HAS_SYSCALL_WRAPPER so let's use the generic implementation
of PT_REGS_SYSCALL_REGS().

Fixes: 08d0ce30e0e4 ("riscv: Implement syscall wrappers")
Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com>
---
 tools/lib/bpf/bpf_tracing.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/tools/lib/bpf/bpf_tracing.h b/tools/lib/bpf/bpf_tracing.h
index 3803479dbe10..1c13f8e88833 100644
--- a/tools/lib/bpf/bpf_tracing.h
+++ b/tools/lib/bpf/bpf_tracing.h
@@ -362,8 +362,6 @@ struct pt_regs___arm64 {
 #define __PT_PARM7_REG a6
 #define __PT_PARM8_REG a7
 
-/* riscv does not select ARCH_HAS_SYSCALL_WRAPPER. */
-#define PT_REGS_SYSCALL_REGS(ctx) ctx
 #define __PT_PARM1_SYSCALL_REG __PT_PARM1_REG
 #define __PT_PARM2_SYSCALL_REG __PT_PARM2_REG
 #define __PT_PARM3_SYSCALL_REG __PT_PARM3_REG
-- 
2.39.2


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

* [PATCH bpf 2/3] selftests/bpf: Define SYS_PREFIX for riscv
  2023-10-04 11:09 [PATCH bpf 0/3] libbpf/selftests syscall wrapper fixes for RISC-V Björn Töpel
  2023-10-04 11:09 ` [PATCH bpf 1/3] libbpf: Fix syscall access arguments on riscv Björn Töpel
@ 2023-10-04 11:09 ` Björn Töpel
  2023-10-04 11:09 ` [PATCH bpf 3/3] selftests/bpf: Define SYS_NANOSLEEP_KPROBE_NAME " Björn Töpel
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Björn Töpel @ 2023-10-04 11:09 UTC (permalink / raw)
  To: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
	Mykola Lysenko, bpf, netdev
  Cc: Björn Töpel, linux-kselftest, linux-kernel, Sami Tolvanen

From: Björn Töpel <bjorn@rivosinc.com>

SYS_PREFIX was missing for a RISC-V, which made a couple of kprobe
tests fail.

Add missing SYS_PREFIX for RISC-V.

Fixes: 08d0ce30e0e4 ("riscv: Implement syscall wrappers")
Signed-off-by: Björn Töpel <bjorn@rivosinc.com>
---
 tools/testing/selftests/bpf/progs/bpf_misc.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/testing/selftests/bpf/progs/bpf_misc.h b/tools/testing/selftests/bpf/progs/bpf_misc.h
index 38a57a2e70db..799fff4995d8 100644
--- a/tools/testing/selftests/bpf/progs/bpf_misc.h
+++ b/tools/testing/selftests/bpf/progs/bpf_misc.h
@@ -99,6 +99,9 @@
 #elif defined(__TARGET_ARCH_arm64)
 #define SYSCALL_WRAPPER 1
 #define SYS_PREFIX "__arm64_"
+#elif defined(__TARGET_ARCH_riscv)
+#define SYSCALL_WRAPPER 1
+#define SYS_PREFIX "__riscv_"
 #else
 #define SYSCALL_WRAPPER 0
 #define SYS_PREFIX "__se_"
-- 
2.39.2


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

* [PATCH bpf 3/3] selftests/bpf: Define SYS_NANOSLEEP_KPROBE_NAME for riscv
  2023-10-04 11:09 [PATCH bpf 0/3] libbpf/selftests syscall wrapper fixes for RISC-V Björn Töpel
  2023-10-04 11:09 ` [PATCH bpf 1/3] libbpf: Fix syscall access arguments on riscv Björn Töpel
  2023-10-04 11:09 ` [PATCH bpf 2/3] selftests/bpf: Define SYS_PREFIX for riscv Björn Töpel
@ 2023-10-04 11:09 ` Björn Töpel
  2023-10-04 16:52 ` [PATCH bpf 0/3] libbpf/selftests syscall wrapper fixes for RISC-V Sami Tolvanen
  2023-10-04 20:40 ` patchwork-bot+netdevbpf
  4 siblings, 0 replies; 6+ messages in thread
From: Björn Töpel @ 2023-10-04 11:09 UTC (permalink / raw)
  To: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
	Mykola Lysenko, bpf, netdev
  Cc: Björn Töpel, linux-kselftest, linux-kernel, Sami Tolvanen

From: Björn Töpel <bjorn@rivosinc.com>

Add missing sys_nanosleep name for RISC-V, which is used by some tests
(e.g. attach_probe).

Fixes: 08d0ce30e0e4 ("riscv: Implement syscall wrappers")
Signed-off-by: Björn Töpel <bjorn@rivosinc.com>
---
 tools/testing/selftests/bpf/test_progs.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/testing/selftests/bpf/test_progs.h b/tools/testing/selftests/bpf/test_progs.h
index 77bd492c6024..2f9f6f250f17 100644
--- a/tools/testing/selftests/bpf/test_progs.h
+++ b/tools/testing/selftests/bpf/test_progs.h
@@ -417,6 +417,8 @@ int get_bpf_max_tramp_links(void);
 #define SYS_NANOSLEEP_KPROBE_NAME "__s390x_sys_nanosleep"
 #elif defined(__aarch64__)
 #define SYS_NANOSLEEP_KPROBE_NAME "__arm64_sys_nanosleep"
+#elif defined(__riscv)
+#define SYS_NANOSLEEP_KPROBE_NAME "__riscv_sys_nanosleep"
 #else
 #define SYS_NANOSLEEP_KPROBE_NAME "sys_nanosleep"
 #endif
-- 
2.39.2


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

* Re: [PATCH bpf 0/3] libbpf/selftests syscall wrapper fixes for RISC-V
  2023-10-04 11:09 [PATCH bpf 0/3] libbpf/selftests syscall wrapper fixes for RISC-V Björn Töpel
                   ` (2 preceding siblings ...)
  2023-10-04 11:09 ` [PATCH bpf 3/3] selftests/bpf: Define SYS_NANOSLEEP_KPROBE_NAME " Björn Töpel
@ 2023-10-04 16:52 ` Sami Tolvanen
  2023-10-04 20:40 ` patchwork-bot+netdevbpf
  4 siblings, 0 replies; 6+ messages in thread
From: Sami Tolvanen @ 2023-10-04 16:52 UTC (permalink / raw)
  To: Björn Töpel
  Cc: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
	Mykola Lysenko, bpf, netdev, Björn Töpel,
	linux-kselftest, linux-kernel

Hi Björn,

On Wed, Oct 4, 2023 at 4:09 AM Björn Töpel <bjorn@kernel.org> wrote:
>
> From: Björn Töpel <bjorn@rivosinc.com>
>
> Commit 08d0ce30e0e4 ("riscv: Implement syscall wrappers") introduced
> some regressions in libbpf, and the kselftests BPF suite, which are
> fixed with these three patches.

This series looks good to me. Thanks for fixing the issues!

Reviewed-by: Sami Tolvanen <samitolvanen@google.com>

Sami

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

* Re: [PATCH bpf 0/3] libbpf/selftests syscall wrapper fixes for RISC-V
  2023-10-04 11:09 [PATCH bpf 0/3] libbpf/selftests syscall wrapper fixes for RISC-V Björn Töpel
                   ` (3 preceding siblings ...)
  2023-10-04 16:52 ` [PATCH bpf 0/3] libbpf/selftests syscall wrapper fixes for RISC-V Sami Tolvanen
@ 2023-10-04 20:40 ` patchwork-bot+netdevbpf
  4 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-10-04 20:40 UTC (permalink / raw)
  To: =?utf-8?b?QmrDtnJuIFTDtnBlbCA8Ympvcm5Aa2VybmVsLm9yZz4=?=
  Cc: ast, daniel, andrii, mykolal, bpf, netdev, bjorn,
	linux-kselftest, linux-kernel, samitolvanen

Hello:

This series was applied to bpf/bpf-next.git (master)
by Andrii Nakryiko <andrii@kernel.org>:

On Wed,  4 Oct 2023 13:09:02 +0200 you wrote:
> From: Björn Töpel <bjorn@rivosinc.com>
> 
> Commit 08d0ce30e0e4 ("riscv: Implement syscall wrappers") introduced
> some regressions in libbpf, and the kselftests BPF suite, which are
> fixed with these three patches.
> 
> Note that there's an outstanding fix [1] for ftrace syscall tracing
> which is also a fallout from the commit above.
> 
> [...]

Here is the summary with links:
  - [bpf,1/3] libbpf: Fix syscall access arguments on riscv
    https://git.kernel.org/bpf/bpf-next/c/8a412c5c1cd6
  - [bpf,2/3] selftests/bpf: Define SYS_PREFIX for riscv
    https://git.kernel.org/bpf/bpf-next/c/0f2692ee4324
  - [bpf,3/3] selftests/bpf: Define SYS_NANOSLEEP_KPROBE_NAME for riscv
    https://git.kernel.org/bpf/bpf-next/c/b55b775f0316

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] 6+ messages in thread

end of thread, other threads:[~2023-10-04 20:40 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-04 11:09 [PATCH bpf 0/3] libbpf/selftests syscall wrapper fixes for RISC-V Björn Töpel
2023-10-04 11:09 ` [PATCH bpf 1/3] libbpf: Fix syscall access arguments on riscv Björn Töpel
2023-10-04 11:09 ` [PATCH bpf 2/3] selftests/bpf: Define SYS_PREFIX for riscv Björn Töpel
2023-10-04 11:09 ` [PATCH bpf 3/3] selftests/bpf: Define SYS_NANOSLEEP_KPROBE_NAME " Björn Töpel
2023-10-04 16:52 ` [PATCH bpf 0/3] libbpf/selftests syscall wrapper fixes for RISC-V Sami Tolvanen
2023-10-04 20:40 ` 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).