Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
contrib: add helpers to dump call stacks of a mutex owner and waiters.
These don't have tets cases so can't go under helpers. I have put these under contrib so that they are available for use. python3 -m drgn -s vmlinux -c vmcore contrib/locks.py --help usage: locks.py [-h] lock_type info_type [locks ...] positional arguments: lock_type type of lock i.e mutex. semaphore, rwsemaphore etc. info_type "owner" or "waiter" or "all" locks list of lock addresses options: -h, --help show this help message and exit For example following command will give us call stack for owner waiters of specified mutex(es): python3 -m drgn -s vmlinux -c vmcore contrib/locks.py mutex all ffffffffc0143400 .................. Dumping call stack for waiter of mutex: ffffffffc0143400 call stack for pid: 215 #0 context_switch (kernel/sched/core.c:5238:2) osandov#1 __schedule (kernel/sched/core.c:6551:8) osandov#2 schedule (kernel/sched/core.c:6627:3) osandov#3 schedule_preempt_disabled (kernel/sched/core.c:6686:2) osandov#4 __mutex_lock_common (kernel/locking/mutex.c:679:3) osandov#5 __mutex_lock (kernel/locking/mutex.c:747:9) osandov#6 0xffffffffc01411f6 .................. call stack for pid: 216 #0 context_switch (kernel/sched/core.c:5238:2) osandov#1 __schedule (kernel/sched/core.c:6551:8) osandov#2 schedule (kernel/sched/core.c:6627:3) osandov#3 schedule_preempt_disabled (kernel/sched/core.c:6686:2) osandov#4 __mutex_lock_common (kernel/locking/mutex.c:679:3) osandov#5 __mutex_lock (kernel/locking/mutex.c:747:9) osandov#6 0xffffffffc014112b .................. Dumping call stack for owner of mutex: ffffffffc0143400 call stack for pid: 214 #0 delay_tsc (arch/x86/lib/delay.c:79:3) osandov#1 0xffffffffc0141308 .................. Signed-off-by: Imran Khan <[email protected]>
- Loading branch information