dma-buf: support to walk the list of dmabuf for debug
Subsystems (2)
A message that is not in the archive (sent off-list or not yet received): CGME20200611111103epcas2p3b454a6086d4eab9c03a6eb58635d2357@epcas2p3.samsung.com
PATCH 1/1 dma-buf: support to walk the list of dmabuf for debug
Let's support debugging function to show exporter detail information. The exporter don't need to manage the lists for debugging because all dmabuf list are managed on dmabuf framework.
That supports to walk the dmabuf list and show the detailed information for exporter by passed function implemented from exporter.
That helps to show exporter detail information. For example, ION may show the buffer flag, heap name, or the name of process to request allocation.
Change-Id I670f04dda4a0870081e1b0fd96b9185b48b9dd15
Signed-off-by Hyesoo Yu <[email protected]>
--- drivers/dma-buf/dma-buf.c | 30 ++++++++++++++++++++++++++++++ include/linux/dma-buf.h | 2 ++ 2 files changed, 32 insertions(+)
drivers/dma-buf/dma-buf.c +30 -0
@@ -1254,6 +1254,36 @@ void dma_buf_vunmap(struct dma_buf *dmabuf, void *vaddr) }EXPORT_SYMBOL_GPL (dma_buf_vunmap); +int dma_buf_exp_show (struct seq_file *s, +int (*it)(struct seq_file *s,struct dma_buf *dmabuf)) +{ +int ret; +struct dma_buf *buf_obj; + + ret =mutex_lock_interruptible (&db_list.lock); +if (ret) +return ret; + +list_for_each_entry (buf_obj, &db_list.head, list_node) { + ret =mutex_lock_interruptible (&buf_obj->lock); +if (ret) { +seq_puts (s, +"\tERROR locking buffer object: skipping\n" ); +continue ; + } + + ret =it (s, buf_obj); +mutex_unlock (&buf_obj->lock); +if (ret) +break ; + } +mutex_unlock (&db_list.lock); + +return 0 ; + +} +EXPORT_SYMBOL_GPL (dma_buf_exp_show); +#ifdef CONFIG_DEBUG_FS static int dma_buf_debug_show (struct seq_file *s,void *unused) {
include/linux/dma-buf.h +2 -0
@@ -502,4 +502,6 @@ int dma_buf_mmap(struct dma_buf *, struct vm_area_struct *, unsigned long);void *dma_buf_vmap (struct dma_buf *);void dma_buf_vunmap (struct dma_buf *,void *vaddr); +int dma_buf_exp_show (struct seq_file *s, +int (*it)(struct seq_file *s,struct dma_buf *dmabuf));#endif /* __DMA_BUF_H__ */
Signature · 1 line
2.27.0