Files
android_kernel_xiaomi_sm8450/include/trace/hooks/dtask.h
JINHO LIM 8219786218 ANDROID: vendor_hooks: set debugging data when rt_mutex is working
We already applied the 'vendor hook' for Dtask Debugging Information
in below issue.
(https://issuetracker.google.com/issues/162776704)

There are vendor hook call in mutex and rw_semaphore, but not for rt_mutex
Please refer to description in details as below,

1. Description
This feature writes rt mutex lock waiting information
on the task_struct structure. We can check mutex information and
mutex owner through the kernel log and custom analysis tools.
Like the previous feature in mutex and rw semaphore,
added data can be checked by ramdump analysis.

2. Vendor Hook Position
1) VENDOR_DATA
  - struct task_struct in sched.h

    VENDOR_DATA_ARRAY(2)

    [0] : type   // RTmutex (Mutex, Rwsem, ...)
    [1] : pointer   // address of lock
2) VENDOR_HOOKs
  - __rt_mutex_slowlock() in kernel/locking/rtmutex.c

3. Example
 - SysRq-w in kernel log
...
[   54.164463] [3:  kworker/u16:3:  253] kworker/3:2     D12736   418      2 0x00000228
[   54.164497] [3:  kworker/u16:3:  253] RTmutex: 0xffffffc051fa3ae8: owner[sh :9003]

[   54.167812] [3:  kworker/u16:3:  253] sh              D12848  9003   6900 0x04000200
[   54.167824] [3:  kworker/u16:3:  253] RTmutex: 0xffffffc051fa3b08: owner[kworker/3:2 :418]
...

Bug: 186567468

Signed-off-by: JINHO LIM <jordan.lim@samsung.com>
Change-Id: I93f9753be0b2c1fa1a6eaea09379d54c31d1ebcf
(cherry picked from commit e289faa9f12811d3546def3083bac0cc35c54ba8)
2021-05-07 00:12:54 +00:00

63 lines
1.8 KiB
C

/* SPDX-License-Identifier: GPL-2.0 */
#undef TRACE_SYSTEM
#define TRACE_SYSTEM dtask
#define TRACE_INCLUDE_PATH trace/hooks
#if !defined(_TRACE_HOOK_DTASK_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_HOOK_DTASK_H
#include <linux/tracepoint.h>
#include <trace/hooks/vendor_hooks.h>
/*
* Following tracepoints are not exported in tracefs and provide a
* mechanism for vendor modules to hook and extend functionality
*/
struct mutex;
DECLARE_HOOK(android_vh_mutex_wait_start,
TP_PROTO(struct mutex *lock),
TP_ARGS(lock));
DECLARE_HOOK(android_vh_mutex_wait_finish,
TP_PROTO(struct mutex *lock),
TP_ARGS(lock));
struct rt_mutex;
DECLARE_HOOK(android_vh_rtmutex_wait_start,
TP_PROTO(struct rt_mutex *lock),
TP_ARGS(lock));
DECLARE_HOOK(android_vh_rtmutex_wait_finish,
TP_PROTO(struct rt_mutex *lock),
TP_ARGS(lock));
struct rw_semaphore;
DECLARE_HOOK(android_vh_rwsem_read_wait_start,
TP_PROTO(struct rw_semaphore *sem),
TP_ARGS(sem));
DECLARE_HOOK(android_vh_rwsem_read_wait_finish,
TP_PROTO(struct rw_semaphore *sem),
TP_ARGS(sem));
DECLARE_HOOK(android_vh_rwsem_write_wait_start,
TP_PROTO(struct rw_semaphore *sem),
TP_ARGS(sem));
DECLARE_HOOK(android_vh_rwsem_write_wait_finish,
TP_PROTO(struct rw_semaphore *sem),
TP_ARGS(sem));
struct task_struct;
DECLARE_HOOK(android_vh_sched_show_task,
TP_PROTO(struct task_struct *task),
TP_ARGS(task));
DECLARE_HOOK(android_vh_alter_mutex_list_add,
TP_PROTO(struct mutex *lock,
struct mutex_waiter *waiter,
struct list_head *list,
bool *already_on_list),
TP_ARGS(lock, waiter, list, already_on_list));
DECLARE_HOOK(android_vh_mutex_unlock_slowpath,
TP_PROTO(struct mutex *lock),
TP_ARGS(lock));
/* macro versions of hooks are no longer required */
#endif /* _TRACE_HOOK_DTASK_H */
/* This part must be outside protection */
#include <trace/define_trace.h>