Commit Graph

9 Commits

Author SHA1 Message Date
Greg Kroah-Hartman
486580ffb5 Revert "ANDROID: vendor_hooks: Add hooks for mutex"
This reverts commit 8c3ac02bca.

The hook android_vh_mutex_start_check_new_owner is not used by any
vendor, so remove it to help with merge issues with future LTS releases.

If this is needed by any real user, it can easily be reverted to add it
back and then the symbol should be added to the abi list at the same
time to prevent it from being removed again later.

Bug: 203756332
Bug: 231647361
Cc: Liujie Xie <xieliujie@oppo.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I8c3bf787525d684f64b8d0654d379df78eb7b69e
2022-08-24 17:07:08 +02:00
Peifeng Li
eed2741ae6 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_percpu_rwsem_lock_starttime

Bug: 241191475

Signed-off-by: Peifeng Li <lipeifeng@oppo.com>
Change-Id: I0e967a1e8b77c32a1ad588acd54028fae2f90c4e
2022-08-16 11:24:12 +00:00
Giuliano Procida
1590a0e8e1 ANDROID: GKI: include more type definitions in vendor hooks
The following types are now fully defined in ABI XML.

* `struct binder_transaction_data`
* `struct blk_mq_alloc_data`
* `struct media_link_desc`
* `struct packet_type`
* `struct printk_record`
* `struct printk_ringbuffer`

Bug: 233047575
Change-Id: Ib7a096c937cfa9facca89b8a26edd2f4b00416a1
Signed-off-by: Giuliano Procida <gprocida@google.com>
2022-06-23 18:21:44 +00:00
Liujie Xie
8c3ac02bca 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>
2022-05-21 07:57:12 +00:00
Liujie Xie
2f55d5cbe2 ANDROID: vendor_hooks: Add hooks for mutex
Current might be preempt after spin_unlock(&lock->wait_lock),
we want to add a hook after wake_up_q(&wake_q) in which to
disable owner's privilege in scheduler.

Bug: 231647361
Change-Id: I3016da2fd31b8bdc8435df4e800f91381a64af4f
Signed-off-by: Liujie Xie <xieliujie@oppo.com>
2022-05-06 14:09:25 +08:00
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
xieliujie
80b4341d05 ANDROID: vendor_hooks: Add hooks for rwsem and mutex
Add hooks to apply oem's optimization of rwsem and mutex

Bug: 182237112
Signed-off-by: xieliujie <xieliujie@oppo.com>
Change-Id: I6332623732e2d6826b8b61087ca74e55393e0c3d
2021-03-10 21:18:26 +00:00
Todd Kjos
10fc8b2584 ANDROID: simplify vendor hook definitions
Remove macro versions of hooks that are no longer needed. The
macro versions are still needed when the _rcuidle version
of the hook is used (as in include/trace/hooks/debug.h).

Bug: 177416721
Signed-off-by: Todd Kjos <tkjos@google.com>
Change-Id: I4b50447e9a922ed038663d1459d7622dab30ffbb
2021-01-27 09:45:26 +00:00
Sangmoon Kim
9ad8ff902e ANDROID: vendor_hooks: add waiting information for blocked tasks
- Add the hook to get mutex/rwsem information that the tasks
   are waiting for.

 - Add the hook to print messages for sched_show_task.

 - ANDROID_VENDOR_DATA_ARRAY added to task_struct

Bug: 162776704

Signed-off-by: Sangmoon Kim <sangmoon.kim@samsung.com>
Change-Id: Ib436fbd8d0ad509c3b5a73ea8f5170e0761a13fd
(cherry picked from commit b519ac4237)
2020-08-19 14:52:44 +00:00