John Ogness
e37577ebbf
printk: Fail pr_flush() if before SYSTEM_SCHEDULING
A follow-up change adds pr_flush() to console unregistration.
However, with boot consoles unregistration can happen very
early if there are also regular consoles registering as well.
In this case the pr_flush() is not important because all
consoles are flushed when checking the initial console sequence
number.
Allow pr_flush() to fail if @system_state has not yet reached
SYSTEM_SCHEDULING. This avoids might_sleep() and msleep()
explosions that would otherwise occur:
[ 0.436739][ T0] printk: legacy console [ttyS0] enabled
[ 0.439820][ T0] printk: legacy bootconsole [earlyser0] disabled
[ 0.446822][ T0] BUG: scheduling while atomic: swapper/0/0/0x00000002
[ 0.450491][ T0] 1 lock held by swapper/0/0:
[ 0.457897][ T0] #0: ffffffff82ae5f88 (console_mutex){+.+.}-{4:4}, at: console_list_lock+0x20/0x70
[ 0.463141][ T0] Modules linked in:
[ 0.465307][ T0] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 6.10.0-rc1+ #372
[ 0.469394][ T0] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.14.0-2 04/01/2014
[ 0.474402][ T0] Call Trace:
[ 0.476246][ T0] <TASK>
[ 0.481473][ T0] dump_stack_lvl+0x93/0xb0
[ 0.483949][ T0] dump_stack+0x10/0x20
[ 0.486256][ T0] __schedule_bug+0x68/0x90
[ 0.488753][ T0] __schedule+0xb9b/0xd80
[ 0.491179][ T0] ? lock_release+0xb5/0x270
[ 0.493732][ T0] schedule+0x43/0x170
[ 0.495998][ T0] schedule_timeout+0xc5/0x1e0
[ 0.498634][ T0] ? __pfx_process_timeout+0x10/0x10
[ 0.501522][ T0] ? msleep+0x13/0x50
[ 0.503728][ T0] msleep+0x3c/0x50
[ 0.505847][ T0] __pr_flush.constprop.0.isra.0+0x56/0x500
[ 0.509050][ T0] ? _printk+0x58/0x80
[ 0.511332][ T0] ? lock_is_held_type+0x9c/0x110
[ 0.514106][ T0] unregister_console_locked+0xe1/0x450
[ 0.517144][ T0] register_console+0x509/0x620
[ 0.519827][ T0] ? __pfx_univ8250_console_init+0x10/0x10
[ 0.523042][ T0] univ8250_console_init+0x24/0x40
[ 0.525845][ T0] console_init+0x43/0x210
[ 0.528280][ T0] start_kernel+0x493/0x980
[ 0.530773][ T0] x86_64_start_reservations+0x18/0x30
[ 0.533755][ T0] x86_64_start_kernel+0xae/0xc0
[ 0.536473][ T0] common_startup_64+0x12c/0x138
[ 0.539210][ T0] </TASK>
And then the kernel goes into an infinite loop complaining about:
1. releasing a pinned lock
2. unpinning an unpinned lock
3. bad: scheduling from the idle thread!
4. goto 1
Signed-off-by: John Ogness <john.ogness@linutronix.de>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Link: https://lore.kernel.org/r/20240904120536.115780-3-john.ogness@linutronix.de
Signed-off-by: Petr Mladek <pmladek@suse.com>
2024-09-04 15:56:32 +02:00
..
2024-08-12 18:09:48 -07:00
2024-07-14 18:04:03 -10:00
2024-07-03 12:24:19 +02:00
2024-06-21 15:49:29 +01:00
2024-08-06 10:29:32 -07:00
2024-03-12 13:23:32 +01:00
2024-08-13 10:25:28 -07:00
2024-05-06 17:39:09 +02:00
2024-06-15 10:43:06 -07:00
2024-08-07 17:27:00 +02:00
2024-06-06 11:21:14 -07:00
2024-07-02 16:56:18 +02:00
2024-08-21 15:03:04 +02:00
2024-08-09 08:33:28 -07:00
2024-07-03 19:30:01 -07:00
2024-09-04 15:56:32 +02:00
2024-08-21 15:03:04 +02:00
2024-08-04 13:36:28 -07:00
2024-08-05 16:14:14 +02:00
2024-08-09 12:59:35 -04:00
2024-04-24 09:43:53 +02:00
2024-02-09 11:13:59 -10:00
2024-04-04 16:24:16 +02:00
2024-04-04 16:24:16 +02:00
2024-01-25 10:12:22 -05:00
2024-06-13 14:26:50 -04:00
2023-10-13 18:34:46 +02:00
2024-06-24 22:24:55 -07:00
2024-04-29 08:29:29 -07:00
2023-08-08 16:48:47 -04:00
2024-03-22 11:18:18 +01:00
2024-08-13 10:31:24 +10:00
2024-05-19 14:02:03 -07:00
2024-08-15 22:16:16 -07:00
2024-02-23 17:33:31 -05:00
2024-07-24 20:59:29 +02:00
2024-02-23 17:48:22 -08:00
2024-07-21 17:15:46 -07:00
2023-09-21 12:03:50 -06:00
2024-08-12 22:03:26 +02:00
2023-12-23 15:52:13 +01:00
2024-05-30 01:13:20 +09:00
2023-09-29 11:28:39 -07:00
2024-07-24 20:59:29 +02:00
2023-08-21 13:37:28 -07:00
2024-07-31 12:57:39 +02:00
2024-07-20 16:33:21 +09:00
2024-08-15 09:33:35 -07:00
2024-08-15 09:33:35 -07:00
2023-10-19 11:02:48 +02:00
2024-02-23 17:48:22 -08:00
2024-08-07 18:33:56 -07:00
2024-07-24 20:59:29 +02:00
2024-04-23 14:59:01 +10:00
2024-02-23 17:48:22 -08:00
2024-04-23 14:59:01 +10:00
2024-08-05 14:04:03 +09:00
2024-07-29 10:45:54 -07:00
2024-05-06 14:22:02 -06:00
2024-07-24 20:59:29 +02:00
2024-02-23 17:48:22 -08:00
2024-03-01 12:23:37 +01:00
2023-12-20 19:26:30 -05:00
2024-08-07 18:33:56 -07:00
2024-08-21 15:03:04 +02:00
2023-12-01 09:51:44 -08:00
2024-07-24 20:59:29 +02:00
2024-07-24 20:59:29 +02:00
2024-03-13 12:53:53 -07:00
2024-08-04 13:36:28 -07:00
2024-02-22 15:38:52 -08:00
2024-04-24 09:43:53 +02:00
2024-04-25 21:07:03 -07:00
2023-12-29 12:22:27 -08:00
2024-06-28 19:36:30 -07:00
2024-05-28 11:14:14 -05:00
2024-05-30 15:31:51 -07:00
2024-07-24 20:59:29 +02:00
2024-07-11 01:51:44 -06:00
2024-07-10 22:40:39 +02:00
2023-10-04 10:41:57 -07:00
2024-04-29 05:03:51 +02:00
2024-07-24 20:59:29 +02:00
2023-12-29 12:22:29 -08:00
2024-07-18 12:19:20 -07:00
2024-05-22 09:56:00 -07:00
2024-06-03 15:20:37 +02:00
2024-07-24 20:59:29 +02:00
2024-07-29 12:05:06 -07:00
2023-10-04 10:41:57 -07:00
2024-05-30 15:31:38 -07:00
2024-07-12 16:39:53 -07:00
2024-05-17 17:31:24 -07:00
2024-07-24 20:59:29 +02:00
2023-09-13 14:59:24 +02:00
2024-02-22 15:38:52 -08:00
2024-05-06 17:39:09 +02:00
2024-07-24 20:59:29 +02:00
2024-05-22 08:31:15 -04:00
2024-07-20 16:33:21 +09:00
2023-12-21 13:17:54 +01:00
2024-07-17 21:11:34 -07:00
2024-07-24 20:59:29 +02:00
2023-08-07 15:57:22 -10:00
2024-07-15 14:01:14 -10:00