ANDROID: vendor_hooks: Add hooks for mutex

Due to the existence of optimistic spin, we need to
sense whether the owner of the lock has changed in the loop,
so as to do priority inheritance on the owner more accurately,
trace_android_vh_mutex_wait_start does not meet our needs.

Bug: 231647361
Change-Id: Iab2832fd3c352d8c1229348a5e7befced70ee92e
Signed-off-by: Liujie Xie <xieliujie@oppo.com>
This commit is contained in:
Liujie Xie
2022-05-20 10:57:27 +08:00
parent a27d9caa6a
commit 8c3ac02bca
3 changed files with 5 additions and 0 deletions

View File

@@ -243,6 +243,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_build_sched_domains);
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_end);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mutex_start_check_new_owner);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_rwsem_wake_finish);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_do_undefinstr);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_do_ptrauth_fault);

View File

@@ -57,6 +57,9 @@ DECLARE_HOOK(android_vh_mutex_unlock_slowpath,
DECLARE_HOOK(android_vh_mutex_unlock_slowpath_end,
TP_PROTO(struct mutex *lock, struct task_struct *next),
TP_ARGS(lock, next));
DECLARE_HOOK(android_vh_mutex_start_check_new_owner,
TP_PROTO(struct mutex *lock),
TP_ARGS(lock));
/* macro versions of hooks are no longer required */

View File

@@ -1049,6 +1049,7 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass,
goto err;
}
trace_android_vh_mutex_start_check_new_owner(lock);
spin_unlock(&lock->wait_lock);
schedule_preempt_disabled();