[PATCH bpf-next v7 4/5] selftests/bpf: Add test for dmabuf_iter

2025-05-22 Thread T.J. Mercier
This test creates a udmabuf, and a dmabuf from the system dmabuf heap, and uses a BPF program that prints dmabuf metadata with the new dmabuf_iter to verify they can be found. Signed-off-by: T.J. Mercier Acked-by: Christian König Acked-by: Song Liu --- tools/testing/selftests/bpf/config

[PATCH bpf-next v7 5/5] selftests/bpf: Add test for open coded dmabuf_iter

2025-05-22 Thread T.J. Mercier
Use the same test buffers as the traditional iterator and a new BPF map to verify the test buffers can be found with the open coded dmabuf iterator. Signed-off-by: T.J. Mercier Acked-by: Christian König Acked-by: Song Liu --- .../testing/selftests/bpf/bpf_experimental.h | 5

[PATCH bpf-next v7 1/5] dma-buf: Rename debugfs symbols

2025-05-22 Thread T.J. Mercier
Rename the debugfs list and mutex so it's clear they are now usable without the need for CONFIG_DEBUG_FS. The list will always be populated to support the creation of a BPF iterator for dmabufs. Signed-off-by: T.J. Mercier Reviewed-by: Christian König Acked-by: Song Liu --- drivers/dm

[PATCH bpf-next v7 3/5] bpf: Add open coded dmabuf iterator

2025-05-22 Thread T.J. Mercier
data compared to multiple reads from procfs, sysfs, or multiple traditional BPF iterator invocations. Signed-off-by: T.J. Mercier Acked-by: Christian König Acked-by: Song Liu --- kernel/bpf/dmabuf_iter.c | 48 kernel/bpf/helpers.c | 5 + 2 files

[PATCH bpf-next v7 0/5] Replace CONFIG_DMABUF_SYSFS_STATS with BPF

2025-05-22 Thread T.J. Mercier
eorder sanitize_string bounds checks per Song Liu Add Song's Ack to: selftests/bpf: Add test for dmabuf_iter Rebase onto bpf-next/master per BPF CI T.J. Mercier (5): dma-buf: Rename debugfs symbols bpf: Add dmabuf iterator bpf: Add open coded dmabuf iterator selftests/bpf: Add tes

[PATCH bpf-next v7 2/5] bpf: Add dmabuf iterator

2025-05-22 Thread T.J. Mercier
. Signed-off-by: T.J. Mercier Reviewed-by: Christian König Acked-by: Song Liu --- drivers/dma-buf/dma-buf.c | 68 + include/linux/dma-buf.h | 2 + kernel/bpf/Makefile | 3 ++ kernel/bpf/dmabuf_iter.c | 102 ++ 4 files changed

Re: [PATCH 2/2] dmabuf/heaps: implement DMA_BUF_IOCTL_RW_FILE for system_heap

2025-05-20 Thread T.J. Mercier
On Mon, May 19, 2025 at 9:06 PM wangtao wrote: > > > > > -Original Message- > > From: wangtao > > Sent: Monday, May 19, 2025 8:04 PM > > To: 'T.J. Mercier' ; Christian König > > > > Cc: sumit.sem...@linaro.org; benjamin.

Re: [PATCH 2/2] dmabuf/heaps: implement DMA_BUF_IOCTL_RW_FILE for system_heap

2025-05-16 Thread T.J. Mercier
On Fri, May 16, 2025 at 1:36 AM Christian König wrote: > > On 5/16/25 09:40, wangtao wrote: > > > > > >> -Original Message- > >> From: Christian König > >> Sent: Thursday, May 15, 2025 10:26 PM > >> To: wangtao ; sumit.sem...@linaro.org; > >> benjamin.gaign...@collabora.com; brian.star...

Re: [PATCH bpf-next v6 5/5] selftests/bpf: Add test for open coded dmabuf_iter

2025-05-14 Thread T.J. Mercier
On Wed, May 14, 2025 at 2:00 PM Song Liu wrote: > > On Tue, May 13, 2025 at 9:36 AM T.J. Mercier wrote: > > > > Use the same test buffers as the traditional iterator and a new BPF map > > to verify the test buffers can be found with the open coded dmabuf > > iterat

Re: [PATCH bpf-next v6 4/5] selftests/bpf: Add test for dmabuf_iter

2025-05-14 Thread T.J. Mercier
On Wed, May 14, 2025 at 1:53 PM Song Liu wrote: > > On Tue, May 13, 2025 at 9:36 AM T.J. Mercier wrote: > > > > This test creates a udmabuf, and a dmabuf from the system dmabuf heap, > > and uses a BPF program that prints dmabuf metadata with the new > > dmabuf_it

[PATCH bpf-next v6 1/5] dma-buf: Rename debugfs symbols

2025-05-13 Thread T.J. Mercier
Rename the debugfs list and mutex so it's clear they are now usable without the need for CONFIG_DEBUG_FS. The list will always be populated to support the creation of a BPF iterator for dmabufs. Signed-off-by: T.J. Mercier Reviewed-by: Christian König Acked-by: Song Liu --- drivers/dm

[PATCH bpf-next v6 3/5] bpf: Add open coded dmabuf iterator

2025-05-13 Thread T.J. Mercier
data compared to multiple reads from procfs, sysfs, or multiple traditional BPF iterator invocations. Signed-off-by: T.J. Mercier Acked-by: Christian König Acked-by: Song Liu --- kernel/bpf/dmabuf_iter.c | 48 kernel/bpf/helpers.c | 5 + 2 files

[PATCH bpf-next v6 4/5] selftests/bpf: Add test for dmabuf_iter

