On Thu, May 8, 2025 at 5:28 PM Song Liu <s...@kernel.org> wrote: > > On Thu, May 8, 2025 at 11:20 AM T.J. Mercier <tjmerc...@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 <tjmerc...@google.com> > > Acked-by: Song Liu <s...@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.
Added a leading /* (This is copied from task_iter.c, which currently has the same style.) > > + __u64 __opaque[1]; > > +} __aligned(8); > > + > > +/* Non-opaque version of bpf_iter_dmabuf */ > > +struct bpf_iter_dmabuf_kern { > > + struct dma_buf *dmabuf; > > +} __aligned(8); > > + > [...]