From: 高翔 <gaoxiang17@xiaomi.com>
To: Steven Rostedt <rostedt@goodmis.org>, Xiang Gao <gxxa03070307@gmail.com>
Cc: "sumit.semwal@linaro.org" <sumit.semwal@linaro.org>,
"christian.koenig@amd.com" <christian.koenig@amd.com>,
"mhiramat@kernel.org" <mhiramat@kernel.org>,
"linux-media@vger.kernel.org" <linux-media@vger.kernel.org>,
"dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"mathieu.desnoyers@efficios.com" <mathieu.desnoyers@efficios.com>,
"dhowells@redhat.com" <dhowells@redhat.com>,
"kuba@kernel.org" <kuba@kernel.org>,
"brauner@kernel.org" <brauner@kernel.org>,
"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
"linux-trace-kernel@vger.kernel.org"
<linux-trace-kernel@vger.kernel.org>
Subject: 答复: [External Mail]Re: [PATCH v9] dma-buf: add some tracepoints to debug.
Date: Wed, 24 Dec 2025 01:11:35 +0000 [thread overview]
Message-ID: <49db0d7370224e14ad7788b280bd1602@xiaomi.com> (raw)
In-Reply-To: <20251223114424.1c539f7a@gandalf.local.home>
[-- Attachment #1: Type: text/plain, Size: 2878 bytes --]
ok, thanks.
________________________________
发件人: Steven Rostedt <rostedt@goodmis.org>
发送时间: 2025年12月24日 0:44:24
收件人: Xiang Gao
抄送: sumit.semwal@linaro.org; christian.koenig@amd.com; mhiramat@kernel.org; linux-media@vger.kernel.org; dri-devel@lists.freedesktop.org; linux-kernel@vger.kernel.org; mathieu.desnoyers@efficios.com; dhowells@redhat.com; kuba@kernel.org; brauner@kernel.org; akpm@linux-foundation.org; linux-trace-kernel@vger.kernel.org; 高翔
主题: [External Mail]Re: [PATCH v9] dma-buf: add some tracepoints to debug.
[外部邮件] 此邮件来源于小米公司外部,请谨慎处理。若对邮件安全性存疑,请将邮件转发给misec@xiaomi.com进行反馈
On Tue, 23 Dec 2025 11:27:49 +0800
Xiang Gao <gxxa03070307@gmail.com> wrote:
>
> +#define CREATE_TRACE_POINTS
> +#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 { \
> + if (FUNC##_enabled()) { \
> + guard(spinlock)(&dmabuf->name_lock); \
> + FUNC(__VA_ARGS__); \
> + } else if (IS_ENABLED(CONFIG_LOCKDEP)) { \
> + /* Expose this lock when lockdep is enabled */ \
> + guard(spinlock)(&dmabuf->name_lock); \
> + } \
> + } while (0)
> +
I hate to make another comment here, but I was just thinking that this can
be made to look a little nicer. Basically, we want to make sure that when
LOCKDEP is active, we always take the lock. But we also need to take the
lock when tracing is enabled. The tracepoint itself is a static branch,
which means it is a nop when not active, so there's no real problem with
calling it. Thus, this could look better as:
#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)
-- Steve
[-- Attachment #2: Type: text/html, Size: 7915 bytes --]
next prev parent reply other threads:[~2025-12-24 1:11 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-23 3:27 [PATCH v9] dma-buf: add some tracepoints to debug Xiang Gao
2025-12-23 16:44 ` Steven Rostedt
2025-12-24 1:11 ` 高翔 [this message]
2026-01-07 12:45 ` Christian König
2026-01-07 12:57 ` 答复: [External Mail]Re: " 高翔
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=49db0d7370224e14ad7788b280bd1602@xiaomi.com \
--to=gaoxiang17@xiaomi.com \
--cc=akpm@linux-foundation.org \
--cc=brauner@kernel.org \
--cc=christian.koenig@amd.com \
--cc=dhowells@redhat.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=gxxa03070307@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mhiramat@kernel.org \
--cc=rostedt@goodmis.org \
--cc=sumit.semwal@linaro.org \
/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