ANDROID: GKI: dma-buf: add vendor hook for dma_buf_release

The main function is to check whether the corresponding IOMMU buffer
is unmapped when dmabuf is released, so as to avoid memory coverage
caused by IOMMU.

Bug: 438090847
Change-Id: I56ae3f0994cd4f3d24494b7972e4d89d0f004da8
Signed-off-by: Gaofeng Sheng <gaofeng.sheng@unisoc.com>
(cherry picked from commit 8879650556ed747baf5a4d3037d687a76ccb986f)
This commit is contained in:
Gaofeng Sheng
2022-04-18 14:28:04 +08:00
committed by yan chang
parent affdb774d7
commit 1d3cdeb464
3 changed files with 9 additions and 0 deletions
+1
View File
@@ -584,6 +584,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_shrink_node);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_customize_thp_gfp_orders);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_customize_pmd_gfp_bypass);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_thp_vma_allowable_orders);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_dma_buf_release);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_cpuset_fork);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_alloc_uid);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_free_user);
+5
View File
@@ -33,6 +33,10 @@
#include "dma-buf-sysfs-stats.h"
#include <trace/hooks/dmabuf.h>
#include <linux/android_kabi.h>
ANDROID_KABI_DECLONLY(trace_eval_map);
#if IS_ENABLED(CONFIG_DEBUG_FS)
static DEFINE_MUTEX(debugfs_list_mutex);
static LIST_HEAD(debugfs_list);
@@ -126,6 +130,7 @@ static void dma_buf_release(struct dentry *dentry)
dma_buf_stats_teardown(dmabuf);
dmabuf->ops->release(dmabuf);
trace_android_vh_dma_buf_release(dmabuf);
if (dmabuf->resv == (struct dma_resv *)&dmabuf[1])
dma_resv_fini(dmabuf->resv);
+3
View File
@@ -29,6 +29,9 @@ DECLARE_HOOK(android_vh_dma_buf_attr_show_start,
DECLARE_HOOK(android_vh_dma_buf_attr_show_end,
TP_PROTO(struct dma_buf *dmabuf),
TP_ARGS(dmabuf));
DECLARE_HOOK(android_vh_dma_buf_release,
TP_PROTO(struct dma_buf *data),
TP_ARGS(data));
#endif /* _TRACE_HOOK_DMABUF_H */
/* This part must be outside protection */
#include <trace/define_trace.h>