2025-05-13 Thread T.J. Mercier
This test creates a udmabuf, and a dmabuf from the system dmabuf heap, and uses a BPF program that prints dmabuf metadata with the new dmabuf_iter to verify they can be found. Signed-off-by: T.J. Mercier Acked-by: Christian König --- tools/testing/selftests/bpf/config| 3

[PATCH bpf-next v6 2/5] bpf: Add dmabuf iterator

2025-05-13 Thread T.J. Mercier
. Signed-off-by: T.J. Mercier Reviewed-by: Christian König Acked-by: Song Liu --- drivers/dma-buf/dma-buf.c | 68 + include/linux/dma-buf.h | 2 + kernel/bpf/Makefile | 3 ++ kernel/bpf/dmabuf_iter.c | 102 ++ 4 files changed

[PATCH bpf-next v6 5/5] selftests/bpf: Add test for open coded dmabuf_iter

2025-05-13 Thread T.J. Mercier
Use the same test buffers as the traditional iterator and a new BPF map to verify the test buffers can be found with the open coded dmabuf iterator. Signed-off-by: T.J. Mercier Acked-by: Christian König Acked-by: Song Liu --- .../testing/selftests/bpf/bpf_experimental.h | 5

[PATCH bpf-next v6 0/5] Replace CONFIG_DMABUF_SYSFS_STATS with BPF

2025-05-13 Thread T.J. Mercier
Move map insertion from create_test_buffers() to test_dmabuf_iter() Add ACK to selftests/bpf: Add test for open coded dmabuf_iter T.J. Mercier (5): dma-buf: Rename debugfs symbols bpf: Add dmabuf iterator bpf: Add open coded dmabuf iterator selftests/bpf: Add test for dmabuf_iter selftests/bpf:

Re: [PATCH 1/2] dmabuf: add DMA_BUF_IOCTL_RW_FILE

2025-05-13 Thread T.J. Mercier
On Tue, May 13, 2025 at 4:31 AM Christian König wrote: > > On 5/13/25 11:27, wangtao wrote: > > Add DMA_BUF_IOCTL_RW_FILE to save/restore data from/to a dma-buf. > > Similar approach where rejected before in favor of using udmabuf. > > Is there any reason you can't use that approach as well? I al

Re: [PATCH bpf-next v5 5/5] selftests/bpf: Add test for open coded dmabuf_iter

2025-05-12 Thread T.J. Mercier
On Mon, May 12, 2025 at 1:30 PM Song Liu wrote: > > On Mon, May 12, 2025 at 10:41 AM T.J. Mercier wrote: > > > > Use the same test buffers as the traditional iterator and a new BPF map > > to verify the test buffers can be found with the open coded dmabuf > > iterat

Re: [PATCH bpf-next v5 4/5] selftests/bpf: Add test for dmabuf_iter

2025-05-12 Thread T.J. Mercier
On Mon, May 12, 2025 at 11:58 AM Song Liu wrote: > > On Mon, May 12, 2025 at 10:41 AM T.J. Mercier wrote: > [...] > > + > > +static int udmabuf; > > static int udmabuf = -1; > > > +static const char udmabuf_test_buffer_name[DMA_BUF_NAME_LEN] = > > &

[PATCH bpf-next v5 5/5] selftests/bpf: Add test for open coded dmabuf_iter

2025-05-12 Thread T.J. Mercier
Use the same test buffers as the traditional iterator and a new BPF map to verify the test buffers can be found with the open coded dmabuf iterator. Signed-off-by: T.J. Mercier Acked-by: Christian König --- .../testing/selftests/bpf/bpf_experimental.h | 5 +++ .../selftests/bpf/prog_tests

[PATCH bpf-next v5 4/5] selftests/bpf: Add test for dmabuf_iter

2025-05-12 Thread T.J. Mercier
This test creates a udmabuf, and a dmabuf from the system dmabuf heap, and uses a BPF program that prints dmabuf metadata with the new dmabuf_iter to verify they can be found. Signed-off-by: T.J. Mercier Acked-by: Christian König --- tools/testing/selftests/bpf/config| 3

[PATCH bpf-next v5 3/5] bpf: Add open coded dmabuf iterator

2025-05-12 Thread T.J. Mercier
data compared to multiple reads from procfs, sysfs, or multiple traditional BPF iterator invocations. Signed-off-by: T.J. Mercier Acked-by: Christian König Acked-by: Song Liu --- kernel/bpf/dmabuf_iter.c | 48 kernel/bpf/helpers.c | 5 + 2 files

[PATCH bpf-next v5 1/5] dma-buf: Rename debugfs symbols

2025-05-12 Thread T.J. Mercier
Rename the debugfs list and mutex so it's clear they are now usable without the need for CONFIG_DEBUG_FS. The list will always be populated to support the creation of a BPF iterator for dmabufs. Signed-off-by: T.J. Mercier Reviewed-by: Christian König Acked-by: Song Liu --- drivers/dm

[PATCH bpf-next v5 2/5] bpf: Add dmabuf iterator

2025-05-12 Thread T.J. Mercier
. Signed-off-by: T.J. Mercier Reviewed-by: Christian König Acked-by: Song Liu --- drivers/dma-buf/dma-buf.c | 68 + include/linux/dma-buf.h | 2 + kernel/bpf/Makefile | 3 ++ kernel/bpf/dmabuf_iter.c | 102 ++ 4 files changed

[PATCH bpf-next v5 0/5] Replace CONFIG_DMABUF_SYSFS_STATS with BPF

2025-05-12 Thread T.J. Mercier
ong Liu's Acks Move BTF_ID_LIST_SINGLE and DEFINE_BPF_ITER_FUNC closer to usage per Song Liu Fix open-coded iterator comment style per Song Liu Move iterator termination check to its own subtest per Song Liu Rework selftest buffer creation per Song Liu Fix spacing in sanitize_string per BPF

