ANDROID: vendor_hook: add hooks to protect locking-tsk in cpu scheduler

Providing vendor hooks to record the start time of holding the lock, which
protects rwsem/mutex locking-process from being preemptedfor a short time
in some cases.

- android_vh_record_mutex_lock_starttime
- android_vh_record_rtmutex_lock_starttime
- android_vh_record_rwsem_lock_starttime
- android_vh_record_pcpu_rwsem_starttime

This commit is a combination of the following three commits.
https://android-review.googlesource.com/c/kernel/common/+/2579595
https://android-review.googlesource.com/c/kernel/common/+/2617070
https://android-review.googlesource.com/c/kernel/common/+/2694147

Bug: 241191475

Change-Id: If91859f558bf20c3297353bea8aadaa3ab4765e9
Signed-off-by: xieliujie <xieliujie@oppo.com>
This commit is contained in:
xieliujie
2025-02-12 16:17:09 +08:00
committed by Treehugger Robot
parent bcf4630798
commit 3d98011e2a
7 changed files with 68 additions and 5 deletions
+12
View File
@@ -113,6 +113,18 @@ DECLARE_HOOK(android_vh_mutex_unlock_slowpath,
TP_PROTO(struct mutex *lock),
TP_ARGS(lock));
DECLARE_HOOK(android_vh_record_mutex_lock_starttime,
TP_PROTO(struct task_struct *tsk, unsigned long settime_jiffies),
TP_ARGS(tsk, settime_jiffies));
DECLARE_HOOK(android_vh_record_rtmutex_lock_starttime,
TP_PROTO(struct task_struct *tsk, unsigned long settime_jiffies),
TP_ARGS(tsk, settime_jiffies));
DECLARE_HOOK(android_vh_record_rwsem_lock_starttime,
TP_PROTO(struct task_struct *tsk, unsigned long settime_jiffies),
TP_ARGS(tsk, settime_jiffies));
DECLARE_HOOK(android_vh_record_pcpu_rwsem_starttime,
TP_PROTO(struct task_struct *tsk, unsigned long settime_jiffies),
TP_ARGS(tsk, settime_jiffies));
#endif /* _TRACE_HOOK_DTASK_H */
/* This part must be outside protection */
#include <trace/define_trace.h>