ANDROID: dma-heap: add vendor hook for dma heap alloc

Add start/end tracepoints around the allocate dma_heap_op call.

Bug: 351175506
Change-Id: Iaff719c6b7a64ac05236990e1194f51cbb10448b
Signed-off-by: Sooyong Suk <s.suk@samsung.corp-partner.google.com>
This commit is contained in:
Sooyong Suk
2024-08-02 17:54:45 +09:00
committed by Suren Baghdasaryan
parent ce2b5c7bca
commit 17fcda65fd
3 changed files with 18 additions and 1 deletions
+2
View File
@@ -345,3 +345,5 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_page_cache_readahead_start);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_page_cache_readahead_end);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_filemap_fault_start);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_filemap_fault_end);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_dma_heap_buffer_alloc_start);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_dma_heap_buffer_alloc_end);
+9 -1
View File
@@ -17,6 +17,7 @@
#include <linux/uaccess.h>
#include <linux/xarray.h>
#include <uapi/linux/dma-heap.h>
#include <trace/hooks/dmabuf.h>
#define DEVNAME "dma_heap"
@@ -79,6 +80,8 @@ struct dma_buf *dma_heap_buffer_alloc(struct dma_heap *heap, size_t len,
u32 fd_flags,
u64 heap_flags)
{
struct dma_buf *dma_buf;
if (fd_flags & ~DMA_HEAP_VALID_FD_FLAGS)
return ERR_PTR(-EINVAL);
@@ -92,7 +95,12 @@ struct dma_buf *dma_heap_buffer_alloc(struct dma_heap *heap, size_t len,
if (!len)
return ERR_PTR(-EINVAL);
return heap->ops->allocate(heap, len, fd_flags, heap_flags);
trace_android_vh_dma_heap_buffer_alloc_start(heap->name, len,
fd_flags, heap_flags);
dma_buf = heap->ops->allocate(heap, len, fd_flags, heap_flags);
trace_android_vh_dma_heap_buffer_alloc_end(heap->name, len);
return dma_buf;
}
EXPORT_SYMBOL_GPL(dma_heap_buffer_alloc);
+7
View File
@@ -15,6 +15,13 @@ struct dma_buf_sysfs_entry;
DECLARE_RESTRICTED_HOOK(android_rvh_dma_buf_stats_teardown,
TP_PROTO(struct dma_buf_sysfs_entry *sysfs_entry, bool *skip_sysfs_release),
TP_ARGS(sysfs_entry, skip_sysfs_release), 1);
DECLARE_HOOK(android_vh_dma_heap_buffer_alloc_start,
TP_PROTO(const char *name, size_t len,
u32 fd_flags, u64 heap_flags),
TP_ARGS(name, len, fd_flags, heap_flags));
DECLARE_HOOK(android_vh_dma_heap_buffer_alloc_end,
TP_PROTO(const char *name, size_t len),
TP_ARGS(name, len));
#endif /* _TRACE_HOOK_DMABUF_H */
/* This part must be outside protection */
#include <trace/define_trace.h>