ANDROID: dma-buf: Add vendor hook for deferred dmabuf sysfs stats release

This vendor hook allows for the sysfs activity associated with
dma-buf-sysfs-stats teardowns to be performed asynchronously similar
to how the initialization works.

Bug: 254192604
Signed-off-by: T.J. Mercier <tjmercier@google.com>
Change-Id: Ie076d0f8f67b96a97c71d9e6bf90539ebd9807bf
This commit is contained in:
T.J. Mercier
2022-11-04 19:16:04 +00:00
committed by Treehugger Robot
parent 425e7c7e0e
commit c5589c7eec
3 changed files with 37 additions and 3 deletions

View File

@@ -74,6 +74,7 @@
#include <trace/hooks/snd_compr.h>
#include <trace/hooks/ipv4.h>
#include <trace/hooks/pci.h>
#include <trace/hooks/dmabuf.h>
/*
* Export tracepoints that act as a bare tracehook (ie: have no trace event
@@ -467,7 +468,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_check_page_look_around_ref);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_look_around);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_look_around_migrate_page);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_test_clear_look_around_ref);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_dma_buf_stats_teardown);
/*
* For type visibility
*/

View File

@@ -13,6 +13,8 @@
#include <linux/sysfs.h>
#include <linux/workqueue.h>
#include <trace/hooks/dmabuf.h>
#include "dma-buf-sysfs-stats.h"
#define to_dma_buf_entry_from_kobj(x) container_of(x, struct dma_buf_sysfs_entry, kobj)
@@ -88,13 +90,17 @@ static struct kobj_type dma_buf_ktype = {
void dma_buf_stats_teardown(struct dma_buf *dmabuf)
{
struct dma_buf_sysfs_entry *sysfs_entry;
bool skip_sysfs_release = false;
sysfs_entry = dmabuf->sysfs_entry;
if (!sysfs_entry)
return;
kobject_del(&sysfs_entry->kobj);
kobject_put(&sysfs_entry->kobj);
trace_android_rvh_dma_buf_stats_teardown(sysfs_entry, &skip_sysfs_release);
if (!skip_sysfs_release) {
kobject_del(&sysfs_entry->kobj);
kobject_put(&sysfs_entry->kobj);
}
}
/*

View File

@@ -0,0 +1,27 @@
/* SPDX-License-Identifier: GPL-2.0 */
#undef TRACE_SYSTEM
#define TRACE_SYSTEM dmabuf
#undef TRACE_INCLUDE_PATH
#define TRACE_INCLUDE_PATH trace/hooks
#if !defined(_TRACE_HOOK_DMABUF_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_HOOK_DMABUF_H
#include <trace/hooks/vendor_hooks.h>
#ifdef __GENKSYMS__
struct dma_buf_sysfs_entry;
#else
/* struct dma_buf_sysfs_entry */
#include <linux/dma-buf.h>
#endif
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);
#endif /* _TRACE_HOOK_DMABUF_H */
/* This part must be outside protection */
#include <trace/define_trace.h>