Skip to content

extra io_uring BPF examples

Pavel Begunkov bpf io-uring 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 6 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3io_uring/selftests: add BPF'ed cp exampletools/testing/selftests/io_uring/Makefile tools/testing/selftests/io_uring/common-defs.h tools/testing/selftests/io_uring/cp.bpf.c +1 more+275 -10 replies
2/3io_uring/selftests: add rate limiter BPF programtools/testing/selftests/io_uring/Makefile tools/testing/selftests/io_uring/common-defs.h tools/testing/selftests/io_uring/helpers.h +2 more+279 -50 replies
3/3io_uring/selftests: add regbuf xor exampleio_uring/bpf-ops.c tools/testing/selftests/io_uring/Makefile tools/testing/selftests/io_uring/common-defs.h +2 more+150 -10 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/3] extra io_uring BPF examples

NOT FOR INCLUSION

Alexei asked for extra more realistic examples. This this series is based on top of v9 of the io_uring BPF series and implemented as selftests. There could be more, but I stopped with 3 that should give an idea how it'll be used:

1. A QD=1 file copy program that show cases state machine handling.

2. A BPF program rate-limiting the number of inflight io_uring request. That's a good example of what users asked for before but seemed to be too niche to be plumbed into the main io_uring path.

3. A toy example of how BPF can interact with registered buffers.

Pavel Begunkov (3):
io_uring/selftests: add BPF'ed cp example io_uring/selftests: add rate limiter BPF program io_uring/selftests: add regbuf xor example

 io_uring/bpf-ops.c                            |  29 +++
 tools/testing/selftests/io_uring/Makefile     |   2 +-
 .../testing/selftests/io_uring/common-defs.h  |  27 +++
 tools/testing/selftests/io_uring/cp.bpf.c     | 134 ++++++++++++++
 tools/testing/selftests/io_uring/cp.c         | 130 +++++++++++++
 tools/testing/selftests/io_uring/helpers.h    |  15 +-
 .../selftests/io_uring/rate_limiter.bpf.c     |  84 +++++++++
 .../testing/selftests/io_uring/rate_limiter.c | 172 ++++++++++++++++++
 tools/testing/selftests/io_uring/xor.bpf.c    |  31 ++++
 tools/testing/selftests/io_uring/xor.c        |  83 +++++++++
 10 files changed, 702 insertions(+), 5 deletions(-)
 create mode 100644 tools/testing/selftests/io_uring/cp.bpf.c
 create mode 100644 tools/testing/selftests/io_uring/cp.c
 create mode 100644 tools/testing/selftests/io_uring/rate_limiter.bpf.c
 create mode 100644 tools/testing/selftests/io_uring/rate_limiter.c
 create mode 100644 tools/testing/selftests/io_uring/xor.bpf.c
 create mode 100644 tools/testing/selftests/io_uring/xor.c
Signature · 1 line
2.52.0