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 e4923174ba
commit 34e03c38fd
3 changed files with 14 additions and 2 deletions

View File

@@ -401,6 +401,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_tune_inactive_ratio);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_check_hibernation_swap);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_save_cpu_resume);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_save_hib_resume_bdev);
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)
@@ -122,13 +124,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

@@ -26,6 +26,11 @@ DECLARE_HOOK(android_vh_dmabuf_heap_flags_validation,
TP_PROTO(struct dma_heap *heap, size_t len,
unsigned int fd_flags, unsigned int heap_flags, bool *skip),
TP_ARGS(heap, len, fd_flags, heap_flags, skip));
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);
#endif /* _TRACE_HOOK_DMABUF_H */
/* This part must be outside protection */
#include <trace/define_trace.h>