netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH bpf-next 0/3] Various BPF exception improvements
@ 2023-12-14 22:56 Daniel Xu
  2023-12-14 22:56 ` [PATCH bpf-next 1/3] bpf: xdp: Register generic_kfunc_set with XDP programs Daniel Xu
  2023-12-15  3:20 ` [PATCH bpf-next 0/3] Various BPF exception improvements patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Daniel Xu @ 2023-12-14 22:56 UTC (permalink / raw)
  To: linux-kernel, netdev, bpf, linux-kselftest, memxor

Two small improves to BPF exceptions in this patchset:

1. Allow throwing exceptions in XDP progs
2. Add some macros to help release references before throwing exceptions

Note the macros are intended to be temporary, at least until BPF
exception infra is able to automatically release acquired resources.

Daniel Xu (3):
  bpf: xdp: Register generic_kfunc_set with XDP programs
  bpf: selftests: Add bpf_assert_if() and bpf_assert_with_if() macros
  bpf: selftests: Test bpf_assert_if() and bpf_assert_with_if()

 kernel/bpf/helpers.c                          |  1 +
 .../testing/selftests/bpf/bpf_experimental.h  | 22 +++++++
 .../selftests/bpf/prog_tests/exceptions.c     |  5 ++
 .../testing/selftests/bpf/progs/exceptions.c  | 61 +++++++++++++++++++
 4 files changed, 89 insertions(+)

-- 
2.42.1


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

* [PATCH bpf-next 1/3] bpf: xdp: Register generic_kfunc_set with XDP programs
  2023-12-14 22:56 [PATCH bpf-next 0/3] Various BPF exception improvements Daniel Xu
@ 2023-12-14 22:56 ` Daniel Xu
  2023-12-15  3:20 ` [PATCH bpf-next 0/3] Various BPF exception improvements patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Daniel Xu @ 2023-12-14 22:56 UTC (permalink / raw)
  To: hawk, ast, daniel, kuba, john.fastabend, andrii, davem, memxor
  Cc: martin.lau, song, yonghong.song, kpsingh, sdf, haoluo, jolsa, bpf,
	linux-kernel, netdev

Registering generic_kfunc_set with XDP programs enables some of the
newer BPF features inside XDP -- namely tree based data structures and
BPF exceptions.

The current motivation for this commit is to enable assertions inside
XDP bpf progs. Assertions are a standard and useful tool to encode
intent.

Signed-off-by: Daniel Xu <dxu@dxuuu.xyz>
---
 kernel/bpf/helpers.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/kernel/bpf/helpers.c b/kernel/bpf/helpers.c
index b3be5742d6f1..b0b485126a76 100644
--- a/kernel/bpf/helpers.c
+++ b/kernel/bpf/helpers.c
@@ -2630,6 +2630,7 @@ static int __init kfunc_init(void)
 
 	ret = register_btf_kfunc_id_set(BPF_PROG_TYPE_TRACING, &generic_kfunc_set);
 	ret = ret ?: register_btf_kfunc_id_set(BPF_PROG_TYPE_SCHED_CLS, &generic_kfunc_set);
+	ret = ret ?: register_btf_kfunc_id_set(BPF_PROG_TYPE_XDP, &generic_kfunc_set);
 	ret = ret ?: register_btf_kfunc_id_set(BPF_PROG_TYPE_STRUCT_OPS, &generic_kfunc_set);
 	ret = ret ?: register_btf_id_dtor_kfuncs(generic_dtors,
 						  ARRAY_SIZE(generic_dtors),
-- 
2.42.1


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

* Re: [PATCH bpf-next 0/3] Various BPF exception improvements
  2023-12-14 22:56 [PATCH bpf-next 0/3] Various BPF exception improvements Daniel Xu
  2023-12-14 22:56 ` [PATCH bpf-next 1/3] bpf: xdp: Register generic_kfunc_set with XDP programs Daniel Xu
@ 2023-12-15  3:20 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-12-15  3:20 UTC (permalink / raw)
  To: Daniel Xu; +Cc: linux-kernel, netdev, bpf, linux-kselftest, memxor

Hello:

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

On Thu, 14 Dec 2023 15:56:24 -0700 you wrote:
> Two small improves to BPF exceptions in this patchset:
> 
> 1. Allow throwing exceptions in XDP progs
> 2. Add some macros to help release references before throwing exceptions
> 
> Note the macros are intended to be temporary, at least until BPF
> exception infra is able to automatically release acquired resources.
> 
> [...]

Here is the summary with links:
  - [bpf-next,1/3] bpf: xdp: Register generic_kfunc_set with XDP programs
    https://git.kernel.org/bpf/bpf-next/c/7489723c2e26
  - [bpf-next,2/3] bpf: selftests: Add bpf_assert_if() and bpf_assert_with_if() macros
    (no matching commit)
  - [bpf-next,3/3] bpf: selftests: Test bpf_assert_if() and bpf_assert_with_if()
    (no matching commit)

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:[~2023-12-15  3:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-14 22:56 [PATCH bpf-next 0/3] Various BPF exception improvements Daniel Xu
2023-12-14 22:56 ` [PATCH bpf-next 1/3] bpf: xdp: Register generic_kfunc_set with XDP programs Daniel Xu
2023-12-15  3:20 ` [PATCH bpf-next 0/3] Various BPF exception improvements 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).