[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <c0bc6d72-a078-4847-99fd-d95407fe3e72@amd.com>
Date: Tue, 25 Nov 2025 08:52:18 +0100
From: Christian König <christian.koenig@....com>
To: 高翔 <gaoxiang17@...omi.com>,
Xiang Gao <gxxa03070307@...il.com>,
"sumit.semwal@...aro.org" <sumit.semwal@...aro.org>,
"rostedt@...dmis.org" <rostedt@...dmis.org>,
"mhiramat@...nel.org" <mhiramat@...nel.org>
Cc: "linux-media@...r.kernel.org" <linux-media@...r.kernel.org>,
"dri-devel@...ts.freedesktop.org" <dri-devel@...ts.freedesktop.org>,
"linaro-mm-sig@...ts.linaro.org" <linaro-mm-sig@...ts.linaro.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"mathieu.desnoyers@...icios.com" <mathieu.desnoyers@...icios.com>,
"dhowells@...hat.com" <dhowells@...hat.com>,
"kuba@...nel.org" <kuba@...nel.org>, "brauner@...nel.org"
<brauner@...nel.org>, "akpm@...ux-foundation.org"
<akpm@...ux-foundation.org>,
"linux-trace-kernel@...r.kernel.org" <linux-trace-kernel@...r.kernel.org>
Subject: Re: 答复: [External Mail]Re: [PATCH] dma-buf: add some tracepoints to debug.
On 11/25/25 03:01, 高翔 wrote:
>> In general quite nice to have, but this needs a bit more explanation why you need it.
>
> I want to track the status of dmabuf in real time in the production environment.
Please add that to the commit message.
>
>> I have strongly doubts that this is your legal name :)
>> Please google the requirements for a Signed-off-by line.
> That's my real name, gaoxiang. However, there are quite a few people with the same name in the company, and I rank 17th.
It doesn't matter what your eMail address is, but the name in a Signed-off-by must be your legal name.
In other words the same what you would use on a contract, usually including first and last name.
It could be that gaoxiang is perfectly fine in your restrication, but the number 17 certainly looks odd.
> And the previous patches all used this name.
>
>> dmabuf->name can't be accessed without holding the appropriate lock, same of all other cases.
> ok, thanks. It can be accessed with holding dmabuf->name_lock.
That should work, yes.
Regards,
Christian.
>
>
>
> ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> *发件人:* Christian König <christian.koenig@....com>
> *发送时间:* 2025年11月24日 22:21:57
> *收件人:* Xiang Gao; sumit.semwal@...aro.org; rostedt@...dmis.org; mhiramat@...nel.org
> *抄送:* linux-media@...r.kernel.org; dri-devel@...ts.freedesktop.org; linaro-mm-sig@...ts.linaro.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; 高翔
> *主题:* [External Mail]Re: [PATCH] dma-buf: add some tracepoints to debug.
>
> [外部邮件] 此邮件来源于小米公司外部,请谨慎处理。若对邮件安全性存疑,请将邮件转发给misec@...omi.com进行反馈
>
> On 11/24/25 14:36, Xiang Gao wrote:
>> From: gaoxiang17 <gaoxiang17@...omi.com>
>>
>> With these tracepoints, we can track dmabuf in real time.
>>
>> For example:
>> binder:3025_3-10524 [000] ..... 553.310313: dma_buf_export: exp_name=qcom,system name=(null) size=12771328 ino=2799
>> binder:3025_3-10524 [000] ..... 553.310318: dma_buf_fd: exp_name=qcom,system name=(null) size=12771328 ino=2799 fd=8
>> RenderThread-9307 [000] ..... 553.310869: dma_buf_get: exp_name=qcom,system name=blastBufferQueue for scaleUpDow size=12771328 ino=2799 fd=673 f_ref=4
>> RenderThread-9307 [000] ..... 553.310871: dma_buf_attach: dev_name=kgsl-3d0 exp_name=qcom,system name=blastBufferQueue for scaleUpDow size=12771328 ino=2799
>> RenderThread-9307 [000] ..... 553.310946: dma_buf_mmap_internal: exp_name=qcom,system name=blastBufferQueue for scaleUpDow size=12771328 ino=2799
>> RenderThread-9307 [004] ..... 553.315084: dma_buf_detach: exp_name=qcom,system name=blastBufferQueue for scaleUpDow size=12771328 ino=2799
>> RenderThread-9307 [004] ..... 553.315084: dma_buf_put: exp_name=qcom,system name=blastBufferQueue for scaleUpDow size=12771328 ino=2799 f_ref=5
>
> In general quite nice to have, but this needs a bit more explanation why you need it.
>
>>
>> Signed-off-by: gaoxiang17 <gaoxiang17@...omi.com>
>
> I have strongly doubts that this is your legal name :)
>
> Please google the requirements for a Signed-off-by line.
>
>> ---
>> drivers/dma-buf/dma-buf.c | 19 +++
>> include/trace/events/dma_buf.h | 245 +++++++++++++++++++++++++++++++++
>> 2 files changed, 264 insertions(+)
>> create mode 100644 include/trace/events/dma_buf.h
>>
>> diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c
>> index 2bcf9ceca997..8b5af73f0218 100644
>> --- a/drivers/dma-buf/dma-buf.c
>> +++ b/drivers/dma-buf/dma-buf.c
>> @@ -35,6 +35,9 @@
>>
>> #include "dma-buf-sysfs-stats.h"
>>
>> +#define CREATE_TRACE_POINTS
>> +#include <trace/events/dma_buf.h>
>> +
>> static inline int is_dma_buf_file(struct file *);
>>
>> static DEFINE_MUTEX(dmabuf_list_mutex);
>> @@ -220,6 +223,8 @@ static int dma_buf_mmap_internal(struct file *file, struct vm_area_struct *vma)
>> dmabuf->size >> PAGE_SHIFT)
>> return -EINVAL;
>>
>> + trace_dma_buf_mmap_internal(dmabuf);
>> +
>> return dmabuf->ops->mmap(dmabuf, vma);
>> }
>>
>> @@ -745,6 +750,8 @@ struct dma_buf *dma_buf_export(const struct dma_buf_export_info *exp_info)
>>
>> __dma_buf_list_add(dmabuf);
>>
>> + trace_dma_buf_export(dmabuf);
>> +
>> return dmabuf;
>>
>> err_dmabuf:
>> @@ -779,6 +786,8 @@ int dma_buf_fd(struct dma_buf *dmabuf, int flags)
>>
>> fd_install(fd, dmabuf->file);
>>
>> + trace_dma_buf_fd(dmabuf, fd);
>> +
>> return fd;
>> }
>> EXPORT_SYMBOL_NS_GPL(dma_buf_fd, "DMA_BUF");
>> @@ -805,6 +814,8 @@ struct dma_buf *dma_buf_get(int fd)
>> return ERR_PTR(-EINVAL);
>> }
>>
>> + trace_dma_buf_get(fd, file);
>> +
>> return file->private_data;
>> }
>> EXPORT_SYMBOL_NS_GPL(dma_buf_get, "DMA_BUF");
>> @@ -825,6 +836,8 @@ void dma_buf_put(struct dma_buf *dmabuf)
>> return;
>>
>> fput(dmabuf->file);
>> +
>> + trace_dma_buf_put(dmabuf);
>> }
>> EXPORT_SYMBOL_NS_GPL(dma_buf_put, "DMA_BUF");
>>
>> @@ -998,6 +1011,8 @@ EXPORT_SYMBOL_NS_GPL(dma_buf_dynamic_attach, "DMA_BUF");
>> struct dma_buf_attachment *dma_buf_attach(struct dma_buf *dmabuf,
>> struct device *dev)
>> {
>> + trace_dma_buf_attach(dmabuf, dev);
>> +
>> return dma_buf_dynamic_attach(dmabuf, dev, NULL, NULL);
>> }
>> EXPORT_SYMBOL_NS_GPL(dma_buf_attach, "DMA_BUF");
>> @@ -1024,6 +1039,8 @@ void dma_buf_detach(struct dma_buf *dmabuf, struct dma_buf_attachment *attach)
>> dmabuf->ops->detach(dmabuf, attach);
>>
>> kfree(attach);
>> +
>> + trace_dma_buf_detach(dmabuf);
>> }
>> EXPORT_SYMBOL_NS_GPL(dma_buf_detach, "DMA_BUF");
>>
>> @@ -1488,6 +1505,8 @@ int dma_buf_mmap(struct dma_buf *dmabuf, struct vm_area_struct *vma,
>> vma_set_file(vma, dmabuf->file);
>> vma->vm_pgoff = pgoff;
>>
>> + trace_dma_buf_mmap(dmabuf);
>> +
>> return dmabuf->ops->mmap(dmabuf, vma);
>> }
>> EXPORT_SYMBOL_NS_GPL(dma_buf_mmap, "DMA_BUF");
>> diff --git a/include/trace/events/dma_buf.h b/include/trace/events/dma_buf.h
>> new file mode 100644
>> index 000000000000..796ae444f6ae
>> --- /dev/null
>> +++ b/include/trace/events/dma_buf.h
>> @@ -0,0 +1,245 @@
>> +/* SPDX-License-Identifier: GPL-2.0 */
>> +#undef TRACE_SYSTEM
>> +#define TRACE_SYSTEM dma_buf
>> +
>> +#if !defined(_TRACE_DMA_BUF_H) || defined(TRACE_HEADER_MULTI_READ)
>> +#define _TRACE_DMA_BUF_H
>> +
>> +#include <linux/dma-buf.h>
>> +#include <linux/tracepoint.h>
>> +
>> +TRACE_EVENT(dma_buf_export,
>> +
>> + TP_PROTO(struct dma_buf *dmabuf),
>> +
>> + TP_ARGS(dmabuf),
>> +
>> + TP_STRUCT__entry(
>> + __string(exp_name, dmabuf->exp_name)
>> + __string(name, dmabuf->name)
>
> dmabuf->name can't be accessed without holding the appropriate lock, same of all other cases.
>
> Regards,
> Christian.
>
>> + __field(size_t, size)
>> + __field(ino_t, ino)
>> + ),
>> +
>> + TP_fast_assign(
>> + __assign_str(exp_name);
>> + __assign_str(name);
>> + __entry->size = dmabuf->size;
>> + __entry->ino = dmabuf->file->f_inode->i_ino;
>> + ),
>> +
>> + TP_printk("exp_name=%s name=%s size=%zu ino=%lu",
>> + __get_str(exp_name),
>> + __get_str(name),
>> + __entry->size,
>> + __entry->ino)
>> +);
>> +
>> +TRACE_EVENT(dma_buf_fd,
>> +
>> + TP_PROTO(struct dma_buf *dmabuf, int fd),
>> +
>> + TP_ARGS(dmabuf, fd),
>> +
>> + TP_STRUCT__entry(
>> + __string(exp_name, dmabuf->exp_name)
>> + __string(name, dmabuf->name)
>> + __field(size_t, size)
>> + __field(ino_t, ino)
>> + __field(int, fd)
>> + ),
>> +
>> + TP_fast_assign(
>> + __assign_str(exp_name);
>> + __assign_str(name);
>> + __entry->size = dmabuf->size;
>> + __entry->ino = dmabuf->file->f_inode->i_ino;
>> + __entry->fd = fd;
>> + ),
>> +
>> + TP_printk("exp_name=%s name=%s size=%zu ino=%lu fd=%d",
>> + __get_str(exp_name),
>> + __get_str(name),
>> + __entry->size,
>> + __entry->ino,
>> + __entry->fd)
>> +);
>> +
>> +TRACE_EVENT(dma_buf_mmap_internal,
>> +
>> + TP_PROTO(struct dma_buf *dmabuf),
>> +
>> + TP_ARGS(dmabuf),
>> +
>> + TP_STRUCT__entry(
>> + __string(exp_name, dmabuf->exp_name)
>> + __string(name, dmabuf->name)
>> + __field(size_t, size)
>> + __field(ino_t, ino)
>> + ),
>> +
>> + TP_fast_assign(
>> + __assign_str(exp_name);
>> + __assign_str(name);
>> + __entry->size = dmabuf->size;
>> + __entry->ino = dmabuf->file->f_inode->i_ino;
>> + ),
>> +
>> + TP_printk("exp_name=%s name=%s size=%zu ino=%lu",
>> + __get_str(exp_name),
>> + __get_str(name),
>> + __entry->size,
>> + __entry->ino)
>> +);
>> +
>> +TRACE_EVENT(dma_buf_mmap,
>> +
>> + TP_PROTO(struct dma_buf *dmabuf),
>> +
>> + TP_ARGS(dmabuf),
>> +
>> + TP_STRUCT__entry(
>> + __string(exp_name, dmabuf->exp_name)
>> + __string(name, dmabuf->name)
>> + __field(size_t, size)
>> + __field(ino_t, ino)
>> + ),
>> +
>> + TP_fast_assign(
>> + __assign_str(exp_name);
>> + __assign_str(name);
>> + __entry->size = dmabuf->size;
>> + __entry->ino = dmabuf->file->f_inode->i_ino;
>> + ),
>> +
>> + TP_printk("exp_name=%s name=%s size=%zu ino=%lu",
>> + __get_str(exp_name),
>> + __get_str(name),
>> + __entry->size,
>> + __entry->ino)
>> +);
>> +
>> +TRACE_EVENT(dma_buf_attach,
>> +
>> + TP_PROTO(struct dma_buf *dmabuf, struct device *dev),
>> +
>> + TP_ARGS(dmabuf, dev),
>> +
>> + TP_STRUCT__entry(
>> + __string(dname, dev_name(dev))
>> + __string(exp_name, dmabuf->exp_name)
>> + __string(name, dmabuf->name)
>> + __field(size_t, size)
>> + __field(ino_t, ino)
>> + ),
>> +
>> + TP_fast_assign(
>> + __assign_str(dname);
>> + __assign_str(exp_name);
>> + __assign_str(name);
>> + __entry->size = dmabuf->size;
>> + __entry->ino = dmabuf->file->f_inode->i_ino;
>> + ),
>> +
>> + TP_printk("dev_name=%s exp_name=%s name=%s size=%zu ino=%lu",
>> + __get_str(dname),
>> + __get_str(exp_name),
>> + __get_str(name),
>> + __entry->size,
>> + __entry->ino)
>> +);
>> +
>> +TRACE_EVENT(dma_buf_detach,
>> +
>> + TP_PROTO(struct dma_buf *dmabuf),
>> +
>> + TP_ARGS(dmabuf),
>> +
>> + TP_STRUCT__entry(
>> + __string(exp_name, dmabuf->exp_name)
>> + __string(name, dmabuf->name)
>> + __field(size_t, size)
>> + __field(ino_t, ino)
>> + ),
>> +
>> + TP_fast_assign(
>> + __assign_str(exp_name);
>> + __assign_str(name);
>> + __entry->size = dmabuf->size;
>> + __entry->ino = dmabuf->file->f_inode->i_ino;
>> + ),
>> +
>> + TP_printk("exp_name=%s name=%s size=%zu ino=%lu",
>> + __get_str(exp_name),
>> + __get_str(name),
>> + __entry->size,
>> + __entry->ino)
>> +);
>> +
>> +TRACE_EVENT(dma_buf_get,
>> +
>> + TP_PROTO(int fd, struct file *file),
>> +
>> + TP_ARGS(fd, file),
>> +
>> + TP_STRUCT__entry(
>> + __string(exp_name, ((struct dma_buf *)file->private_data)->exp_name)
>> + __string(name, ((struct dma_buf *)file->private_data)->name)
>> + __field(size_t, size)
>> + __field(ino_t, ino)
>> + __field(int, fd)
>> + __field(long, f_ref)
>> + ),
>> +
>> + TP_fast_assign(
>> + __assign_str(exp_name);
>> + __assign_str(name);
>> + __entry->size = ((struct dma_buf *)file->private_data)->size;
>> + __entry->ino = ((struct dma_buf *)file->private_data)->file->f_inode->i_ino;
>> + __entry->fd = fd;
>> + __entry->f_ref = file_ref_get(&file->f_ref);
>> + ),
>> +
>> + TP_printk("exp_name=%s name=%s size=%zu ino=%lu fd=%d f_ref=%ld",
>> + __get_str(exp_name),
>> + __get_str(name),
>> + __entry->size,
>> + __entry->ino,
>> + __entry->fd,
>> + __entry->f_ref)
>> +);
>> +
>> +TRACE_EVENT(dma_buf_put,
>> +
>> + TP_PROTO(struct dma_buf *dmabuf),
>> +
>> + TP_ARGS(dmabuf),
>> +
>> + TP_STRUCT__entry(
>> + __string(exp_name, dmabuf->exp_name)
>> + __string(name, dmabuf->name)
>> + __field(size_t, size)
>> + __field(ino_t, ino)
>> + __field(long, f_ref)
>> + ),
>> +
>> + TP_fast_assign(
>> + __assign_str(exp_name);
>> + __assign_str(name);
>> + __entry->size = dmabuf->size;
>> + __entry->ino = dmabuf->file->f_inode->i_ino;
>> + __entry->f_ref = file_ref_get(&dmabuf->file->f_ref);
>> + ),
>> +
>> + TP_printk("exp_name=%s name=%s size=%zu ino=%lu f_ref=%ld",
>> + __get_str(exp_name),
>> + __get_str(name),
>> + __entry->size,
>> + __entry->ino,
>> + __entry->f_ref)
>> +);
>> +
>> +#endif /* _TRACE_DMA_BUF_H */
>> +
>> +/* This part must be outside protection */
>> +#include <trace/define_trace.h>
>
Powered by blists - more mailing lists