dma-buf: show attached devices name to bufprocs node

console:/ # cat /sys/kernel/debug/dma_buf/bufprocs
surfaceflinger (PID 187) size: 66596
DMA Buffers:
Name            Exp_name                                                        Size (KB)       Alive (sec)     Attached Devices
(null)          ion_alloc-ion_system_heap-218-allocator@4.0-s                   12480           9               display-subsystem       ff9a0000.gpu
(null)          ion_alloc-ion_system_heap-218-allocator@4.0-s                   4               9               ff9a0000.gpu
(null)          ion_alloc-ion_system_heap-218-allocator@4.0-s                   12480           9               display-subsystem       ff9a0000.gpu
(null)          ion_alloc-ion_system_heap-218-allocator@4.0-s                   2288            1               ff9a0000.gpu
(null)          ion_alloc-ion_system_heap-218-allocator@4.0-s                   2288            1               ff9a0000.gpu
(null)          ion_alloc-ion_system_heap-218-allocator@4.0-s                   12288           8               display-subsystem       ff9a0000.gpu    ff9a0000.gpu
(null)          ion_alloc-ion_system_heap-218-allocator@4.0-s                   12480           9               display-subsystem       ff9a0000.gpu
(null)          ion_alloc-ion_system_heap-218-allocator@4.0-s                   12288           8               display-subsystem       ff9a0000.gpu    ff9a0000.gpu

Change-Id: I95b1feaf933cc46c8936db129f9152ead71ed664
Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
This commit is contained in:
Jianqun Xu
2021-03-04 10:55:05 +08:00
committed by Tao Huang
parent 3f1e1d3358
commit 94daf32a11

View File

@@ -1479,19 +1479,25 @@ static void write_proc(struct seq_file *s, struct dma_proc *proc)
seq_printf(s, "\n%s (PID %d) size: %zu\nDMA Buffers:\n",
proc->name, proc->pid, proc->size);
seq_printf(s, "%-8s\t%-60s\t%-8s\t%-8s\n",
"Name", "Exp_name", "Size (KB)", "Time Alive (sec)");
seq_printf(s, "%-8s\t%-60s\t%-8s\t%-8s\t%s\n",
"Name", "Exp_name", "Size (KB)", "Alive (sec)", "Attached Devices");
hash_for_each(proc->dma_bufs, i, tmp, head) {
struct dma_buf *dmabuf = tmp->dmabuf;
struct dma_buf_attachment *a;
ktime_t elapmstime = ktime_ms_delta(ktime_get(), dmabuf->ktime);
elapmstime = ktime_divns(elapmstime, MSEC_PER_SEC);
seq_printf(s, "%-8s\t%-60s\t%-8zu\t%-8lld\n",
seq_printf(s, "%-8s\t%-60s\t%-8zu\t%-8lld",
dmabuf->name,
dmabuf->exp_name,
dmabuf->size / SZ_1K,
elapmstime);
list_for_each_entry(a, &dmabuf->attachments, node) {
seq_printf(s, "\t%s", dev_name(a->dev));
}
seq_printf(s, "\n");
}
}