public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH bpf-next 0/3] Enable struct_ops programs to be sleepable
@ 2023-01-23 23:22 David Vernet
  2023-01-23 23:22 ` [PATCH bpf-next 1/3] bpf: Allow BPF_PROG_TYPE_STRUCT_OPS " David Vernet
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: David Vernet @ 2023-01-23 23:22 UTC (permalink / raw)
  To: bpf
  Cc: ast, daniel, andrii, martin.lau, song, yhs, john.fastabend,
	kpsingh, sdf, haoluo, jolsa, linux-kernel, kernel-team, tj,
	memxor

BPF struct_ops programs currently cannot be marked as sleepable. This
need not be the case -- struct_ops programs could be sleepable, and e.g.
invoke kfuncs that export the KF_SLEEPABLE flag.

Enabling this is simple -- we just have to change a couple of lines in
the verifier. This patch set does that, then allows struct_ops backends
to validate the program being loaded to check if it's allowed to be
sleepable, and finally adds a testcase to validate all of this.

David Vernet (3):
  bpf: Allow BPF_PROG_TYPE_STRUCT_OPS programs to be sleepable
  bpf: Pass const struct bpf_prog * to .check_member
  bpf/selftests: Verify struct_ops prog sleepable behavior

 include/linux/bpf.h                           |  4 +-
 kernel/bpf/verifier.c                         |  7 +-
 net/bpf/bpf_dummy_struct_ops.c                | 18 ++++
 net/bpf/test_run.c                            |  6 ++
 net/ipv4/bpf_tcp_ca.c                         |  3 +-
 .../selftests/bpf/prog_tests/dummy_st_ops.c   | 85 +++++++++++++++++--
 .../selftests/bpf/progs/dummy_st_ops.c        | 11 +++
 7 files changed, 121 insertions(+), 13 deletions(-)

-- 
2.39.0


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

end of thread, other threads:[~2023-01-24 15:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-23 23:22 [PATCH bpf-next 0/3] Enable struct_ops programs to be sleepable David Vernet
2023-01-23 23:22 ` [PATCH bpf-next 1/3] bpf: Allow BPF_PROG_TYPE_STRUCT_OPS " David Vernet
2023-01-23 23:22 ` [PATCH bpf-next 2/3] bpf: Pass const struct bpf_prog * to .check_member David Vernet
2023-01-23 23:22 ` [PATCH bpf-next 3/3] bpf/selftests: Verify struct_ops prog sleepable behavior David Vernet
2023-01-24  5:32   ` Alexei Starovoitov
2023-01-24 15:09     ` David Vernet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox