linux-kselftest.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Song Liu <song@kernel.org>
To: "T.J. Mercier" <tjmercier@google.com>
Cc: sumit.semwal@linaro.org, christian.koenig@amd.com,
	ast@kernel.org,  daniel@iogearbox.net, andrii@kernel.org,
	martin.lau@linux.dev,  skhan@linuxfoundation.org,
	alexei.starovoitov@gmail.com,  linux-kernel@vger.kernel.org,
	linux-media@vger.kernel.org,  dri-devel@lists.freedesktop.org,
	linaro-mm-sig@lists.linaro.org,  bpf@vger.kernel.org,
	linux-kselftest@vger.kernel.org, android-mm@google.com,
	 simona@ffwll.ch, eddyz87@gmail.com, yonghong.song@linux.dev,
	 john.fastabend@gmail.com, kpsingh@kernel.org, sdf@fomichev.me,
	 jolsa@kernel.org, mykolal@fb.com, shuah@kernel.org
Subject: Re: [PATCH bpf-next v4 4/5] selftests/bpf: Add test for dmabuf_iter
Date: Thu, 8 May 2025 17:36:43 -0700	[thread overview]
Message-ID: <CAPhsuW6z90sErDTA97_MN2=QKHc96Ge3HwGD1ZoMYj6Sh7GYVA@mail.gmail.com> (raw)
In-Reply-To: <20250508182025.2961555-5-tjmercier@google.com>

On Thu, May 8, 2025 at 11:20 AM T.J. Mercier <tjmercier@google.com> 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 100644
> index 000000000000..35745f4ce0f8
> --- /dev/null
> +++ b/tools/testing/selftests/bpf/prog_tests/dmabuf_iter.c
> @@ -0,0 +1,224 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/* Copyright (c) 2025 Google */
> +
> +#include <test_progs.h>
> +#include <bpf/libbpf.h>
> +#include <bpf/btf.h>
> +#include "dmabuf_iter.skel.h"
> +
> +#include <fcntl.h>
> +#include <stdbool.h>
> +#include <stdio.h>
> +#include <stdlib.h>
> +#include <string.h>
> +#include <sys/ioctl.h>
> +#include <sys/mman.h>
> +#include <unistd.h>
> +
> +#include <linux/dma-buf.h>
> +#include <linux/dma-heap.h>
> +#include <linux/udmabuf.h>
> +
> +static int memfd, udmabuf;

Global fds are weird. AFAICT, we don't really need them
to be global? If we really need them to be global, please
initialize them to -1, just in case we close(0) by accident.

> +static const char udmabuf_test_buffer_name[DMA_BUF_NAME_LEN] = "udmabuf_test_buffer_for_iter";
> +static size_t udmabuf_test_buffer_size;
> +static int sysheap_dmabuf;
> +static const char sysheap_test_buffer_name[DMA_BUF_NAME_LEN] = "sysheap_test_buffer_for_iter";
> +static size_t sysheap_test_buffer_size;

  reply	other threads:[~2025-05-09  0:36 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-08 18:20 [PATCH bpf-next v4 0/5] Replace CONFIG_DMABUF_SYSFS_STATS with BPF T.J. Mercier
2025-05-08 18:20 ` [PATCH bpf-next v4 1/5] dma-buf: Rename debugfs symbols T.J. Mercier
2025-05-08 18:32   ` Song Liu
2025-05-08 18:20 ` [PATCH bpf-next v4 2/5] bpf: Add dmabuf iterator T.J. Mercier
2025-05-09  0:27   ` Song Liu
2025-05-09 17:13     ` T.J. Mercier
2025-05-08 18:20 ` [PATCH bpf-next v4 3/5] bpf: Add open coded " T.J. Mercier
2025-05-09  0:28   ` Song Liu
2025-05-09 17:13     ` T.J. Mercier
2025-05-08 18:20 ` [PATCH bpf-next v4 4/5] selftests/bpf: Add test for dmabuf_iter T.J. Mercier
2025-05-09  0:36   ` Song Liu [this message]
2025-05-09 17:13     ` T.J. Mercier
2025-05-09 18:50   ` Song Liu
2025-05-08 18:20 ` [PATCH bpf-next v4 5/5] selftests/bpf: Add test for open coded dmabuf_iter T.J. Mercier
2025-05-09 18:46   ` Song Liu
2025-05-09 21:43     ` T.J. Mercier
2025-05-09 21:58       ` Song Liu
2025-05-09 22:27         ` T.J. Mercier
2025-05-09  6:03 ` [PATCH bpf-next v4 0/5] Replace CONFIG_DMABUF_SYSFS_STATS with BPF Christian König
2025-05-09 15:21   ` T.J. Mercier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAPhsuW6z90sErDTA97_MN2=QKHc96Ge3HwGD1ZoMYj6Sh7GYVA@mail.gmail.com' \
    --to=song@kernel.org \
    --cc=alexei.starovoitov@gmail.com \
    --cc=andrii@kernel.org \
    --cc=android-mm@google.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=christian.koenig@amd.com \
    --cc=daniel@iogearbox.net \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=eddyz87@gmail.com \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kpsingh@kernel.org \
    --cc=linaro-mm-sig@lists.linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=mykolal@fb.com \
    --cc=sdf@fomichev.me \
    --cc=shuah@kernel.org \
    --cc=simona@ffwll.ch \
    --cc=skhan@linuxfoundation.org \
    --cc=sumit.semwal@linaro.org \
    --cc=tjmercier@google.com \
    --cc=yonghong.song@linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).