Re: [PATCH bpf-next v4 5/5] selftests/bpf: Add test for open coded dmabuf_iter

2025-05-09 Thread T.J. Mercier
On Fri, May 9, 2025 at 2:58 PM Song Liu wrote: > > On Fri, May 9, 2025 at 2:43 PM T.J. Mercier wrote: > > > [...] > > > > > > Personally, I would prefer we just merge all the logic of > > > create_udmabuf() and create_sys_heap_dmabuf() > > >

Re: [PATCH bpf-next v4 5/5] selftests/bpf: Add test for open coded dmabuf_iter

2025-05-09 Thread T.J. Mercier
On Fri, May 9, 2025 at 11:46 AM Song Liu wrote: > > On Thu, May 8, 2025 at 11:21 AM T.J. Mercier wrote: > > > > Use the same test buffers as the traditional iterator and a new BPF map > > to verify the test buffers can be found with the open coded dmabuf > > iter

Re: [PATCH bpf-next v4 4/5] selftests/bpf: Add test for dmabuf_iter

2025-05-09 Thread T.J. Mercier
On Thu, May 8, 2025 at 5:36 PM Song Liu wrote: > > On Thu, May 8, 2025 at 11:20 AM T.J. Mercier wrote: > [...] > > diff --git a/tools/testing/selftests/bpf/prog_tests/dmabuf_iter.c > > b/tools/testing/selftests/bpf/prog_tests/dmabuf_iter.c > > new file mode 10

Re: [PATCH bpf-next v4 3/5] bpf: Add open coded dmabuf iterator

2025-05-09 Thread T.J. Mercier
On Thu, May 8, 2025 at 5:28 PM Song Liu wrote: > > On Thu, May 8, 2025 at 11:20 AM T.J. Mercier 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 > >

Re: [PATCH bpf-next v4 2/5] bpf: Add dmabuf iterator

2025-05-09 Thread T.J. Mercier
On Thu, May 8, 2025 at 5:27 PM Song Liu wrote: > > On Thu, May 8, 2025 at 11:20 AM T.J. Mercier wrote: > > > > The dmabuf iterator traverses the list of all DMA buffers. > > > > DMA buffers are refcounted through their associated struct file. A > > reference

Re: [PATCH bpf-next v4 0/5] Replace CONFIG_DMABUF_SYSFS_STATS with BPF

2025-05-09 Thread T.J. Mercier
sc-next though, so I'll resend that as a standalone patch whenever I hear about the next longterm stable release. > > Regards, > Christian. > > On 5/8/25 20:20, T.J. Mercier wrote: > > Until CONFIG_DMABUF_SYSFS_STATS was added [1] it was only possible to > > perform p

[PATCH bpf-next v4 5/5] selftests/bpf: Add test for open coded dmabuf_iter

2025-05-08 Thread T.J. Mercier
Use the same test buffers as the traditional iterator and a new BPF map to verify the test buffers can be found with the open coded dmabuf iterator. Signed-off-by: T.J. Mercier --- .../testing/selftests/bpf/bpf_experimental.h | 5 ++ .../selftests/bpf/prog_tests/dmabuf_iter.c| 52

[PATCH bpf-next v4 1/5] dma-buf: Rename debugfs symbols

2025-05-08 Thread T.J. Mercier
Rename the debugfs list and mutex so it's clear they are now usable without the need for CONFIG_DEBUG_FS. The list will always be populated to support the creation of a BPF iterator for dmabufs. Signed-off-by: T.J. Mercier Reviewed-by: Christian König --- drivers/dma-buf/dma-buf.c

[PATCH bpf-next v4 4/5] selftests/bpf: Add test for dmabuf_iter

2025-05-08 Thread T.J. Mercier
This test creates a udmabuf, and a dmabuf from the system dmabuf heap, and uses a BPF program that prints dmabuf metadata with the new dmabuf_iter to verify they can be found. Signed-off-by: T.J. Mercier --- tools/testing/selftests/bpf/config| 3 + .../selftests/bpf/prog_tests

[PATCH bpf-next v4 3/5] bpf: Add open coded dmabuf iterator

2025-05-08 Thread T.J. Mercier
data compared to multiple reads from procfs, sysfs, or multiple traditional BPF iterator invocations. Signed-off-by: T.J. Mercier --- kernel/bpf/dmabuf_iter.c | 47 kernel/bpf/helpers.c | 5 + 2 files changed, 52 insertions(+) diff --git a/kernel

[PATCH bpf-next v4 2/5] bpf: Add dmabuf iterator

2025-05-08 Thread T.J. Mercier
. Signed-off-by: T.J. Mercier Reviewed-by: Christian König --- drivers/dma-buf/dma-buf.c | 68 + include/linux/dma-buf.h | 2 + kernel/bpf/Makefile | 3 ++ kernel/bpf/dmabuf_iter.c | 102 ++ 4 files changed, 175 insertions

[PATCH bpf-next v4 0/5] Replace CONFIG_DMABUF_SYSFS_STATS with BPF

2025-05-08 Thread T.J. Mercier
oitov Rename get_first_dmabuf / get_next_dmabuf to dma_buf_iter_begin / dma_buf_iter_next per Christian König Add Christian's RB to bpf: Add dmabuf iterator T.J. Mercier (5): dma-buf: Rename debugfs symbols bpf: Add dmabuf iterator bpf: Add open coded dmabuf iterator selftests/bpf: Add test fo

Re: [PATCH bpf-next v3 2/5] bpf: Add dmabuf iterator

