From 5addce7b3362025715ff32e1d7d9fa103015cef1 Mon Sep 17 00:00:00 2001 From: wei li Date: Tue, 13 May 2025 16:08:42 +0800 Subject: [PATCH] ANDROID: GKI:Add VendorHook for ProbeTimeout The dpm_prepare and wait_for_device_probe functions may block for a long time in order to complete their probe. We need to add vendhook to monitor the execution time and locate the modules where the long blocking occurs. Bug: 417369065 Change-Id: I39b3dfdcf4cc8b95a5201d1ce49aec98002e62ce Signed-off-by: wei li --- drivers/android/vendor_hooks.c | 1 + drivers/base/power/main.c | 2 ++ include/trace/hooks/dtask.h | 4 ++++ 3 files changed, 7 insertions(+) diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index d87dbd27a382..74821c4dee98 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -154,6 +154,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_f2fs_restore_priority); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_f2fs_printk); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_f2fs_create); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_io_statistics); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_dpm_prepare); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_ogki_check_vip_status); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_ogki_task_util); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_ogki_uclamp_task_util); diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c index 4c3043f11d93..cc4fb6c83db0 100644 --- a/drivers/base/power/main.c +++ b/drivers/base/power/main.c @@ -1869,7 +1869,9 @@ int dpm_prepare(pm_message_t state) * disable probing of devices. This sync point is important at least * at boot time + hibernation restore. */ + trace_android_rvh_dpm_prepare(0); wait_for_device_probe(); + trace_android_rvh_dpm_prepare(1); /* * It is unsafe if probing of devices will happen during suspend or * hibernation and system behavior will be unpredictable in this case. diff --git a/include/trace/hooks/dtask.h b/include/trace/hooks/dtask.h index 52aae20f7136..628ff9d7e789 100644 --- a/include/trace/hooks/dtask.h +++ b/include/trace/hooks/dtask.h @@ -146,6 +146,10 @@ DECLARE_HOOK(android_vh_record_pcpu_rwsem_starttime, DECLARE_HOOK(android_vh_exit_check, TP_PROTO(struct task_struct *p), TP_ARGS(p)); + +DECLARE_RESTRICTED_HOOK(android_rvh_dpm_prepare, + TP_PROTO(int flag), + TP_ARGS(flag), 1); #endif /* _TRACE_HOOK_DTASK_H */ /* This part must be outside protection */