RFC nvme multipath eBPF path selector
Get series with b4
b4 am [email protected]Versions newest first
- v1 RFC Latest6 patches 6 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/6 | nvme-multipath: do not assign ->current_path in __nvme_find_path()drivers/ | +27 | 0 replies | |
| 2/6 | nvme: export nvme_find_get_subsystem()/nvme_put_subsystem()drivers/ drivers/ | +14 | 0 replies | |
| 3/6 | nvme: add per-namespace iopolicy sysfs attributedrivers/ drivers/ drivers/ | +22 | 0 replies | |
| 4/6 | nvme: add 'sector' parameter to nvme_find_path()drivers/ drivers/ drivers/ +2 more | +11 | 0 replies | |
| 5/6 | nvme-bpf: eBPF struct_ops path selectorsdrivers/ drivers/ drivers/ +5 more | +460 | 0 replies | |
| 6/6 | tools/testing/selftests: add sample nvme bpf path selectortools/ | +52 | 2 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [RFC PATCH 0/6] nvme multipath eBPF path selector
From: Hannes Reinecke <[email protected]>
Hi all,
there are discussion on having to deploy more complex I/O scheduling algorithms for NVMe, but then there's the question whether we really want to carry these in the kernel.
Which sounded like an ideal testbed for eBPF struct_ops to me. Taking a cue from Ming Lei's patchset for eBPF on ublk (thanks, Ming!) I've started messing around with eBPF.
So here's a patchset to implement nvme multipath eBPF path selectors. Idea's quite simple: the eBPF 'struct_ops' program is providing a 'select_path' function, which selects a nvme_ns struct to use for the I/O starting at a given sector.
Unfortunately ePBF doesn't allow to pass pointers, _and_ the definitions for 'struct nvme_ns_head' and 'struct nvme_ns' are internal to the nvme subsystem. So I kept those structures as opaque pointers for ePBF, and introduced a 'nvme_bpf_iter' structure as a path iterator. There are two functions 'nvme_bpf_first_path' and 'nvme_bpf_next_path' which can be used for an open-coded loop over all paths. I've also added sample code as an example how the loop can be coded.
It's all pretty rudimentary (as I'm sure people will need accessors to get to any namespace or controller details), but that's why I sent it out as an RFC. And I am by no means an eBPF expert, so I'd be glad for any corrections or suggestions for a better eBPF integration.
The entire patchset can be found at:
git.kernel.org:/pub/scm/linux/kernel/git/hare/scsi-devel.git branch nvme-bpf
As usual, reviews and comments are welcome.
Hannes Reinecke (6):
nvme-multipath: do not assign ->current_path in __nvme_find_path()
nvme: export nvme_find_get_subsystem()/nvme_put_subsystem()
nvme: add per-namespace iopolicy sysfs attribute
nvme: add 'sector' parameter to nvme_find_path()
nvme-bpf: eBPF struct_ops path selectors tools/testing/selftests: add sample nvme bpf path selector
drivers/nvme/host/Kconfig | 9 + drivers/nvme/host/Makefile | 1 + drivers/nvme/host/bpf.h | 33 ++ drivers/nvme/host/bpf_ops.c | 347 ++++++++++++++++++ drivers/nvme/host/core.c | 17 +- drivers/nvme/host/ioctl.c | 7 +- drivers/nvme/host/multipath.c | 69 +++- drivers/nvme/host/nvme.h | 11 +- drivers/nvme/host/pr.c | 2 +- drivers/nvme/host/sysfs.c | 9 +- include/linux/nvme-bpf.h | 54 +++ .../selftests/bpf/progs/bpf_nvme_simple.c | 52 +++ 12 files changed, 585 insertions(+), 26 deletions(-) create mode 100644 drivers/nvme/host/bpf.h create mode 100644 drivers/nvme/host/bpf_ops.c create mode 100644 include/linux/nvme-bpf.h create mode 100644 tools/testing/selftests/bpf/progs/bpf_nvme_simple.c
Signature · 1 line
2.43.0