summaryrefslogtreecommitdiffstats
path: root/debian/patches-rt/0029-lockdep-Mark-emergency-sections-in-lockdep-splats.patch
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--debian/patches-rt/0029-lockdep-Mark-emergency-sections-in-lockdep-splats.patch (renamed from debian/patches-rt/0032-lockdep-Mark-emergency-sections-in-lockdep-splats.patch)142
1 files changed, 58 insertions, 84 deletions
diff --git a/debian/patches-rt/0032-lockdep-Mark-emergency-sections-in-lockdep-splats.patch b/debian/patches-rt/0029-lockdep-Mark-emergency-sections-in-lockdep-splats.patch
index 64cf39b672..1f3ab33c45 100644
--- a/debian/patches-rt/0032-lockdep-Mark-emergency-sections-in-lockdep-splats.patch
+++ b/debian/patches-rt/0029-lockdep-Mark-emergency-sections-in-lockdep-splats.patch
@@ -1,7 +1,7 @@
From: John Ogness <john.ogness@linutronix.de>
Date: Mon, 18 Sep 2023 20:27:41 +0000
-Subject: [PATCH 32/48] lockdep: Mark emergency sections in lockdep splats
-Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/6.8/older/patches-6.8.2-rt11.tar.xz
+Subject: [PATCH 29/46] lockdep: Mark emergency sections in lockdep splats
+Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/6.9/older/patches-6.9-rt5.tar.xz
Mark emergency sections wherever multiple lines of
lock debugging output are generated. In an emergency
@@ -11,11 +11,17 @@ output is triggered when exiting the emergency section.
This allows the full message block to be stored as
quickly as possible in the ringbuffer.
+Note that debug_show_all_locks() and
+lockdep_print_held_locks() rely on their callers to
+enter the emergency section. This is because these
+functions can also be called in non-emergency
+situations (such as sysrq).
+
Signed-off-by: John Ogness <john.ogness@linutronix.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
- kernel/locking/lockdep.c | 91 +++++++++++++++++++++++++++++++++++++++++++++--
- 1 file changed, 88 insertions(+), 3 deletions(-)
+ kernel/locking/lockdep.c | 84 +++++++++++++++++++++++++++++++++++++++++++++--
+ 1 file changed, 82 insertions(+), 2 deletions(-)
--- a/kernel/locking/lockdep.c
+++ b/kernel/locking/lockdep.c
@@ -38,31 +44,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
return NULL;
}
-@@ -782,6 +785,8 @@ static void lockdep_print_held_locks(str
- {
- int i, depth = READ_ONCE(p->lockdep_depth);
-
-+ nbcon_cpu_emergency_enter();
-+
- if (!depth)
- printk("no locks held by %s/%d.\n", p->comm, task_pid_nr(p));
- else
-@@ -792,11 +797,13 @@ static void lockdep_print_held_locks(str
- * and it's not the current task.
- */
- if (p != current && task_is_running(p))
-- return;
-+ goto out;
- for (i = 0; i < depth; i++) {
- printk(" #%d: ", i);
- print_lock(p->held_locks + i);
- }
-+out:
-+ nbcon_cpu_emergency_exit();
- }
-
- static void print_kernel_ident(void)
-@@ -888,11 +895,13 @@ look_up_lock_class(const struct lockdep_
+@@ -888,11 +891,13 @@ look_up_lock_class(const struct lockdep_
if (unlikely(subclass >= MAX_LOCKDEP_SUBCLASSES)) {
instrumentation_begin();
debug_locks_off();
@@ -76,7 +58,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
instrumentation_end();
return NULL;
}
-@@ -969,11 +978,13 @@ static bool assign_lock_key(struct lockd
+@@ -969,11 +974,13 @@ static bool assign_lock_key(struct lockd
else {
/* Debug-check: all keys must be persistent! */
debug_locks_off();
@@ -90,7 +72,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
return false;
}
-@@ -1317,8 +1328,10 @@ register_lock_class(struct lockdep_map *
+@@ -1317,8 +1324,10 @@ register_lock_class(struct lockdep_map *
return NULL;
}
@@ -101,7 +83,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
return NULL;
}
nr_lock_classes++;
-@@ -1350,11 +1363,13 @@ register_lock_class(struct lockdep_map *
+@@ -1350,11 +1359,13 @@ register_lock_class(struct lockdep_map *
if (verbose(class)) {
graph_unlock();
@@ -115,7 +97,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
if (!graph_lock()) {
return NULL;
-@@ -1393,8 +1408,10 @@ static struct lock_list *alloc_list_entr
+@@ -1393,8 +1404,10 @@ static struct lock_list *alloc_list_entr
if (!debug_locks_off_graph_unlock())
return NULL;
@@ -126,7 +108,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
return NULL;
}
nr_list_entries++;
-@@ -2040,6 +2057,8 @@ static noinline void print_circular_bug(
+@@ -2040,6 +2053,8 @@ static noinline void print_circular_bug(
depth = get_lock_depth(target);
@@ -135,7 +117,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
print_circular_bug_header(target, depth, check_src, check_tgt);
parent = get_lock_parent(target);
-@@ -2058,6 +2077,8 @@ static noinline void print_circular_bug(
+@@ -2058,6 +2073,8 @@ static noinline void print_circular_bug(
printk("\nstack backtrace:\n");
dump_stack();
@@ -144,7 +126,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
}
static noinline void print_bfs_bug(int ret)
-@@ -2570,6 +2591,8 @@ print_bad_irq_dependency(struct task_str
+@@ -2570,6 +2587,8 @@ print_bad_irq_dependency(struct task_str
if (!debug_locks_off_graph_unlock() || debug_locks_silent)
return;
@@ -153,7 +135,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
pr_warn("\n");
pr_warn("=====================================================\n");
pr_warn("WARNING: %s-safe -> %s-unsafe lock order detected\n",
-@@ -2619,11 +2642,13 @@ print_bad_irq_dependency(struct task_str
+@@ -2619,11 +2638,13 @@ print_bad_irq_dependency(struct task_str
pr_warn(" and %s-irq-unsafe lock:\n", irqclass);
next_root->trace = save_trace();
if (!next_root->trace)
@@ -168,7 +150,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
}
static const char *state_names[] = {
-@@ -2988,6 +3013,8 @@ print_deadlock_bug(struct task_struct *c
+@@ -2988,6 +3009,8 @@ print_deadlock_bug(struct task_struct *c
if (!debug_locks_off_graph_unlock() || debug_locks_silent)
return;
@@ -177,7 +159,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
pr_warn("\n");
pr_warn("============================================\n");
pr_warn("WARNING: possible recursive locking detected\n");
-@@ -3010,6 +3037,8 @@ print_deadlock_bug(struct task_struct *c
+@@ -3010,6 +3033,8 @@ print_deadlock_bug(struct task_struct *c
pr_warn("\nstack backtrace:\n");
dump_stack();
@@ -186,7 +168,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
}
/*
-@@ -3607,6 +3636,8 @@ static void print_collision(struct task_
+@@ -3607,6 +3632,8 @@ static void print_collision(struct task_
struct held_lock *hlock_next,
struct lock_chain *chain)
{
@@ -195,7 +177,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
pr_warn("\n");
pr_warn("============================\n");
pr_warn("WARNING: chain_key collision\n");
-@@ -3623,6 +3654,8 @@ static void print_collision(struct task_
+@@ -3623,6 +3650,8 @@ static void print_collision(struct task_
pr_warn("\nstack backtrace:\n");
dump_stack();
@@ -204,7 +186,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
}
#endif
-@@ -3713,8 +3746,10 @@ static inline int add_chain_cache(struct
+@@ -3713,8 +3742,10 @@ static inline int add_chain_cache(struct
if (!debug_locks_off_graph_unlock())
return 0;
@@ -215,7 +197,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
return 0;
}
chain->chain_key = chain_key;
-@@ -3731,8 +3766,10 @@ static inline int add_chain_cache(struct
+@@ -3731,8 +3762,10 @@ static inline int add_chain_cache(struct
if (!debug_locks_off_graph_unlock())
return 0;
@@ -226,7 +208,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
return 0;
}
-@@ -3971,6 +4008,8 @@ print_usage_bug(struct task_struct *curr
+@@ -3971,6 +4004,8 @@ print_usage_bug(struct task_struct *curr
if (!debug_locks_off() || debug_locks_silent)
return;
@@ -235,7 +217,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
pr_warn("\n");
pr_warn("================================\n");
pr_warn("WARNING: inconsistent lock state\n");
-@@ -3999,6 +4038,8 @@ print_usage_bug(struct task_struct *curr
+@@ -3999,6 +4034,8 @@ print_usage_bug(struct task_struct *curr
pr_warn("\nstack backtrace:\n");
dump_stack();
@@ -244,7 +226,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
}
/*
-@@ -4033,6 +4074,8 @@ print_irq_inversion_bug(struct task_stru
+@@ -4033,6 +4070,8 @@ print_irq_inversion_bug(struct task_stru
if (!debug_locks_off_graph_unlock() || debug_locks_silent)
return;
@@ -253,7 +235,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
pr_warn("\n");
pr_warn("========================================================\n");
pr_warn("WARNING: possible irq lock inversion dependency detected\n");
-@@ -4073,11 +4116,13 @@ print_irq_inversion_bug(struct task_stru
+@@ -4073,11 +4112,13 @@ print_irq_inversion_bug(struct task_stru
pr_warn("\nthe shortest dependencies between 2nd lock and 1st lock:\n");
root->trace = save_trace();
if (!root->trace)
@@ -268,7 +250,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
}
/*
-@@ -4154,6 +4199,8 @@ void print_irqtrace_events(struct task_s
+@@ -4154,6 +4195,8 @@ void print_irqtrace_events(struct task_s
{
const struct irqtrace_events *trace = &curr->irqtrace;
@@ -277,7 +259,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
printk("irq event stamp: %u\n", trace->irq_events);
printk("hardirqs last enabled at (%u): [<%px>] %pS\n",
trace->hardirq_enable_event, (void *)trace->hardirq_enable_ip,
-@@ -4167,6 +4214,8 @@ void print_irqtrace_events(struct task_s
+@@ -4167,6 +4210,8 @@ void print_irqtrace_events(struct task_s
printk("softirqs last disabled at (%u): [<%px>] %pS\n",
trace->softirq_disable_event, (void *)trace->softirq_disable_ip,
(void *)trace->softirq_disable_ip);
@@ -286,7 +268,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
}
static int HARDIRQ_verbose(struct lock_class *class)
-@@ -4687,10 +4736,12 @@ static int mark_lock(struct task_struct
+@@ -4687,10 +4732,12 @@ static int mark_lock(struct task_struct
* We must printk outside of the graph_lock:
*/
if (ret == 2) {
@@ -299,7 +281,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
}
return ret;
-@@ -4731,6 +4782,8 @@ print_lock_invalid_wait_context(struct t
+@@ -4731,6 +4778,8 @@ print_lock_invalid_wait_context(struct t
if (debug_locks_silent)
return 0;
@@ -308,7 +290,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
pr_warn("\n");
pr_warn("=============================\n");
pr_warn("[ BUG: Invalid wait context ]\n");
-@@ -4750,6 +4803,8 @@ print_lock_invalid_wait_context(struct t
+@@ -4750,6 +4799,8 @@ print_lock_invalid_wait_context(struct t
pr_warn("stack backtrace:\n");
dump_stack();
@@ -317,7 +299,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
return 0;
}
-@@ -4954,6 +5009,8 @@ print_lock_nested_lock_not_held(struct t
+@@ -4954,6 +5005,8 @@ print_lock_nested_lock_not_held(struct t
if (debug_locks_silent)
return;
@@ -326,7 +308,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
pr_warn("\n");
pr_warn("==================================\n");
pr_warn("WARNING: Nested lock was not taken\n");
-@@ -4974,6 +5031,8 @@ print_lock_nested_lock_not_held(struct t
+@@ -4974,6 +5027,8 @@ print_lock_nested_lock_not_held(struct t
pr_warn("\nstack backtrace:\n");
dump_stack();
@@ -335,7 +317,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
}
static int __lock_is_held(const struct lockdep_map *lock, int read);
-@@ -5019,11 +5078,13 @@ static int __lock_acquire(struct lockdep
+@@ -5019,11 +5074,13 @@ static int __lock_acquire(struct lockdep
debug_class_ops_inc(class);
if (very_verbose(class)) {
@@ -349,7 +331,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
}
/*
-@@ -5150,6 +5211,7 @@ static int __lock_acquire(struct lockdep
+@@ -5150,6 +5207,7 @@ static int __lock_acquire(struct lockdep
#endif
if (unlikely(curr->lockdep_depth >= MAX_LOCK_DEPTH)) {
debug_locks_off();
@@ -357,7 +339,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
print_lockdep_off("BUG: MAX_LOCK_DEPTH too low!");
printk(KERN_DEBUG "depth: %i max: %lu!\n",
curr->lockdep_depth, MAX_LOCK_DEPTH);
-@@ -5157,6 +5219,7 @@ static int __lock_acquire(struct lockdep
+@@ -5157,6 +5215,7 @@ static int __lock_acquire(struct lockdep
lockdep_print_held_locks(current);
debug_show_all_locks();
dump_stack();
@@ -365,7 +347,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
return 0;
}
-@@ -5176,6 +5239,8 @@ static void print_unlock_imbalance_bug(s
+@@ -5176,6 +5235,8 @@ static void print_unlock_imbalance_bug(s
if (debug_locks_silent)
return;
@@ -374,7 +356,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
pr_warn("\n");
pr_warn("=====================================\n");
pr_warn("WARNING: bad unlock balance detected!\n");
-@@ -5192,6 +5257,8 @@ static void print_unlock_imbalance_bug(s
+@@ -5192,6 +5253,8 @@ static void print_unlock_imbalance_bug(s
pr_warn("\nstack backtrace:\n");
dump_stack();
@@ -383,7 +365,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
}
static noinstr int match_held_lock(const struct held_lock *hlock,
-@@ -5895,6 +5962,8 @@ static void print_lock_contention_bug(st
+@@ -5895,6 +5958,8 @@ static void print_lock_contention_bug(st
if (debug_locks_silent)
return;
@@ -392,7 +374,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
pr_warn("\n");
pr_warn("=================================\n");
pr_warn("WARNING: bad contention detected!\n");
-@@ -5911,6 +5980,8 @@ static void print_lock_contention_bug(st
+@@ -5911,6 +5976,8 @@ static void print_lock_contention_bug(st
pr_warn("\nstack backtrace:\n");
dump_stack();
@@ -401,7 +383,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
}
static void
-@@ -6524,6 +6595,8 @@ print_freed_lock_bug(struct task_struct
+@@ -6524,6 +6591,8 @@ print_freed_lock_bug(struct task_struct
if (debug_locks_silent)
return;
@@ -410,7 +392,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
pr_warn("\n");
pr_warn("=========================\n");
pr_warn("WARNING: held lock freed!\n");
-@@ -6536,6 +6609,8 @@ print_freed_lock_bug(struct task_struct
+@@ -6536,6 +6605,8 @@ print_freed_lock_bug(struct task_struct
pr_warn("\nstack backtrace:\n");
dump_stack();
@@ -419,7 +401,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
}
static inline int not_in_range(const void* mem_from, unsigned long mem_len,
-@@ -6582,6 +6657,8 @@ static void print_held_locks_bug(void)
+@@ -6582,6 +6653,8 @@ static void print_held_locks_bug(void)
if (debug_locks_silent)
return;
@@ -428,7 +410,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
pr_warn("\n");
pr_warn("====================================\n");
pr_warn("WARNING: %s/%d still has locks held!\n",
-@@ -6591,6 +6668,8 @@ static void print_held_locks_bug(void)
+@@ -6591,6 +6664,8 @@ static void print_held_locks_bug(void)
lockdep_print_held_locks(current);
pr_warn("\nstack backtrace:\n");
dump_stack();
@@ -437,23 +419,15 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
}
void debug_check_no_locks_held(void)
-@@ -6609,6 +6688,7 @@ void debug_show_all_locks(void)
- pr_warn("INFO: lockdep is turned off.\n");
- return;
+@@ -6616,6 +6691,7 @@ void debug_show_all_locks(void)
+ if (!p->lockdep_depth)
+ continue;
+ lockdep_print_held_locks(p);
++ nbcon_cpu_emergency_flush();
+ touch_nmi_watchdog();
+ touch_all_softlockup_watchdogs();
}
-+ nbcon_cpu_emergency_enter();
- pr_warn("\nShowing all locks held in the system:\n");
-
- rcu_read_lock();
-@@ -6623,6 +6703,7 @@ void debug_show_all_locks(void)
-
- pr_warn("\n");
- pr_warn("=============================================\n\n");
-+ nbcon_cpu_emergency_exit();
- }
- EXPORT_SYMBOL_GPL(debug_show_all_locks);
- #endif
-@@ -6648,6 +6729,7 @@ asmlinkage __visible void lockdep_sys_ex
+@@ -6648,6 +6724,7 @@ asmlinkage __visible void lockdep_sys_ex
if (unlikely(curr->lockdep_depth)) {
if (!debug_locks_off())
return;
@@ -461,7 +435,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
pr_warn("\n");
pr_warn("================================================\n");
pr_warn("WARNING: lock held when returning to user space!\n");
-@@ -6656,6 +6738,7 @@ asmlinkage __visible void lockdep_sys_ex
+@@ -6656,6 +6733,7 @@ asmlinkage __visible void lockdep_sys_ex
pr_warn("%s/%d is leaving the kernel with locks still held!\n",
curr->comm, curr->pid);
lockdep_print_held_locks(curr);
@@ -469,7 +443,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
}
/*
-@@ -6672,6 +6755,7 @@ void lockdep_rcu_suspicious(const char *
+@@ -6672,6 +6750,7 @@ void lockdep_rcu_suspicious(const char *
bool rcu = warn_rcu_enter();
/* Note: the following can be executed concurrently, so be careful. */
@@ -477,7 +451,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
pr_warn("\n");
pr_warn("=============================\n");
pr_warn("WARNING: suspicious RCU usage\n");
-@@ -6710,6 +6794,7 @@ void lockdep_rcu_suspicious(const char *
+@@ -6710,6 +6789,7 @@ void lockdep_rcu_suspicious(const char *
lockdep_print_held_locks(curr);
pr_warn("\nstack backtrace:\n");
dump_stack();