[PATCH bpf-next v4 3/5] bpf: Add open coded dmabuf iterator
Song Liu
song at kernel.org
Fri May 9 00:28:38 UTC 2025
On Thu, May 8, 2025 at 11:20 AM T.J. Mercier <tjmercier at google.com> wrote:
>
> This open coded iterator allows for more flexibility when creating BPF
> programs. It can support output in formats other than text. With an open
> coded iterator, a single BPF program can traverse multiple kernel data
> structures (now including dmabufs), allowing for more efficient analysis
> of kernel data compared to multiple reads from procfs, sysfs, or
> multiple traditional BPF iterator invocations.
>
> Signed-off-by: T.J. Mercier <tjmercier at google.com>
Acked-by: Song Liu <song at kernel.org>
With one nitpick below:
> ---
> kernel/bpf/dmabuf_iter.c | 47 ++++++++++++++++++++++++++++++++++++++++
> kernel/bpf/helpers.c | 5 +++++
> 2 files changed, 52 insertions(+)
>
> diff --git a/kernel/bpf/dmabuf_iter.c b/kernel/bpf/dmabuf_iter.c
> index 96b4ba7f0b2c..8049bdbc9efc 100644
> --- a/kernel/bpf/dmabuf_iter.c
> +++ b/kernel/bpf/dmabuf_iter.c
> @@ -100,3 +100,50 @@ static int __init dmabuf_iter_init(void)
> }
>
> late_initcall(dmabuf_iter_init);
> +
> +struct bpf_iter_dmabuf {
> + /* opaque iterator state; having __u64 here allows to preserve correct
> + * alignment requirements in vmlinux.h, generated from BTF
> + */
nit: comment style.
> + __u64 __opaque[1];
> +} __aligned(8);
> +
> +/* Non-opaque version of bpf_iter_dmabuf */
> +struct bpf_iter_dmabuf_kern {
> + struct dma_buf *dmabuf;
> +} __aligned(8);
> +
[...]
More information about the dri-devel
mailing list