Release 4.15 kernel/locking/rtmutex-debug.c
// SPDX-License-Identifier: GPL-2.0
/*
* RT-Mutexes: blocking mutual exclusion locks with PI support
*
* started by Ingo Molnar and Thomas Gleixner:
*
* Copyright (C) 2004-2006 Red Hat, Inc., Ingo Molnar <mingo@redhat.com>
* Copyright (C) 2006 Timesys Corp., Thomas Gleixner <tglx@timesys.com>
*
* This code is based on the rt.c implementation in the preempt-rt tree.
* Portions of said code are
*
* Copyright (C) 2004 LynuxWorks, Inc., Igor Manyilov, Bill Huey
* Copyright (C) 2006 Esben Nielsen
* Copyright (C) 2006 Kihon Technologies Inc.,
* Steven Rostedt <rostedt@goodmis.org>
*
* See rt.c in preempt-rt for proper credits and further information
*/
#include <linux/sched.h>
#include <linux/sched/rt.h>
#include <linux/sched/debug.h>
#include <linux/delay.h>
#include <linux/export.h>
#include <linux/spinlock.h>
#include <linux/kallsyms.h>
#include <linux/syscalls.h>
#include <linux/interrupt.h>
#include <linux/rbtree.h>
#include <linux/fs.h>
#include <linux/debug_locks.h>
#include "rtmutex_common.h"
static void printk_task(struct task_struct *p)
{
if (p)
printk("%16s:%5d [%p, %3d]", p->comm, task_pid_nr(p), p, p->prio);
else
printk("<none>");
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Ingo Molnar | 38 | 92.68% | 2 | 66.67% |
Pavel Emelyanov | 3 | 7.32% | 1 | 33.33% |
Total | 41 | 100.00% | 3 | 100.00% |
static void printk_lock(struct rt_mutex *lock, int print_owner)
{
if (lock->name)
printk(" [%p] {%s}\n",
lock, lock->name);
else
printk(" [%p] {%s:%d}\n",
lock, lock->file, lock->line);
if (print_owner && rt_mutex_owner(lock)) {
printk(".. ->owner: %p\n", lock->owner);
printk(".. held by: ");
printk_task(rt_mutex_owner(lock));
printk("\n");
}
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Ingo Molnar | 85 | 100.00% | 2 | 100.00% |
Total | 85 | 100.00% | 2 | 100.00% |
void rt_mutex_debug_task_free(struct task_struct *task)
{
DEBUG_LOCKS_WARN_ON(!RB_EMPTY_ROOT(&task->pi_waiters.rb_root));
DEBUG_LOCKS_WARN_ON(task->pi_blocked_on);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Ingo Molnar | 26 | 83.87% | 1 | 25.00% |
Thomas Gleixner | 2 | 6.45% | 1 | 25.00% |
Davidlohr Bueso A | 2 | 6.45% | 1 | 25.00% |
Peter Zijlstra | 1 | 3.23% | 1 | 25.00% |
Total | 31 | 100.00% | 4 | 100.00% |
/*
* We fill out the fields in the waiter to store the information about
* the deadlock. We print when we return. act_waiter can be NULL in
* case of a remove waiter operation.
*/
void debug_rt_mutex_deadlock(enum rtmutex_chainwalk chwalk,
struct rt_mutex_waiter *act_waiter,
struct rt_mutex *lock)
{
struct task_struct *task;
if (!debug_locks || chwalk == RT_MUTEX_FULL_CHAINWALK || !act_waiter)
return;
task = rt_mutex_owner(act_waiter->lock);
if (task && task != current) {
act_waiter->deadlock_task_pid = get_pid(task_pid(task));
act_waiter->deadlock_lock = lock;
}
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Ingo Molnar | 61 | 82.43% | 1 | 25.00% |
Thomas Gleixner | 7 | 9.46% | 2 | 50.00% |
Pavel Emelyanov | 6 | 8.11% | 1 | 25.00% |
Total | 74 | 100.00% | 4 | 100.00% |
void debug_rt_mutex_print_deadlock(struct rt_mutex_waiter *waiter)
{
struct task_struct *task;
if (!waiter->deadlock_lock || !debug_locks)
return;
rcu_read_lock();
task = pid_task(waiter->deadlock_task_pid, PIDTYPE_PID);
if (!task) {
rcu_read_unlock();
return;
}
if (!debug_locks_off()) {
rcu_read_unlock();
return;
}
pr_warn("\n");
pr_warn("============================================\n");
pr_warn("WARNING: circular locking deadlock detected!\n");
pr_warn("%s\n", print_tainted());
pr_warn("--------------------------------------------\n");
printk("%s/%d is deadlocking current task %s/%d\n\n",
task->comm, task_pid_nr(task),
current->comm, task_pid_nr(current));
printk("\n1) %s/%d is trying to acquire this lock:\n",
current->comm, task_pid_nr(current));
printk_lock(waiter->lock, 1);
printk("\n2) %s/%d is blocked on this lock:\n",
task->comm, task_pid_nr(task));
printk_lock(waiter->deadlock_lock, 1);
debug_show_held_locks(current);
debug_show_held_locks(task);
printk("\n%s/%d's [blocked] stackdump:\n\n",
task->comm, task_pid_nr(task));
show_stack(task, NULL);
printk("\n%s/%d's [current] stackdump:\n\n",
current->comm, task_pid_nr(current));
dump_stack();
debug_show_all_locks();
rcu_read_unlock();
printk("[ turning off deadlock detection."
"Please report this trace. ]\n\n");
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Ingo Molnar | 158 | 71.82% | 2 | 25.00% |
Pavel Emelyanov | 32 | 14.55% | 2 | 25.00% |
Thomas Gleixner | 12 | 5.45% | 2 | 25.00% |
Paul E. McKenney | 11 | 5.00% | 1 | 12.50% |
Ben Hutchings | 7 | 3.18% | 1 | 12.50% |
Total | 220 | 100.00% | 8 | 100.00% |
void debug_rt_mutex_lock(struct rt_mutex *lock)
{
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Ingo Molnar | 9 | 100.00% | 2 | 100.00% |
Total | 9 | 100.00% | 2 | 100.00% |
void debug_rt_mutex_unlock(struct rt_mutex *lock)
{
DEBUG_LOCKS_WARN_ON(rt_mutex_owner(lock) != current);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Ingo Molnar | 19 | 95.00% | 1 | 50.00% |
Thomas Gleixner | 1 | 5.00% | 1 | 50.00% |
Total | 20 | 100.00% | 2 | 100.00% |
void
debug_rt_mutex_proxy_lock(struct rt_mutex *lock, struct task_struct *powner)
{
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Ingo Molnar | 14 | 100.00% | 2 | 100.00% |
Total | 14 | 100.00% | 2 | 100.00% |
void debug_rt_mutex_proxy_unlock(struct rt_mutex *lock)
{
DEBUG_LOCKS_WARN_ON(!rt_mutex_owner(lock));
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Ingo Molnar | 18 | 94.74% | 2 | 66.67% |
Thomas Gleixner | 1 | 5.26% | 1 | 33.33% |
Total | 19 | 100.00% | 3 | 100.00% |
void debug_rt_mutex_init_waiter(struct rt_mutex_waiter *waiter)
{
memset(waiter, 0x11, sizeof(*waiter));
waiter->deadlock_task_pid = NULL;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Ingo Molnar | 23 | 79.31% | 1 | 50.00% |
Pavel Emelyanov | 6 | 20.69% | 1 | 50.00% |
Total | 29 | 100.00% | 2 | 100.00% |
void debug_rt_mutex_free_waiter(struct rt_mutex_waiter *waiter)
{
put_pid(waiter->deadlock_task_pid);
memset(waiter, 0x22, sizeof(*waiter));
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Ingo Molnar | 23 | 76.67% | 1 | 50.00% |
Pavel Emelyanov | 7 | 23.33% | 1 | 50.00% |
Total | 30 | 100.00% | 2 | 100.00% |
void debug_rt_mutex_init(struct rt_mutex *lock, const char *name, struct lock_class_key *key)
{
/*
* Make sure we are not reinitializing a held lock:
*/
debug_check_no_locks_freed((void *)lock, sizeof(*lock));
lock->name = name;
#ifdef CONFIG_DEBUG_LOCK_ALLOC
lockdep_init_map(&lock->dep_map, name, key, 0);
#endif
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Ingo Molnar | 37 | 60.66% | 2 | 66.67% |
Peter Zijlstra | 24 | 39.34% | 1 | 33.33% |
Total | 61 | 100.00% | 3 | 100.00% |
Overall Contributors
Person | Tokens | Prop | Commits | CommitProp |
Ingo Molnar | 547 | 81.04% | 4 | 23.53% |
Pavel Emelyanov | 54 | 8.00% | 2 | 11.76% |
Peter Zijlstra | 26 | 3.85% | 2 | 11.76% |
Thomas Gleixner | 23 | 3.41% | 3 | 17.65% |
Paul E. McKenney | 11 | 1.63% | 1 | 5.88% |
Ben Hutchings | 7 | 1.04% | 1 | 5.88% |
Clark Williams | 3 | 0.44% | 1 | 5.88% |
Davidlohr Bueso A | 2 | 0.30% | 1 | 5.88% |
Greg Kroah-Hartman | 1 | 0.15% | 1 | 5.88% |
Paul Gortmaker | 1 | 0.15% | 1 | 5.88% |
Total | 675 | 100.00% | 17 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.