Re: [RFC v2 00/23] io_uring BPF requests

From: Song Liu
Date: Thu May 20 2021 - 20:36:23 EST




> On May 19, 2021, at 7:13 AM, Pavel Begunkov <asml.silence@xxxxxxxxx> wrote:
>
> The main problem solved is feeding completion information of other
> requests in a form of CQEs back into BPF. I decided to wire up support
> for multiple completion queues (aka CQs) and give BPF programs access to
> them, so leaving userspace in control over synchronisation that should
> be much more flexible that the link-based approach.
>
> For instance, there can be a separate CQ for each BPF program, so no
> extra sync is needed, and communication can be done by submitting a
> request targeting a neighboring CQ or submitting a CQE there directly
> (see test3 below). CQ is choosen by sqe->cq_idx, so everyone can
> cross-fire if willing.
>

[...]

> bpf: add IOURING program type
> io_uring: implement bpf prog registration
> io_uring: add support for bpf requests
> io_uring: enable BPF to submit SQEs
> io_uring: enable bpf to submit CQEs
> io_uring: enable bpf to reap CQEs
> libbpf: support io_uring
> io_uring: pass user_data to bpf executor
> bpf: Add bpf_copy_to_user() helper
> io_uring: wire bpf copy to user
> io_uring: don't wait on CQ exclusively
> io_uring: enable bpf reqs to wait for CQs

Besides the a few comments, these BPF related patches look sane to me.
Please consider add some selftests (tools/testing/selftests/bpf).

Thanks,
Song