ANDROID: vendor_hooks: add hook in __mutex_unlock_slowpath()

This hook is used to modify the variables in mutex oemdata when the task releases mutex lock.
This code cannot be done in existing hook trace_android_vh_mutex_unlock_slowpath(), because it is executed after wake_up_q, and there is a risk that the mutex object has been freed.

Bug: 362700382
Bug: 363173652

Change-Id: I7787c0ea51959642a010891606b2bc39fe056dd2
Signed-off-by: zhujingpeng <zhujingpeng@vivo.com>
Signed-off-by: renchenghan <renchenghan@vivo.corp-partner.google.com>
(cherry picked from commit 9f6bd03727ea509b05d49f4203d8de3585469a6c)
This commit is contained in:
zhujingpeng
2024-08-28 21:50:56 +08:00
committed by Treehugger Robot
parent 0a5f832202
commit 7e57c2b115
3 changed files with 5 additions and 0 deletions
+1
View File
@@ -297,6 +297,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_rwsem_downgrade_wake_finish);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_rwsem_wake_finish);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_alter_mutex_list_add);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mutex_unlock_slowpath);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mutex_unlock_slowpath_before_wakeq);
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);
+3
View File
@@ -117,6 +117,9 @@ DECLARE_HOOK(android_vh_alter_mutex_list_add,
DECLARE_HOOK(android_vh_mutex_unlock_slowpath,
TP_PROTO(struct mutex *lock),
TP_ARGS(lock));
DECLARE_HOOK(android_vh_mutex_unlock_slowpath_before_wakeq,
TP_PROTO(struct mutex *lock),
TP_ARGS(lock));
DECLARE_HOOK(android_vh_record_mutex_lock_starttime,
TP_PROTO(struct mutex *lock, unsigned long settime_jiffies),
+1
View File
@@ -1025,6 +1025,7 @@ static noinline void __sched __mutex_unlock_slowpath(struct mutex *lock, unsigne
if (sched_proxy_exec())
raw_spin_unlock(&current->blocked_lock);
trace_android_vh_mutex_unlock_slowpath_before_wakeq(lock);
preempt_disable();
raw_spin_unlock_irqrestore(&lock->wait_lock, flags);
wake_up_q(&wake_q);