History

lockdep: Mark emergency sections in lockdep splats

Mark emergency sections wherever multiple lines of lock debugging output are generated. In an emergency section, every printk() call will attempt to directly flush to the consoles using the EMERGENCY priority. 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).

John Ogness committed 2 years ago

Commit 59cd94e1 parent 8c032731 file · +81 −2Browse files

Unified · Split

kernel/locking/lockdep.c+81−2
@@ -56,6 +56,7 @@ · 55 unmodified lines
56#include <linux/kprobes.h>56#include <linux/kprobes.h>
57#include <linux/lockdep.h>57#include <linux/lockdep.h>
58#include <linux/context_tracking.h>58#include <linux/context_tracking.h>
59#include <linux/console.h>
59 60
60#include <asm/sections.h>61#include <asm/sections.h>
61 62
@@ -573,8 +574,10 @@ static struct lock_trace *save_trace(void) · 511 unmodified lines
573 if (!debug_locks_off_graph_unlock())574 if (!debug_locks_off_graph_unlock())
574 return NULL;575 return NULL;
575 576
577 nbcon_cpu_emergency_enter();
576 print_lockdep_off("BUG: MAX_STACK_TRACE_ENTRIES too low!");578 print_lockdep_off("BUG: MAX_STACK_TRACE_ENTRIES too low!");
577 dump_stack();579 dump_stack();
580 nbcon_cpu_emergency_exit();
578 581
579 return NULL;582 return NULL;
580 }583 }
@@ -887,11 +890,13 @@ look_up_lock_class(const struct lockdep_map *lock, unsigned int subclass) · 306 unmodified lines
887 if (unlikely(subclass >= MAX_LOCKDEP_SUBCLASSES)) {890 if (unlikely(subclass >= MAX_LOCKDEP_SUBCLASSES)) {
888 instrumentation_begin();891 instrumentation_begin();
889 debug_locks_off();892 debug_locks_off();
893 nbcon_cpu_emergency_enter();
890 printk(KERN_ERR894 printk(KERN_ERR
891 "BUG: looking up invalid subclass: %u\n", subclass);895 "BUG: looking up invalid subclass: %u\n", subclass);
892 printk(KERN_ERR896 printk(KERN_ERR
893 "turning off the locking correctness validator.\n");897 "turning off the locking correctness validator.\n");
894 dump_stack();898 dump_stack();
899 nbcon_cpu_emergency_exit();
895 instrumentation_end();900 instrumentation_end();
896 return NULL;901 return NULL;
897 }902 }
@@ -968,11 +973,13 @@ static bool assign_lock_key(struct lockdep_map *lock) · 70 unmodified lines
968 else {973 else {
969 /* Debug-check: all keys must be persistent! */974 /* Debug-check: all keys must be persistent! */
970 debug_locks_off();975 debug_locks_off();
976 nbcon_cpu_emergency_enter();
971 pr_err("INFO: trying to register non-static key.\n");977 pr_err("INFO: trying to register non-static key.\n");
972 pr_err("The code is fine but needs lockdep annotation, or maybe\n");978 pr_err("The code is fine but needs lockdep annotation, or maybe\n");
973 pr_err("you didn't initialize this object before use?\n");979 pr_err("you didn't initialize this object before use?\n");
974 pr_err("turning off the locking correctness validator.\n");980 pr_err("turning off the locking correctness validator.\n");
975 dump_stack();981 dump_stack();
982 nbcon_cpu_emergency_exit();
976 return false;983 return false;
977 }984 }
978 985
@@ -1316,8 +1323,10 @@ register_lock_class(struct lockdep_map *lock, unsigned int subclass, int force) · 337 unmodified lines
1316 return NULL;1323 return NULL;
1317 }1324 }
1318 1325
1326 nbcon_cpu_emergency_enter();
1319 print_lockdep_off("BUG: MAX_LOCKDEP_KEYS too low!");1327 print_lockdep_off("BUG: MAX_LOCKDEP_KEYS too low!");
1320 dump_stack();1328 dump_stack();
1329 nbcon_cpu_emergency_exit();
1321 return NULL;1330 return NULL;
1322 }1331 }
1323 nr_lock_classes++;1332 nr_lock_classes++;
@@ -1349,11 +1358,13 @@ register_lock_class(struct lockdep_map *lock, unsigned int subclass, int force) · 25 unmodified lines
1349 if (verbose(class)) {1358 if (verbose(class)) {
1350 graph_unlock();1359 graph_unlock();
1351 1360
1361 nbcon_cpu_emergency_enter();
1352 printk("\nnew class %px: %s", class->key, class->name);1362 printk("\nnew class %px: %s", class->key, class->name);
1353 if (class->name_version > 1)1363 if (class->name_version > 1)
1354 printk(KERN_CONT "#%d", class->name_version);1364 printk(KERN_CONT "#%d", class->name_version);
1355 printk(KERN_CONT "\n");1365 printk(KERN_CONT "\n");
1356 dump_stack();1366 dump_stack();
1367 nbcon_cpu_emergency_exit();
1357 1368
1358 if (!graph_lock()) {1369 if (!graph_lock()) {
1359 return NULL;1370 return NULL;
@@ -1392,8 +1403,10 @@ static struct lock_list *alloc_list_entry(void) · 32 unmodified lines
1392 if (!debug_locks_off_graph_unlock())1403 if (!debug_locks_off_graph_unlock())
1393 return NULL;1404 return NULL;
1394 1405
1406 nbcon_cpu_emergency_enter();
1395 print_lockdep_off("BUG: MAX_LOCKDEP_ENTRIES too low!");1407 print_lockdep_off("BUG: MAX_LOCKDEP_ENTRIES too low!");
1396 dump_stack();1408 dump_stack();
1409 nbcon_cpu_emergency_exit();
1397 return NULL;1410 return NULL;
1398 }1411 }
1399 nr_list_entries++;1412 nr_list_entries++;
@@ -2039,6 +2052,8 @@ static noinline void print_circular_bug(struct lock_list *this, · 639 unmodified lines
2039 2052
2040 depth = get_lock_depth(target);2053 depth = get_lock_depth(target);
2041 2054
2055 nbcon_cpu_emergency_enter();
2056
2042 print_circular_bug_header(target, depth, check_src, check_tgt);2057 print_circular_bug_header(target, depth, check_src, check_tgt);
2043 2058
2044 parent = get_lock_parent(target);2059 parent = get_lock_parent(target);
@@ -2057,6 +2072,8 @@ static noinline void print_circular_bug(struct lock_list *this, · 12 unmodified lines
2057 2072
2058 printk("\nstack backtrace:\n");2073 printk("\nstack backtrace:\n");
2059 dump_stack();2074 dump_stack();
2075
2076 nbcon_cpu_emergency_exit();
2060}2077}
2061 2078
2062static noinline void print_bfs_bug(int ret)2079static noinline void print_bfs_bug(int ret)
@@ -2569,6 +2586,8 @@ print_bad_irq_dependency(struct task_struct *curr, · 506 unmodified lines
2569 if (!debug_locks_off_graph_unlock() || debug_locks_silent)2586 if (!debug_locks_off_graph_unlock() || debug_locks_silent)
2570 return;2587 return;
2571 2588
2589 nbcon_cpu_emergency_enter();
2590
2572 pr_warn("\n");2591 pr_warn("\n");
2573 pr_warn("=====================================================\n");2592 pr_warn("=====================================================\n");
2574 pr_warn("WARNING: %s-safe -> %s-unsafe lock order detected\n",2593 pr_warn("WARNING: %s-safe -> %s-unsafe lock order detected\n",
@@ -2618,11 +2637,13 @@ print_bad_irq_dependency(struct task_struct *curr, · 43 unmodified lines
2618 pr_warn(" and %s-irq-unsafe lock:\n", irqclass);2637 pr_warn(" and %s-irq-unsafe lock:\n", irqclass);
2619 next_root->trace = save_trace();2638 next_root->trace = save_trace();
2620 if (!next_root->trace)2639 if (!next_root->trace)
2621 return;2640 goto out;
2622 print_shortest_lock_dependencies(forwards_entry, next_root);2641 print_shortest_lock_dependencies(forwards_entry, next_root);
2623 2642
2624 pr_warn("\nstack backtrace:\n");2643 pr_warn("\nstack backtrace:\n");
2625 dump_stack();2644 dump_stack();
2645out:
2646 nbcon_cpu_emergency_exit();
2626}2647}
2627 2648
2628static const char *state_names[] = {2649static const char *state_names[] = {
@@ -2987,6 +3008,8 @@ print_deadlock_bug(struct task_struct *curr, struct held_lock *prev, · 358 unmodified lines
2987 if (!debug_locks_off_graph_unlock() || debug_locks_silent)3008 if (!debug_locks_off_graph_unlock() || debug_locks_silent)
2988 return;3009 return;
2989 3010
3011 nbcon_cpu_emergency_enter();
3012
2990 pr_warn("\n");3013 pr_warn("\n");
2991 pr_warn("============================================\n");3014 pr_warn("============================================\n");
2992 pr_warn("WARNING: possible recursive locking detected\n");3015 pr_warn("WARNING: possible recursive locking detected\n");
@@ -3009,6 +3032,8 @@ print_deadlock_bug(struct task_struct *curr, struct held_lock *prev, · 16 unmodified lines
3009 3032
3010 pr_warn("\nstack backtrace:\n");3033 pr_warn("\nstack backtrace:\n");
3011 dump_stack();3034 dump_stack();
3035
3036 nbcon_cpu_emergency_exit();
3012}3037}
3013 3038
3014/*3039/*
@@ -3606,6 +3631,8 @@ static void print_collision(struct task_struct *curr, · 591 unmodified lines
3606 struct held_lock *hlock_next,3631 struct held_lock *hlock_next,
3607 struct lock_chain *chain)3632 struct lock_chain *chain)
3608{3633{
3634 nbcon_cpu_emergency_enter();
3635
3609 pr_warn("\n");3636 pr_warn("\n");
3610 pr_warn("============================\n");3637 pr_warn("============================\n");
3611 pr_warn("WARNING: chain_key collision\n");3638 pr_warn("WARNING: chain_key collision\n");
@@ -3622,6 +3649,8 @@ static void print_collision(struct task_struct *curr, · 10 unmodified lines
3622 3649
3623 pr_warn("\nstack backtrace:\n");3650 pr_warn("\nstack backtrace:\n");
3624 dump_stack();3651 dump_stack();
3652
3653 nbcon_cpu_emergency_exit();
3625}3654}
3626#endif3655#endif
3627 3656
@@ -3712,8 +3741,10 @@ static inline int add_chain_cache(struct task_struct *curr, · 84 unmodified lines
3712 if (!debug_locks_off_graph_unlock())3741 if (!debug_locks_off_graph_unlock())
3713 return 0;3742 return 0;
3714 3743
3744 nbcon_cpu_emergency_enter();
3715 print_lockdep_off("BUG: MAX_LOCKDEP_CHAINS too low!");3745 print_lockdep_off("BUG: MAX_LOCKDEP_CHAINS too low!");
3716 dump_stack();3746 dump_stack();
3747 nbcon_cpu_emergency_exit();
3717 return 0;3748 return 0;
3718 }3749 }
3719 chain->chain_key = chain_key;3750 chain->chain_key = chain_key;
@@ -3730,8 +3761,10 @@ static inline int add_chain_cache(struct task_struct *curr, · 10 unmodified lines
3730 if (!debug_locks_off_graph_unlock())3761 if (!debug_locks_off_graph_unlock())
3731 return 0;3762 return 0;
3732 3763
3764 nbcon_cpu_emergency_enter();
3733 print_lockdep_off("BUG: MAX_LOCKDEP_CHAIN_HLOCKS too low!");3765 print_lockdep_off("BUG: MAX_LOCKDEP_CHAIN_HLOCKS too low!");
3734 dump_stack();3766 dump_stack();
3767 nbcon_cpu_emergency_exit();
3735 return 0;3768 return 0;
3736 }3769 }
3737 3770
@@ -3970,6 +4003,8 @@ print_usage_bug(struct task_struct *curr, struct held_lock *this, · 232 unmodified lines
3970 if (!debug_locks_off() || debug_locks_silent)4003 if (!debug_locks_off() || debug_locks_silent)
3971 return;4004 return;
3972 4005
4006 nbcon_cpu_emergency_enter();
4007
3973 pr_warn("\n");4008 pr_warn("\n");
3974 pr_warn("================================\n");4009 pr_warn("================================\n");
3975 pr_warn("WARNING: inconsistent lock state\n");4010 pr_warn("WARNING: inconsistent lock state\n");
@@ -3998,6 +4033,8 @@ print_usage_bug(struct task_struct *curr, struct held_lock *this, · 22 unmodified lines
3998 4033
3999 pr_warn("\nstack backtrace:\n");4034 pr_warn("\nstack backtrace:\n");
4000 dump_stack();4035 dump_stack();
4036
4037 nbcon_cpu_emergency_exit();
4001}4038}
4002 4039
4003/*4040/*
@@ -4032,6 +4069,8 @@ print_irq_inversion_bug(struct task_struct *curr, · 28 unmodified lines
4032 if (!debug_locks_off_graph_unlock() || debug_locks_silent)4069 if (!debug_locks_off_graph_unlock() || debug_locks_silent)
4033 return;4070 return;
4034 4071
4072 nbcon_cpu_emergency_enter();
4073
4035 pr_warn("\n");4074 pr_warn("\n");
4036 pr_warn("========================================================\n");4075 pr_warn("========================================================\n");
4037 pr_warn("WARNING: possible irq lock inversion dependency detected\n");4076 pr_warn("WARNING: possible irq lock inversion dependency detected\n");
@@ -4072,11 +4111,13 @@ print_irq_inversion_bug(struct task_struct *curr, · 34 unmodified lines
4072 pr_warn("\nthe shortest dependencies between 2nd lock and 1st lock:\n");4111 pr_warn("\nthe shortest dependencies between 2nd lock and 1st lock:\n");
4073 root->trace = save_trace();4112 root->trace = save_trace();
4074 if (!root->trace)4113 if (!root->trace)
4075 return;4114 goto out;
4076 print_shortest_lock_dependencies(other, root);4115 print_shortest_lock_dependencies(other, root);
4077 4116
4078 pr_warn("\nstack backtrace:\n");4117 pr_warn("\nstack backtrace:\n");
4079 dump_stack();4118 dump_stack();
4119out:
4120 nbcon_cpu_emergency_exit();
4080}4121}
4081 4122
4082/*4123/*
@@ -4153,6 +4194,8 @@ void print_irqtrace_events(struct task_struct *curr) · 70 unmodified lines
4153{4194{
4154 const struct irqtrace_events *trace = &curr->irqtrace;4195 const struct irqtrace_events *trace = &curr->irqtrace;
4155 4196
4197 nbcon_cpu_emergency_enter();
4198
4156 printk("irq event stamp: %u\n", trace->irq_events);4199 printk("irq event stamp: %u\n", trace->irq_events);
4157 printk("hardirqs last enabled at (%u): [<%px>] %pS\n",4200 printk("hardirqs last enabled at (%u): [<%px>] %pS\n",
4158 trace->hardirq_enable_event, (void *)trace->hardirq_enable_ip,4201 trace->hardirq_enable_event, (void *)trace->hardirq_enable_ip,
@@ -4166,6 +4209,8 @@ void print_irqtrace_events(struct task_struct *curr) · 7 unmodified lines
4166 printk("softirqs last disabled at (%u): [<%px>] %pS\n",4209 printk("softirqs last disabled at (%u): [<%px>] %pS\n",
4167 trace->softirq_disable_event, (void *)trace->softirq_disable_ip,4210 trace->softirq_disable_event, (void *)trace->softirq_disable_ip,
4168 (void *)trace->softirq_disable_ip);4211 (void *)trace->softirq_disable_ip);
4212
4213 nbcon_cpu_emergency_exit();
4169}4214}
4170 4215
4171static int HARDIRQ_verbose(struct lock_class *class)4216static int HARDIRQ_verbose(struct lock_class *class)
@@ -4686,10 +4731,12 @@ unlock: · 514 unmodified lines
4686 * We must printk outside of the graph_lock:4731 * We must printk outside of the graph_lock:
4687 */4732 */
4688 if (ret == 2) {4733 if (ret == 2) {
4734 nbcon_cpu_emergency_enter();
4689 printk("\nmarked lock as {%s}:\n", usage_str[new_bit]);4735 printk("\nmarked lock as {%s}:\n", usage_str[new_bit]);
4690 print_lock(this);4736 print_lock(this);
4691 print_irqtrace_events(curr);4737 print_irqtrace_events(curr);
4692 dump_stack();4738 dump_stack();
4739 nbcon_cpu_emergency_exit();
4693 }4740 }
4694 4741
4695 return ret;4742 return ret;
@@ -4730,6 +4777,8 @@ print_lock_invalid_wait_context(struct task_struct *curr, · 34 unmodified lines
4730 if (debug_locks_silent)4777 if (debug_locks_silent)
4731 return 0;4778 return 0;
4732 4779
4780 nbcon_cpu_emergency_enter();
4781
4733 pr_warn("\n");4782 pr_warn("\n");
4734 pr_warn("=============================\n");4783 pr_warn("=============================\n");
4735 pr_warn("[ BUG: Invalid wait context ]\n");4784 pr_warn("[ BUG: Invalid wait context ]\n");
@@ -4749,6 +4798,8 @@ print_lock_invalid_wait_context(struct task_struct *curr, · 13 unmodified lines
4749 pr_warn("stack backtrace:\n");4798 pr_warn("stack backtrace:\n");
4750 dump_stack();4799 dump_stack();
4751 4800
4801 nbcon_cpu_emergency_exit();
4802
4752 return 0;4803 return 0;
4753}4804}
4754 4805
@@ -4956,6 +5007,8 @@ print_lock_nested_lock_not_held(struct task_struct *curr, · 201 unmodified lines
4956 if (debug_locks_silent)5007 if (debug_locks_silent)
4957 return;5008 return;
4958 5009
5010 nbcon_cpu_emergency_enter();
5011
4959 pr_warn("\n");5012 pr_warn("\n");
4960 pr_warn("==================================\n");5013 pr_warn("==================================\n");
4961 pr_warn("WARNING: Nested lock was not taken\n");5014 pr_warn("WARNING: Nested lock was not taken\n");
@@ -4976,6 +5029,8 @@ print_lock_nested_lock_not_held(struct task_struct *curr, · 14 unmodified lines
4976 5029
4977 pr_warn("\nstack backtrace:\n");5030 pr_warn("\nstack backtrace:\n");
4978 dump_stack();5031 dump_stack();
5032
5033 nbcon_cpu_emergency_exit();
4979}5034}
4980 5035
4981static int __lock_is_held(const struct lockdep_map *lock, int read);5036static int __lock_is_held(const struct lockdep_map *lock, int read);
@@ -5024,11 +5079,13 @@ static int __lock_acquire(struct lockdep_map *lock, unsigned int subclass, · 42 unmodified lines
5024 debug_class_ops_inc(class);5079 debug_class_ops_inc(class);
5025 5080
5026 if (very_verbose(class)) {5081 if (very_verbose(class)) {
5082 nbcon_cpu_emergency_enter();
5027 printk("\nacquire class [%px] %s", class->key, class->name);5083 printk("\nacquire class [%px] %s", class->key, class->name);
5028 if (class->name_version > 1)5084 if (class->name_version > 1)
5029 printk(KERN_CONT "#%d", class->name_version);5085 printk(KERN_CONT "#%d", class->name_version);
5030 printk(KERN_CONT "\n");5086 printk(KERN_CONT "\n");
5031 dump_stack();5087 dump_stack();
5088 nbcon_cpu_emergency_exit();
5032 }5089 }
5033 5090
5034 /*5091 /*
@@ -5155,6 +5212,7 @@ static int __lock_acquire(struct lockdep_map *lock, unsigned int subclass, · 120 unmodified lines
5155#endif5212#endif
5156 if (unlikely(curr->lockdep_depth >= MAX_LOCK_DEPTH)) {5213 if (unlikely(curr->lockdep_depth >= MAX_LOCK_DEPTH)) {
5157 debug_locks_off();5214 debug_locks_off();
5215 nbcon_cpu_emergency_enter();
5158 print_lockdep_off("BUG: MAX_LOCK_DEPTH too low!");5216 print_lockdep_off("BUG: MAX_LOCK_DEPTH too low!");
5159 printk(KERN_DEBUG "depth: %i max: %lu!\n",5217 printk(KERN_DEBUG "depth: %i max: %lu!\n",
5160 curr->lockdep_depth, MAX_LOCK_DEPTH);5218 curr->lockdep_depth, MAX_LOCK_DEPTH);
@@ -5162,6 +5220,7 @@ static int __lock_acquire(struct lockdep_map *lock, unsigned int subclass, · 1 unmodified line
5162 lockdep_print_held_locks(current);5220 lockdep_print_held_locks(current);
5163 debug_show_all_locks();5221 debug_show_all_locks();
5164 dump_stack();5222 dump_stack();
5223 nbcon_cpu_emergency_exit();
5165 5224
5166 return 0;5225 return 0;
5167 }5226 }
@@ -5181,6 +5240,8 @@ static void print_unlock_imbalance_bug(struct task_struct *curr, · 13 unmodified lines
5181 if (debug_locks_silent)5240 if (debug_locks_silent)
5182 return;5241 return;
5183 5242
5243 nbcon_cpu_emergency_enter();
5244
5184 pr_warn("\n");5245 pr_warn("\n");
5185 pr_warn("=====================================\n");5246 pr_warn("=====================================\n");
5186 pr_warn("WARNING: bad unlock balance detected!\n");5247 pr_warn("WARNING: bad unlock balance detected!\n");
@@ -5197,6 +5258,8 @@ static void print_unlock_imbalance_bug(struct task_struct *curr, · 10 unmodified lines
5197 5258
5198 pr_warn("\nstack backtrace:\n");5259 pr_warn("\nstack backtrace:\n");
5199 dump_stack();5260 dump_stack();
5261
5262 nbcon_cpu_emergency_exit();
5200}5263}
5201 5264
5202static noinstr int match_held_lock(const struct held_lock *hlock,5265static noinstr int match_held_lock(const struct held_lock *hlock,
@@ -5901,6 +5964,8 @@ static void print_lock_contention_bug(struct task_struct *curr, · 698 unmodified lines
5901 if (debug_locks_silent)5964 if (debug_locks_silent)
5902 return;5965 return;
5903 5966
5967 nbcon_cpu_emergency_enter();
5968
5904 pr_warn("\n");5969 pr_warn("\n");
5905 pr_warn("=================================\n");5970 pr_warn("=================================\n");
5906 pr_warn("WARNING: bad contention detected!\n");5971 pr_warn("WARNING: bad contention detected!\n");
@@ -5917,6 +5982,8 @@ static void print_lock_contention_bug(struct task_struct *curr, · 10 unmodified lines
5917 5982
5918 pr_warn("\nstack backtrace:\n");5983 pr_warn("\nstack backtrace:\n");
5919 dump_stack();5984 dump_stack();
5985
5986 nbcon_cpu_emergency_exit();
5920}5987}
5921 5988
5922static void5989static void
@@ -6536,6 +6603,8 @@ print_freed_lock_bug(struct task_struct *curr, const void *mem_from, · 613 unmodified lines
6536 if (debug_locks_silent)6603 if (debug_locks_silent)
6537 return;6604 return;
6538 6605
6606 nbcon_cpu_emergency_enter();
6607
6539 pr_warn("\n");6608 pr_warn("\n");
6540 pr_warn("=========================\n");6609 pr_warn("=========================\n");
6541 pr_warn("WARNING: held lock freed!\n");6610 pr_warn("WARNING: held lock freed!\n");
@@ -6548,6 +6617,8 @@ print_freed_lock_bug(struct task_struct *curr, const void *mem_from, · 6 unmodified lines
6548 6617
6549 pr_warn("\nstack backtrace:\n");6618 pr_warn("\nstack backtrace:\n");
6550 dump_stack();6619 dump_stack();
6620
6621 nbcon_cpu_emergency_exit();
6551}6622}
6552 6623
6553static inline int not_in_range(const void* mem_from, unsigned long mem_len,6624static inline int not_in_range(const void* mem_from, unsigned long mem_len,
@@ -6594,6 +6665,8 @@ static void print_held_locks_bug(void) · 40 unmodified lines
6594 if (debug_locks_silent)6665 if (debug_locks_silent)
6595 return;6666 return;
6596 6667
6668 nbcon_cpu_emergency_enter();
6669
6597 pr_warn("\n");6670 pr_warn("\n");
6598 pr_warn("====================================\n");6671 pr_warn("====================================\n");
6599 pr_warn("WARNING: %s/%d still has locks held!\n",6672 pr_warn("WARNING: %s/%d still has locks held!\n",
@@ -6603,6 +6676,8 @@ static void print_held_locks_bug(void) · 3 unmodified lines
6603 lockdep_print_held_locks(current);6676 lockdep_print_held_locks(current);
6604 pr_warn("\nstack backtrace:\n");6677 pr_warn("\nstack backtrace:\n");
6605 dump_stack();6678 dump_stack();
6679
6680 nbcon_cpu_emergency_exit();
6606}6681}
6607 6682
6608void debug_check_no_locks_held(void)6683void debug_check_no_locks_held(void)
@@ -6660,6 +6735,7 @@ asmlinkage __visible void lockdep_sys_exit(void) · 51 unmodified lines
6660 if (unlikely(curr->lockdep_depth)) {6735 if (unlikely(curr->lockdep_depth)) {
6661 if (!debug_locks_off())6736 if (!debug_locks_off())
6662 return;6737 return;
6738 nbcon_cpu_emergency_enter();
6663 pr_warn("\n");6739 pr_warn("\n");
6664 pr_warn("================================================\n");6740 pr_warn("================================================\n");
6665 pr_warn("WARNING: lock held when returning to user space!\n");6741 pr_warn("WARNING: lock held when returning to user space!\n");
@@ -6668,6 +6744,7 @@ asmlinkage __visible void lockdep_sys_exit(void) · 2 unmodified lines
6668 pr_warn("%s/%d is leaving the kernel with locks still held!\n",6744 pr_warn("%s/%d is leaving the kernel with locks still held!\n",
6669 curr->comm, curr->pid);6745 curr->comm, curr->pid);
6670 lockdep_print_held_locks(curr);6746 lockdep_print_held_locks(curr);
6747 nbcon_cpu_emergency_exit();
6671 }6748 }
6672 6749
6673 /*6750 /*
@@ -6684,6 +6761,7 @@ void lockdep_rcu_suspicious(const char *file, const int line, const char *s) · 10 unmodified lines
6684 bool rcu = warn_rcu_enter();6761 bool rcu = warn_rcu_enter();
6685 6762
6686 /* Note: the following can be executed concurrently, so be careful. */6763 /* Note: the following can be executed concurrently, so be careful. */
6764 nbcon_cpu_emergency_enter();
6687 pr_warn("\n");6765 pr_warn("\n");
6688 pr_warn("=============================\n");6766 pr_warn("=============================\n");
6689 pr_warn("WARNING: suspicious RCU usage\n");6767 pr_warn("WARNING: suspicious RCU usage\n");
@@ -6722,6 +6800,7 @@ void lockdep_rcu_suspicious(const char *file, const int line, const char *s) · 32 unmodified lines
6722 lockdep_print_held_locks(curr);6800 lockdep_print_held_locks(curr);
6723 pr_warn("\nstack backtrace:\n");6801 pr_warn("\nstack backtrace:\n");
6724 dump_stack();6802 dump_stack();
6803 nbcon_cpu_emergency_exit();
6725 warn_rcu_exit(rcu);6804 warn_rcu_exit(rcu);
6726}6805}
6727EXPORT_SYMBOL_GPL(lockdep_rcu_suspicious);6806EXPORT_SYMBOL_GPL(lockdep_rcu_suspicious);