lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20251226114215.02be95a3@gandalf.local.home>
Date: Fri, 26 Dec 2025 11:42:15 -0500
From: Steven Rostedt <rostedt@...dmis.org>
To: Xiang Gao <gxxa03070307@...il.com>
Cc: sumit.semwal@...aro.org, christian.koenig@....com, mhiramat@...nel.org,
 linux-media@...r.kernel.org, dri-devel@...ts.freedesktop.org,
 linux-kernel@...r.kernel.org, mathieu.desnoyers@...icios.com,
 dhowells@...hat.com, kuba@...nel.org, brauner@...nel.org,
 akpm@...ux-foundation.org, linux-trace-kernel@...r.kernel.org, gaoxiang17
 <gaoxiang17@...omi.com>
Subject: Re: [PATCH v11] dma-buf: add some tracepoints to debug.

On Thu, 25 Dec 2025 20:11:19 +0800
Xiang Gao <gxxa03070307@...il.com> wrote:

> From: gaoxiang17 <gaoxiang17@...omi.com>
> 
> Since we can only inspect dmabuf by iterating over process FDs or the
> dmabuf_list, we need to add our own tracepoints to track its status in
> real time in production.
> 
> For example:
>    binder:3016_1-3102    [006] ...1.   255.126521: dma_buf_export: exp_name=qcom,system size=12685312 ino=2738
>    binder:3016_1-3102    [006] ...1.   255.126528: dma_buf_fd: exp_name=qcom,system size=12685312 ino=2738 fd=8
>    binder:3016_1-3102    [006] ...1.   255.126642: dma_buf_mmap_internal: exp_name=qcom,system size=28672 ino=2739
>      kworker/6:1-86      [006] ...1.   255.127194: dma_buf_put: exp_name=qcom,system size=12685312 ino=2738
>     RenderThread-9293    [006] ...1.   316.618179: dma_buf_get: exp_name=qcom,system size=12771328 ino=2762 fd=176
>     RenderThread-9293    [006] ...1.   316.618195: dma_buf_dynamic_attach: exp_name=qcom,system size=12771328 ino=2762 attachment:ffffff880a18dd00 is_dynamic=0 dev_name=kgsl-3d0
>     RenderThread-9293    [006] ...1.   318.878220: dma_buf_detach: exp_name=qcom,system size=12771328 ino=2762 attachment:ffffff880a18dd00 is_dynamic=0 dev_name=kgsl-3d0
> 
> Signed-off-by: Xiang Gao <gaoxiang17@...omi.com>
> ---
> 
> Changes since v10: https://lore.kernel.org/all/20251224013455.1649879-1-gxxa03070307@gmail.com/

You only need to show the last revision (but since you haven't showed the
others, before it's good to show them now). But you also want to say "what changed"

For example:

- Used DEFINE_EVENT_CONDITION() to move the condition branch into the tracepoint.


> Changes since v9: https://lore.kernel.org/all/20251223032749.1371913-1-gxxa03070307@gmail.com/
> Changes since v8: https://lore.kernel.org/all/20251218062853.819744-1-gxxa03070307@gmail.com/
> Changes since v7: https://lore.kernel.org/all/20251217105132.643300-1-gxxa03070307@gmail.com/
> Changes since v6: https://lore.kernel.org/all/20251216063952.516364-1-gxxa03070307@gmail.com/
> Changes since v5: https://lore.kernel.org/all/20251201112148.843572-1-gxxa03070307@gmail.com/
> Changes since v4: https://lore.kernel.org/all/20251128085215.550100-1-gxxa03070307@gmail.com/
> Changes since v3: https://lore.kernel.org/all/20251127004352.376307-1-gxxa03070307@gmail.com/
> Changes since v2: https://lore.kernel.org/all/20251125162949.220488-1-gxxa03070307@gmail.com/
> Changes since v1: https://lore.kernel.org/all/20251124133648.72668-1-gxxa03070307@gmail.com/
> 
>  drivers/dma-buf/dma-buf.c      |  48 +++++++++-
>  include/trace/events/dma_buf.h | 159 +++++++++++++++++++++++++++++++++
>  2 files changed, 205 insertions(+), 2 deletions(-)
>  create mode 100644 include/trace/events/dma_buf.h
> 


> +/*
> + * dmabuf->name must be accessed with holding dmabuf->name_lock.
> + * we need to take the lock around the tracepoint call itself where
> + * it is called in the code.
> + *
> + * Note: FUNC##_enabled() is a static branch that will only
> + *       be set when the trace event is enabled.
> + */
> +#define DMA_BUF_TRACE(FUNC, ...)					\
> +	do {								\
> +		/* Always expose lock if lockdep is enabled */		\
> +		if (IS_ENABLED(CONFIG_LOCKDEP) || FUNC##_enabled()) {	\
> +			guard(spinlock)(&dmabuf->name_lock);		\
> +			FUNC(__VA_ARGS__);				\
> +		}							\
> +	} while (0)
> +
>  static inline int is_dma_buf_file(struct file *);
>  

> +
> +DEFINE_EVENT_CONDITION(dma_buf_fd, dma_buf_fd,
> +
> +	TP_PROTO(struct dma_buf *dmabuf, int fd),
> +
> +	TP_ARGS(dmabuf, fd),
> +
> +	TP_CONDITION(fd >= 0)
> +);
> +


From a tracing point of view (It's up to the dma maintainers to decide to
take this patch):

Reviewed-by: Steven Rostedt (Google) <rostedt@...dmis.org>

-- Steve

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