cregit-Linux how code gets into the kernel

Release 4.7 kernel/locking/rtmutex-debug.c

Directory: kernel/locking
/*
 * 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/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

PersonTokensPropCommitsCommitProp
ingo molnaringo molnar3892.68%266.67%
pavel emelianovpavel emelianov37.32%133.33%
Total41100.00%3100.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

PersonTokensPropCommitsCommitProp
ingo molnaringo molnar85100.00%2100.00%
Total85100.00%2100.00%


void rt_mutex_debug_task_free(struct task_struct *task) { DEBUG_LOCKS_WARN_ON(!RB_EMPTY_ROOT(&task->pi_waiters)); DEBUG_LOCKS_WARN_ON(task->pi_blocked_on); }

Contributors

PersonTokensPropCommitsCommitProp
ingo molnaringo molnar2689.66%133.33%
thomas gleixnerthomas gleixner26.90%133.33%
peter zijlstrapeter zijlstra13.45%133.33%
Total29100.00%3100.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

PersonTokensPropCommitsCommitProp
ingo molnaringo molnar6182.43%125.00%
thomas gleixnerthomas gleixner79.46%250.00%
pavel emelianovpavel emelianov68.11%125.00%
Total74100.00%4100.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; } printk("\n============================================\n"); printk( "[ BUG: circular locking deadlock detected! ]\n"); printk("%s\n", print_tainted()); printk( "--------------------------------------------\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

PersonTokensPropCommitsCommitProp
ingo molnaringo molnar16375.81%228.57%
pavel emelianovpavel emelianov3214.88%228.57%
thomas gleixnerthomas gleixner125.58%228.57%
ben hutchingsben hutchings83.72%114.29%
Total215100.00%7100.00%


void debug_rt_mutex_lock(struct rt_mutex *lock) { }

Contributors

PersonTokensPropCommitsCommitProp
ingo molnaringo molnar9100.00%2100.00%
Total9100.00%2100.00%


void debug_rt_mutex_unlock(struct rt_mutex *lock) { DEBUG_LOCKS_WARN_ON(rt_mutex_owner(lock) != current); }

Contributors

PersonTokensPropCommitsCommitProp
ingo molnaringo molnar1995.00%150.00%
thomas gleixnerthomas gleixner15.00%150.00%
Total20100.00%2100.00%


void debug_rt_mutex_proxy_lock(struct rt_mutex *lock, struct task_struct *powner) { }

Contributors

PersonTokensPropCommitsCommitProp
ingo molnaringo molnar14100.00%2100.00%
Total14100.00%2100.00%


void debug_rt_mutex_proxy_unlock(struct rt_mutex *lock) { DEBUG_LOCKS_WARN_ON(!rt_mutex_owner(lock)); }

Contributors

PersonTokensPropCommitsCommitProp
ingo molnaringo molnar1894.74%266.67%
thomas gleixnerthomas gleixner15.26%133.33%
Total19100.00%3100.00%


void debug_rt_mutex_init_waiter(struct rt_mutex_waiter *waiter) { memset(waiter, 0x11, sizeof(*waiter)); waiter->deadlock_task_pid = NULL; }

Contributors

PersonTokensPropCommitsCommitProp
ingo molnaringo molnar2379.31%150.00%
pavel emelianovpavel emelianov620.69%150.00%
Total29100.00%2100.00%


void debug_rt_mutex_free_waiter(struct rt_mutex_waiter *waiter) { put_pid(waiter->deadlock_task_pid); memset(waiter, 0x22, sizeof(*waiter)); }

Contributors

PersonTokensPropCommitsCommitProp
ingo molnaringo molnar2376.67%150.00%
pavel emelianovpavel emelianov723.33%150.00%
Total30100.00%2100.00%


void debug_rt_mutex_init(struct rt_mutex *lock, const char *name) { /* * Make sure we are not reinitializing a held lock: */ debug_check_no_locks_freed((void *)lock, sizeof(*lock)); lock->name = name; }

Contributors

PersonTokensPropCommitsCommitProp
ingo molnaringo molnar37100.00%2100.00%
Total37100.00%2100.00%


void rt_mutex_deadlock_account_lock(struct rt_mutex *lock, struct task_struct *task) { }

Contributors

PersonTokensPropCommitsCommitProp
ingo molnaringo molnar14100.00%2100.00%
Total14100.00%2100.00%


void rt_mutex_deadlock_account_unlock(struct task_struct *task) { }

Contributors

PersonTokensPropCommitsCommitProp
ingo molnaringo molnar9100.00%1100.00%
Total9100.00%1100.00%


Overall Contributors

PersonTokensPropCommitsCommitProp
ingo molnaringo molnar57286.27%325.00%
pavel emelianovpavel emelianov548.14%216.67%
thomas gleixnerthomas gleixner233.47%325.00%
ben hutchingsben hutchings81.21%18.33%
clark williamsclark williams30.45%18.33%
peter zijlstrapeter zijlstra20.30%18.33%
paul gortmakerpaul gortmaker10.15%18.33%
Total663100.00%12100.00%
Directory: kernel/locking
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.
{% endraw %}