2025-05-07 Thread T.J. Mercier
On Wed, May 7, 2025 at 7:14 AM Alexei Starovoitov wrote: > > On Tue, May 6, 2025 at 5:10 PM T.J. Mercier wrote: > > > > +/** > > + * get_first_dmabuf - begin iteration through global list of DMA-bufs > > + * > > + * Returns the first buffer in the global lis

Re: [PATCH bpf-next v3 2/5] bpf: Add dmabuf iterator

2025-05-07 Thread T.J. Mercier
On Wed, May 7, 2025 at 1:15 AM Christian König wrote: > > On 5/7/25 02:10, T.J. Mercier wrote: > > The dmabuf iterator traverses the list of all DMA buffers. > > > > DMA buffers are refcounted through their associated struct file. A > > reference is taken on each buf

[PATCH bpf-next v3 2/5] bpf: Add dmabuf iterator

2025-05-06 Thread T.J. Mercier
. Signed-off-by: T.J. Mercier --- drivers/dma-buf/dma-buf.c | 64 include/linux/dma-buf.h | 3 ++ kernel/bpf/Makefile | 3 ++ kernel/bpf/dmabuf_iter.c | 102 ++ 4 files changed, 172 insertions(+) create mode 100644 kernel/bpf

[PATCH bpf-next v3 3/5] bpf: Add open coded dmabuf iterator

2025-05-06 Thread T.J. Mercier
data compared to multiple reads from procfs, sysfs, or multiple traditional BPF iterator invocations. Signed-off-by: T.J. Mercier --- kernel/bpf/dmabuf_iter.c | 47 kernel/bpf/helpers.c | 5 + 2 files changed, 52 insertions(+) diff --git a/kernel

[PATCH bpf-next v3 5/5] selftests/bpf: Add test for open coded dmabuf_iter

2025-05-06 Thread T.J. Mercier
Use the same test buffers as the traditional iterator and a new BPF map to verify the test buffers can be found with the open coded dmabuf iterator. Signed-off-by: T.J. Mercier --- .../testing/selftests/bpf/bpf_experimental.h | 5 ++ .../selftests/bpf/prog_tests/dmabuf_iter.c| 52

[PATCH bpf-next v3 0/5] Replace CONFIG_DMABUF_SYSFS_STATS with BPF

2025-05-06 Thread T.J. Mercier
to dma-buf: Rename debugfs symbols Drop RFC: dma-buf: Remove DMA-BUF statistics T.J. Mercier (5): dma-buf: Rename debugfs symbols bpf: Add dmabuf iterator bpf: Add open coded dmabuf iterator selftests/bpf: Add test for dmabuf_iter selftests/bpf: Add test for open coded dmabuf_iter

[PATCH bpf-next v3 4/5] selftests/bpf: Add test for dmabuf_iter

2025-05-06 Thread T.J. Mercier
This test creates a udmabuf, and a dmabuf from the system dmabuf heap, and uses a BPF program that prints dmabuf metadata with the new dmabuf_iter to verify they can be found. Signed-off-by: T.J. Mercier --- tools/testing/selftests/bpf/config| 3 + .../selftests/bpf/prog_tests

[PATCH bpf-next v3 1/5] dma-buf: Rename debugfs symbols

2025-05-06 Thread T.J. Mercier
Rename the debugfs list and mutex so it's clear they are now usable without the need for CONFIG_DEBUG_FS. The list will always be populated to support the creation of a BPF iterator for dmabufs. Signed-off-by: T.J. Mercier Reviewed-by: Christian König --- drivers/dma-buf/dma-buf.c

Re: [PATCH v2 2/6] bpf: Add dmabuf iterator

2025-05-05 Thread T.J. Mercier
On Mon, May 5, 2025 at 9:56 AM Christian König wrote: > > On 5/5/25 18:33, T.J. Mercier wrote: > > On Mon, May 5, 2025 at 4:17 AM Christian König > > wrote: > >> > >> On 5/5/25 00:41, T.J. Mercier wrote: > >>> The dmabuf iterator traverses the

Re: [PATCH v2 2/6] bpf: Add dmabuf iterator

2025-05-05 Thread T.J. Mercier
On Mon, May 5, 2025 at 4:17 AM Christian König wrote: > > On 5/5/25 00:41, T.J. Mercier wrote: > > The dmabuf iterator traverses the list of all DMA buffers. > > > > DMA buffers are refcounted through their associated struct file. A > > reference is taken on each buf

[RFC PATCH v2 6/6] RFC: dma-buf: Remove DMA-BUF statistics

2025-05-04 Thread T.J. Mercier
(6.18?) before actually removing it so that we can have one longterm stable kernel version that supports both options to facilitate a transition from the sysfs files to a BPF program. Signed-off-by: T.J. Mercier --- .../ABI/testing/sysfs-kernel-dmabuf-buffers | 24 --- Documentation/driver-ap

[PATCH v2 2/6] bpf: Add dmabuf iterator

2025-05-04 Thread T.J. Mercier
. Signed-off-by: T.J. Mercier --- kernel/bpf/Makefile | 3 + kernel/bpf/dmabuf_iter.c | 134 +++ 2 files changed, 137 insertions(+) create mode 100644 kernel/bpf/dmabuf_iter.c diff --git a/kernel/bpf/Makefile b/kernel/bpf/Makefile index 70502f038b92

[PATCH v2 5/6] selftests/bpf: Add test for open coded dmabuf_iter

2025-05-04 Thread T.J. Mercier
Use the same test buffers as the traditional iterator and a new BPF map to verify the test buffers can be found with the open coded dmabuf iterator. Signed-off-by: T.J. Mercier --- .../testing/selftests/bpf/bpf_experimental.h | 5 ++ .../selftests/bpf/prog_tests/dmabuf_iter.c| 52

[PATCH v2 4/6] selftests/bpf: Add test for dmabuf_iter

2025-05-04 Thread T.J. Mercier
This test creates a udmabuf, and a dmabuf from the system dmabuf heap, and uses a BPF program that prints dmabuf metadata with the new dmabuf_iter to verify they can be found. Signed-off-by: T.J. Mercier --- tools/testing/selftests/bpf/config| 3 + .../selftests/bpf/prog_tests

[PATCH v2 3/6] bpf: Add open coded dmabuf iterator

2025-05-04 Thread T.J. Mercier
data compared to multiple reads from procfs, sysfs, or multiple traditional BPF iterator invocations. Signed-off-by: T.J. Mercier --- kernel/bpf/dmabuf_iter.c | 43 kernel/bpf/helpers.c | 5 + 2 files changed, 48 insertions(+) diff --git a/kernel

[PATCH v2 1/6] dma-buf: Rename and expose debugfs symbols

2025-05-04 Thread T.J. Mercier
Expose the debugfs list and mutex so they are usable for the creation of a BPF iterator for dmabufs without the need for CONFIG_DEBUG_FS. Rename the symbols so it's clear debugfs is not required, and that the list contains dmabufs and not some other type. Signed-off-by: T.J. Mercier --- v2:

[PATCH v2 0/6] Replace CONFIG_DMABUF_SYSFS_STATS with BPF

2025-05-04 Thread T.J. Mercier
n for selftest per Alexei Starovoitov https://r.android.com/c/platform/system/bpfprogs/+/3616123/2/dmabufIter.c https://r.android.com/c/platform/system/memory/libmeminfo/+/3614259/1/libdmabufinfo/dmabuf_bpf_stats.cpp T.J. Mercier (6): dma-buf: Rename and expose debugfs symbols bpf: Add dmabuf i

Re: [PATCH] dma-buf: system_heap: No separate allocation for attachment sg_tables

2025-04-29 Thread T.J. Mercier
On Tue, Apr 22, 2025 at 9:17 AM T.J. Mercier wrote: > > On Tue, Apr 22, 2025 at 1:24 AM Christian König > wrote: > > > > Am 17.04.25 um 20:09 schrieb T.J. Mercier: > > > struct dma_heap_attachment is a separate allocation from the struct > > > sg_table

Re: [PATCH 2/4] bpf: Add dmabuf iterator

2025-04-23 Thread T.J. Mercier
On Tue, Apr 22, 2025 at 4:01 PM Alexei Starovoitov wrote: > > On Tue, Apr 22, 2025 at 12:57 PM T.J. Mercier wrote: > > > > On Mon, Apr 21, 2025 at 4:39 PM Alexei Starovoitov > > wrote: > > > > > > On Mon, Apr 21, 2025 at 1:40 PM T.J. Mercier wrote

Re: [PATCH 2/4] bpf: Add dmabuf iterator

2025-04-22 Thread T.J. Mercier
On Mon, Apr 21, 2025 at 4:39 PM Alexei Starovoitov wrote: > > On Mon, Apr 21, 2025 at 1:40 PM T.J. Mercier wrote: > > > > > > new file mode 100644 > > > > index ..b4b8be1d6aa4 > > > > --- /dev/null > > > > +++ b/kernel/bp

Re: [PATCH] dma-buf: system_heap: No separate allocation for attachment sg_tables

2025-04-22 Thread T.J. Mercier
On Tue, Apr 22, 2025 at 1:24 AM Christian König wrote: > > Am 17.04.25 um 20:09 schrieb T.J. Mercier: > > struct dma_heap_attachment is a separate allocation from the struct > > sg_table it contains, but there is no reason for this. Let's use the > > slab allocator j

Re: [PATCH 2/4] bpf: Add dmabuf iterator

2025-04-21 Thread T.J. Mercier
On Mon, Apr 21, 2025 at 10:58 AM Song Liu wrote: > > On Mon, Apr 14, 2025 at 3:53 PM T.J. Mercier wrote: > > > > The dmabuf iterator traverses the list of all DMA buffers. The list is > > maintained only when CONFIG_DEBUG_FS is enabled. > > > > DMA buffers are

Re: [PATCH 2/4] bpf: Add dmabuf iterator

2025-04-18 Thread T.J. Mercier
On Thu, Apr 17, 2025 at 1:26 PM Song Liu wrote: > > On Thu, Apr 17, 2025 at 9:05 AM T.J. Mercier wrote: > > > > On Wed, Apr 16, 2025 at 9:56 PM Song Liu wrote: > > > > > > On Wed, Apr 16, 2025 at 7:09 PM T.J. Mercier wrote: > > > > > &g

[PATCH] dma-buf: system_heap: No separate allocation for attachment sg_tables

2025-04-17 Thread T.J. Mercier
struct dma_heap_attachment is a separate allocation from the struct sg_table it contains, but there is no reason for this. Let's use the slab allocator just once instead of twice for dma_heap_attachment. Signed-off-by: T.J. Mercier --- drivers/dma-buf/heaps/system_heap.c

Re: [PATCH 2/4] bpf: Add dmabuf iterator

2025-04-17 Thread T.J. Mercier
On Wed, Apr 16, 2025 at 9:56 PM Song Liu wrote: > > On Wed, Apr 16, 2025 at 7:09 PM T.J. Mercier wrote: > > > > On Wed, Apr 16, 2025 at 6:26 PM Song Liu wrote: > [...] > > > > > > Here is another rookie question, it appears to me there is a file > >

Re: [PATCH 2/4] bpf: Add dmabuf iterator

2025-04-16 Thread T.J. Mercier
On Wed, Apr 16, 2025 at 6:26 PM Song Liu wrote: > > On Wed, Apr 16, 2025 at 4:40 PM T.J. Mercier wrote: > > > > On Wed, Apr 16, 2025 at 4:08 PM Song Liu wrote: > > > > > > On Wed, Apr 16, 2025 at 3:51 PM T.J. Mercier wrote: > > > [...] > >

Re: [PATCH 2/4] bpf: Add dmabuf iterator

2025-04-16 Thread T.J. Mercier
On Wed, Apr 16, 2025 at 4:08 PM Song Liu wrote: > > On Wed, Apr 16, 2025 at 3:51 PM T.J. Mercier wrote: > [...] > > > > > > IIUC, the iterator simply traverses elements in a linked list. I feel it > > > is > > > an overkill to implement a ne

Re: [PATCH 2/4] bpf: Add dmabuf iterator

2025-04-16 Thread T.J. Mercier
On Wed, Apr 16, 2025 at 3:02 PM Song Liu wrote: > > On Mon, Apr 14, 2025 at 3:53 PM T.J. Mercier wrote: > [...] > > + > > +BTF_ID_LIST_GLOBAL_SINGLE(bpf_dmabuf_btf_id, struct, dma_buf) > > +DEFINE_BPF_ITER_FUNC(dmabuf, struct bpf_iter_meta *meta, struct dma_buf >

Re: [PATCH 2/4] bpf: Add dmabuf iterator

2025-04-16 Thread T.J. Mercier
On Tue, Apr 15, 2025 at 9:43 PM kernel test robot wrote: > > Hi Mercier, > > kernel test robot noticed the following build errors: > > [auto build test ERROR on bpf-next/net] > [also build test ERROR on bpf-next/master bpf/master linus/master v6.15-rc2 > next-20250415] > [If your patch is applied

Re: [PATCH] dma-buf: heaps: Set allocation orders for larger page sizes

2025-04-15 Thread T.J. Mercier
ng up the extra space on line 321 too? @@ -318,7 +318,7 @@ static struct page *alloc_largest_available(unsigned long size, int i; for (i = 0; i < NUM_ORDERS; i++) { - if (size < (PAGE_SIZE << orders[i])) + if (size < (PAGE_SIZE <<

[RFC PATCH 4/4] RFC: dma-buf: Remove DMA-BUF statistics

2025-04-14 Thread T.J. Mercier
(6.18?) before actually removing it so that we can have one kernel version that supports both options to facilitate a transition from the sysfs files to a BPF program. Signed-off-by: T.J. Mercier --- .../ABI/testing/sysfs-kernel-dmabuf-buffers | 24 --- Documentation/driver-api/dma-bu

[PATCH 3/4] selftests/bpf: Add test for dmabuf_iter

2025-04-14 Thread T.J. Mercier
This test creates a udmabuf and uses a BPF program that prints dmabuf metadata with the new dmabuf_iter to verify it can be found. Signed-off-by: T.J. Mercier --- tools/testing/selftests/bpf/config| 1 + .../selftests/bpf/prog_tests/dmabuf_iter.c| 116

[PATCH 1/4] dma-buf: Rename and expose debugfs symbols

2025-04-14 Thread T.J. Mercier
Expose the debugfs list and mutex so they are usable for the creation of a BPF iterator for dmabufs. Rename the symbols so it's clear they contain dmabufs and not some other type. Signed-off-by: T.J. Mercier --- drivers/dma-buf/dma-buf.c | 22 +++--- include/linux/dma-

[PATCH 2/4] bpf: Add dmabuf iterator

2025-04-14 Thread T.J. Mercier
the bpf program execution without holding the list mutex. Signed-off-by: T.J. Mercier --- include/linux/btf_ids.h | 1 + kernel/bpf/Makefile | 3 + kernel/bpf/dmabuf_iter.c | 130 +++ 3 files changed, 134 insertions(+) create mode 100644 kernel/bpf

[PATCH 0/4] Replace CONFIG_DMABUF_SYSFS_STATS with BPF

2025-04-14 Thread T.J. Mercier
, the last patch is a RFC for removing it from the kernel. Please see my suggestion there regarding the timeline for that. [1] https://lore.kernel.org/linux-media/20201210044400.1080308-1-hri...@google.com/ [2] https://lore.kernel.org/all/20220516171315.2400578-1-tjmerc...@google.com/ T.J. Mercier

Re: [PATCH v3 2/2] dma-buf: heaps: Introduce a new heap for reserved memory

2025-04-11 Thread T.J. Mercier
On Mon, Apr 7, 2025 at 9:29 AM Maxime Ripard wrote: > > Some reserved memory regions might have particular memory setup or > attributes that make them good candidates for heaps. > > Let's provide a heap type that will create a new heap for each reserved > memory region flagged as such. > > Signed-

Re: [PATCH RFC 00/12] dma: Enable dmem cgroup tracking

2025-04-07 Thread T.J. Mercier
On Mon, Apr 7, 2025 at 4:46 AM Christian König wrote: > > Am 05.04.25 um 03:57 schrieb T.J. Mercier: > > On Fri, Apr 4, 2025 at 1:47 AM Christian König > > wrote: > >> Hi Maxime, > >> > >> Am 03.04.25 um 17:47 schrieb Maxime Ripard: > >>

Re: [PATCH RFC 00/12] dma: Enable dmem cgroup tracking

2025-04-04 Thread T.J. Mercier
On Fri, Apr 4, 2025 at 1:47 AM Christian König wrote: > > Hi Maxime, > > Am 03.04.25 um 17:47 schrieb Maxime Ripard: > > On Thu, Apr 03, 2025 at 09:39:52AM +0200, Christian König wrote: > >>> For the UMA GPU case where there is no device memory or eviction > >>> problem, perhaps a configurable opt

Re: [PATCH] dma-buf: Replace nested max() with single max3()

2025-03-16 Thread T.J. Mercier
On Fri, Mar 14, 2025 at 10:02 PM wrote: > > From: FengWei > > Use max3() macro instead of nesting max() to simplify the return > statement. > > Signed-off-by: FengWei The commit subject should include "dma-buf: heaps:" as a prefix. With that: Reviewed-by: T.J.

Re: [PATCH v3] Documentation: dma-buf: heaps: Add heap name definitions

2025-03-04 Thread T.J. Mercier
a specific allocator. The Linux kernel currently supports > the "represents" > +following heaps: > + > + - The ``system`` heap allocates virtually contiguous, cacheable, buffers Period at the end? This description is my understanding of the current state of things, so: Reviewed-by: T.J. Mercier

Re: [PATCH] dma-buf: Fix __dma_buf_debugfs_list_del argument for !CONFIG_DEBUG_FS

2024-11-18 Thread T.J. Mercier
On Mon, Nov 18, 2024 at 1:15 AM Tvrtko Ursulin wrote: > > > On 17/11/2024 17:03, T.J. Mercier wrote: > > The arguments for __dma_buf_debugfs_list_del do not match for both the > > CONFIG_DEBUG_FS case and the !CONFIG_DEBUG_FS case. The !CONFIG_DEBUG_FS > > case should t

[PATCH] dma-buf: Fix __dma_buf_debugfs_list_del argument for !CONFIG_DEBUG_FS

2024-11-17 Thread T.J. Mercier
fs related code when !CONFIG_DEBUG_FS") Signed-off-by: T.J. Mercier --- drivers/dma-buf/dma-buf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c index 8892bc701a66..afb8c1c50107 100644 --- a/drivers/dma-buf/dma-buf.c ++

Re: [PATCH] Documentation: dma-buf: heaps: Add heap name definitions

2024-10-23 Thread T.J. Mercier
On Mon, Oct 21, 2024 at 9:30 AM Maxime Ripard wrote: > > Hi TJ, > > Thanks for your review > > On Tue, Oct 01, 2024 at 11:03:41PM +0200, T.J. Mercier wrote: > > On Mon, Sep 30, 2024 at 4:41 PM Maxime Ripard wrote: > > > > > > Following a recent discu

Re: [PATCH 2/3] dma-buf/heaps: replace kmap_atomic with kmap_local_page

2024-10-01 Thread T.J. Mercier
word: 'by' > +* has been killed by by SIGKILL > > total: 0 errors, 3 warnings, 405 lines checked > > Signed-off-by: Pintu Kumar Reviewed-by: T.J. Mercier The Android kernels have been doing this for over a year, so should be pretty well tested at

Re: [PATCH] Documentation: dma-buf: heaps: Add heap name definitions

2024-10-01 Thread T.J. Mercier
Gaignard > Cc: Brian Starkey > Cc: John Stultz > Cc: "T.J. Mercier" > Cc: "Christian König" > Cc: dri-devel@lists.freedesktop.org > Cc: linaro-mm-...@lists.linaro.org > Cc: linux-me...@vger.kernel.org > Cc: linux-...@vger.kernel.org > --- &g

Re: [RFC PATCH 4/4] dma-buf: heaps: add Linaro restricted dmabuf heap support

2024-09-10 Thread T.J. Mercier
On Mon, Sep 9, 2024 at 11:06 PM Jens Wiklander wrote: > > On Wed, Sep 4, 2024 at 11:42 PM T.J. Mercier wrote: > > > > On Wed, Sep 4, 2024 at 2:44 AM Jens Wiklander > > wrote: > > > > > > On Tue, Sep 3, 2024 at 7:50 PM T.J. Mercier wrote: > > &

Re: [PATCH] drm/syncobj: Fix syncobj leak in drm_syncobj_eventfd_ioctl

2024-09-10 Thread T.J. Mercier
On Tue, Sep 10, 2024 at 12:30 AM Christian König wrote: > > Am 10.09.24 um 09:26 schrieb Tvrtko Ursulin: > > > > On 09/09/2024 21:53, T.J. Mercier wrote: > >> A syncobj reference is taken in drm_syncobj_find, but not released if > >> eventfd_ctx_fdget or kzall

[PATCH] drm/syncobj: Fix syncobj leak in drm_syncobj_eventfd_ioctl

2024-09-09 Thread T.J. Mercier
A syncobj reference is taken in drm_syncobj_find, but not released if eventfd_ctx_fdget or kzalloc fails. Put the reference in these error paths. Reported-by: Xingyu Jin Fixes: c7a472297169 ("drm/syncobj: add IOCTL to register an eventfd") Signed-off-by: T.J. Mercier --- drive

[PATCH] dma-buf: heaps: Add __init to CMA and system heap module_init functions

2024-09-05 Thread T.J. Mercier
Shrink the kernel .text a bit after successful initialization of the heaps. Signed-off-by: T.J. Mercier --- drivers/dma-buf/heaps/cma_heap.c| 4 ++-- drivers/dma-buf/heaps/system_heap.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/dma-buf/heaps/cma_heap.c b

Re: [RFC PATCH 4/4] dma-buf: heaps: add Linaro restricted dmabuf heap support

2024-09-04 Thread T.J. Mercier
On Wed, Sep 4, 2024 at 2:44 AM Jens Wiklander wrote: > > On Tue, Sep 3, 2024 at 7:50 PM T.J. Mercier wrote: > > > > On Fri, Aug 30, 2024 at 12:04 AM Jens Wiklander > > wrote: > > > > > > Add a Linaro restricted heap using the linaro,restricted-he

Re: [RFC PATCH 4/4] dma-buf: heaps: add Linaro restricted dmabuf heap support

2024-09-03 Thread T.J. Mercier
On Fri, Aug 30, 2024 at 12:04 AM Jens Wiklander wrote: > > Add a Linaro restricted heap using the linaro,restricted-heap bindings > implemented based on the generic restricted heap. > > The bindings defines a range of physical restricted memory. The heap > manages this address range using genalloc

Re: [RFC PATCH 2/4] tee: new ioctl to a register tee_shm from a dmabuf file descriptor

2024-09-03 Thread T.J. Mercier
On Fri, Aug 30, 2024 at 12:04 AM Jens Wiklander wrote: > > From: Etienne Carriere > > Enable userspace to create a tee_shm object that refers to a dmabuf > reference. > > Userspace registers the dmabuf file descriptor as in a tee_shm object. > The registration is completed with a tee_shm file des

[PATCH] dma-buf: heaps: Fix off-by-one in CMA heap fault handler

2024-08-30 Thread T.J. Mercier
y: Xingyu Jin Fixes: a5d2d29e24be ("dma-buf: heaps: Move heap-helper logic into the cma_heap implementation") Cc: sta...@vger.kernel.org # Applicable >= 5.10. Needs adjustments only for 5.10. Signed-off-by: T.J. Mercier --- drivers/dma-buf/heaps/cma_heap.c | 2 +- 1 file changed, 1 insertio

Re: [PATCH v2 0/5] Introduce DMA_HEAP_ALLOC_AND_READ_FILE heap flag

2024-07-30 Thread T.J. Mercier
On Tue, Jul 30, 2024 at 1:14 AM Huan Yang wrote: > > > 在 2024/7/30 16:03, Christian König 写道: > > Am 30.07.24 um 09:57 schrieb Huan Yang: > >> Background > >> > >> Some user may need load file into dma-buf, current way is: > >>1. allocate a dma-buf, get dma-buf fd > >>2. mmap dma-buf

Re: [PATCH v7 04/28] dma-buf: heaps: Deduplicate docs and adopt common format

2024-07-25 Thread T.J. Mercier
On Thu, Jul 25, 2024 at 4:52 AM Christian König wrote: > > Am 20.07.24 um 09:15 schrieb Yunfei Dong: > > From: "T.J. Mercier" > > > > The docs for dma_heap_get_name were incorrect, and since they were > > duplicated in the header they were wrong th

Re: [PATCH 0/2] Support direct I/O read and write for memory allocated by dmabuf

2024-07-10 Thread T.J. Mercier
On Wed, Jul 10, 2024 at 8:08 AM Lei Liu wrote: > > > on 2024/7/10 22:48, Christian König wrote: > > Am 10.07.24 um 16:35 schrieb Lei Liu: > >> > >> on 2024/7/10 22:14, Christian König wrote: > >>> Am 10.07.24 um 15:57 schrieb Lei Liu: > Use vm_insert_page to establish a mapping for the memory

Re: [PATCH] kselftests: dmabuf-heaps: Ensure the driver name is null-terminated

2024-07-08 Thread T.J. Mercier
On Mon, Jul 8, 2024 at 6:47 AM Zenghui Yu wrote: > > Even if a vgem device is configured in, we will skip the import_vgem_fd() > test almost every time. > > TAP version 13 > 1..11 > # Testing heap: system > # === > # Testing allocation and importing: >

Re: [PATCH v2] drm: Fix alignment of temporary stack ioctl buffers

2024-06-17 Thread T.J. Mercier
nel (hybrid) setup). In this, userspace > ioctl structs now had to transport capabilities that needed 16 byte > alignment, but the kernel was not putting these data buffers on that > alignment boundary. > > Currently the largest type that is needed is a u64 so the alignment > on

Re: [PATCH] drm: Fix alignment of temporary stack ioctl buffers

2024-06-11 Thread T.J. Mercier
On Tue, Jun 11, 2024 at 2:35 AM wrote: > > From: Carsten Haitzler > > In a few places (core drm + AMD kfd driver), the ioctl handling uses a > temporary 128 byte buffer on the stack to copy to/from user. ioctl data > can have structs with types of much larger sizes than a byte and a > system may

Re: [PATCH v2] dma-buf: handle testing kthreads creation failure

2024-05-22 Thread T.J. Mercier
erification Center (linuxtesting.org). > > Fixes: 2989f6451084 ("dma-buf: Add selftests for dma-fence") > Cc: sta...@vger.kernel.org > Signed-off-by: Fedor Pchelkin Reviewed-by: T.J. Mercier > --- > v2: use kthread_stop_put() to actually put the last reference as >

Re: [PATCH] dma-buf: handle testing kthreads creation failure

2024-05-22 Thread T.J. Mercier
On Wed, May 22, 2024 at 5:24 AM Fedor Pchelkin wrote: > > kthread creation may possibly fail inside race_signal_callback(). In > such case stop the already started threads and return with error code. > > Found by Linux Verification Center (linuxtesting.org). > > Fixes: 2989f6451084 ("dma-buf: Add

Re: [PATCH] dmabuf: fix dmabuf file poll uaf issue

2024-05-07 Thread T.J. Mercier
On Tue, May 7, 2024 at 7:04 AM Christian König wrote: > > Am 07.05.24 um 15:39 schrieb Daniel Vetter: > > On Tue, May 07, 2024 at 12:10:07PM +0200, Christian König wrote: > >> Am 06.05.24 um 21:04 schrieb T.J. Mercier: > >>> On Mon, May 6, 2024 at 2:30 AM Charan T

Re: [PATCH] dmabuf: fix dmabuf file poll uaf issue

2024-05-06 Thread T.J. Mercier
On Mon, May 6, 2024 at 2:30 AM Charan Teja Kalla wrote: > > Hi TJ, > > Seems I have got answers from [1], where it is agreed upon epoll() is > the source of issue. > > Thanks a lot for the discussion. > > [1] https://lore.kernel.org/lkml/2d631f0615918...@google.com/ > > Thanks > Charan

  1   2   >