Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit 9f6bd03

Browse files
zhujingpengTreehugger Robot
authored andcommitted
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 Change-Id: I7787c0ea51959642a010891606b2bc39fe056dd2 Signed-off-by: zhujingpeng <[email protected]>
1 parent 8a0f09e commit 9f6bd03

File tree

3 files changed

+5
-0
lines changed

3 files changed

+5
-0
lines changed

drivers/android/vendor_hooks.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_panic_unhandled);
293293
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_gzvm_vcpu_exit_reason);
294294
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_alter_mutex_list_add);
295295
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mutex_unlock_slowpath);
296+
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mutex_unlock_slowpath_before_wakeq);
296297
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_save_track_hash);
297298
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_should_fault_around);
298299
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mem_cgroup_id_remove);

include/trace/hooks/dtask.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,9 @@ DECLARE_HOOK(android_vh_alter_mutex_list_add,
9797
DECLARE_HOOK(android_vh_mutex_unlock_slowpath,
9898
TP_PROTO(struct mutex *lock),
9999
TP_ARGS(lock));
100+
DECLARE_HOOK(android_vh_mutex_unlock_slowpath_before_wakeq,
101+
TP_PROTO(struct mutex *lock),
102+
TP_ARGS(lock));
100103

101104
DECLARE_HOOK(android_vh_exit_signal_whether_wake,
102105
TP_PROTO(struct task_struct *p, bool *wake),

kernel/locking/mutex.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -974,6 +974,7 @@ static noinline void __sched __mutex_unlock_slowpath(struct mutex *lock, unsigne
974974
if (owner & MUTEX_FLAG_HANDOFF)
975975
__mutex_handoff(lock, next);
976976

977+
trace_android_vh_mutex_unlock_slowpath_before_wakeq(lock);
977978
raw_spin_unlock(&lock->wait_lock);
978979

979980
wake_up_q(&wake_q);

0 commit comments

Comments
 (0)