* printk, vt: sleep from invalid context bug
@ 2026-02-17 2:14 Nam Cao
2026-02-17 7:07 ` Sebastian Andrzej Siewior
2026-02-17 8:54 ` Petr Mladek
0 siblings, 2 replies; 4+ messages in thread
From: Nam Cao @ 2026-02-17 2:14 UTC (permalink / raw)
To: Greg Kroah-Hartman, Jiri Slaby, Nicolas Pitre, Calixte Pernot,
Petr Mladek, Steven Rostedt, John Ogness, Sergey Senozhatsky,
Sebastian Andrzej Siewior, Clark Williams
Cc: linux-serial, linux-kernel, linux-rt-devel
Hi,
Since commit 1bc9a28f076f ("printk: Use console_flush_one_record for
legacy printer kthread"), I see this warning:
BUG: sleeping function called from invalid context at kernel/printk/printk.c:3431
in_atomic(): 0, irqs_disabled(): 0, non_block: 0, pid: 14, name: pr/legacy
preempt_count: 0, expected: 0
RCU nest depth: 1, expected: 0
4 locks held by pr/legacy/14:
#0: ffffffff807dcdf0 (console_lock){+.+.}-{0:0}, at: legacy_kthread_func+0x40/0x114
#1: ffffffff807dce30 (console_srcu){....}-{0:0}, at: console_flush_one_record+0x0/0x3c8
#2: ffffffff8083af88 (printing_lock){+.+.}-{3:3}, at: vt_console_print+0x48/0x330
#3: ffffffff807df2e8 (rcu_read_lock){....}-{1:3}, at: rt_spin_trylock+0x24/0x138
CPU: 0 UID: 0 PID: 14 Comm: pr/legacy Not tainted 6.19.0-rvvm-09292-g7449f86bafcd #79 PREEMPT_RT
Hardware name: RVVM v0.7-git-g8c45ccf (DT)
Call Trace:
walk_stackframe+0x0/0x80
dump_stack_lvl+0x4e/0x74
rt_spin_trylock+0x9e/0x138
__might_resched+0x19e/0x1e0
fbcon_redraw+0x74/0x1a0
fbcon_scroll+0xf2/0x13c
con_scroll+0x122/0x188
lf+0x6a/0x74
vt_console_print+0x2ac/0x330
console_flush_one_record+0x208/0x3c8
console_flush_one_record+0x3c4/0x3c8
kthread+0xc6/0x100
legacy_kthread_func+0x4c/0x114
prio_changed_stop+0xc/0x10
kthread+0xc6/0x100
ret_from_fork_kernel_asm+0x12/0x18
ret_from_fork_kernel+0xe/0x3fc
rt_spin_unlock+0x56/0x128
kthread_affine_node+0x88/0x8c
ret_from_fork_kernel_asm+0x12/0x18
If I understand it correctly, vt_console_print() grabs the spin lock
"printing_lock", and then calls fbcon_redraw() which does
console_conditional_schedule(), triggering the warning.
Nam
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: printk, vt: sleep from invalid context bug
2026-02-17 2:14 printk, vt: sleep from invalid context bug Nam Cao
@ 2026-02-17 7:07 ` Sebastian Andrzej Siewior
2026-02-17 8:54 ` Petr Mladek
1 sibling, 0 replies; 4+ messages in thread
From: Sebastian Andrzej Siewior @ 2026-02-17 7:07 UTC (permalink / raw)
To: Nam Cao
Cc: Greg Kroah-Hartman, Jiri Slaby, Nicolas Pitre, Calixte Pernot,
Petr Mladek, Steven Rostedt, John Ogness, Sergey Senozhatsky,
Clark Williams, linux-serial, linux-kernel, linux-rt-devel
On 2026-02-17 09:14:12 [+0700], Nam Cao wrote:
> Hi,
Hi,
> Since commit 1bc9a28f076f ("printk: Use console_flush_one_record for
> legacy printer kthread"), I see this warning:
https://lore.kernel.org/all/20260126180836.SNCdMW2f@linutronix.de/T/#u
Sebastian
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: printk, vt: sleep from invalid context bug
2026-02-17 2:14 printk, vt: sleep from invalid context bug Nam Cao
2026-02-17 7:07 ` Sebastian Andrzej Siewior
@ 2026-02-17 8:54 ` Petr Mladek
2026-02-18 0:51 ` Nam Cao
1 sibling, 1 reply; 4+ messages in thread
From: Petr Mladek @ 2026-02-17 8:54 UTC (permalink / raw)
To: Nam Cao
Cc: Greg Kroah-Hartman, Jiri Slaby, Nicolas Pitre, Calixte Pernot,
Steven Rostedt, John Ogness, Sergey Senozhatsky,
Sebastian Andrzej Siewior, Clark Williams, linux-serial,
linux-kernel, linux-rt-devel
On Tue 2026-02-17 09:14:12, Nam Cao wrote:
> Hi,
>
> Since commit 1bc9a28f076f ("printk: Use console_flush_one_record for
> legacy printer kthread"), I see this warning:
>
> BUG: sleeping function called from invalid context at kernel/printk/printk.c:3431
> in_atomic(): 0, irqs_disabled(): 0, non_block: 0, pid: 14, name: pr/legacy
> preempt_count: 0, expected: 0
> RCU nest depth: 1, expected: 0
> 4 locks held by pr/legacy/14:
> #0: ffffffff807dcdf0 (console_lock){+.+.}-{0:0}, at: legacy_kthread_func+0x40/0x114
> #1: ffffffff807dce30 (console_srcu){....}-{0:0}, at: console_flush_one_record+0x0/0x3c8
> #2: ffffffff8083af88 (printing_lock){+.+.}-{3:3}, at: vt_console_print+0x48/0x330
> #3: ffffffff807df2e8 (rcu_read_lock){....}-{1:3}, at: rt_spin_trylock+0x24/0x138
> CPU: 0 UID: 0 PID: 14 Comm: pr/legacy Not tainted 6.19.0-rvvm-09292-g7449f86bafcd #79 PREEMPT_RT
> Hardware name: RVVM v0.7-git-g8c45ccf (DT)
> Call Trace:
> walk_stackframe+0x0/0x80
> dump_stack_lvl+0x4e/0x74
> rt_spin_trylock+0x9e/0x138
> __might_resched+0x19e/0x1e0
> fbcon_redraw+0x74/0x1a0
> fbcon_scroll+0xf2/0x13c
> con_scroll+0x122/0x188
> lf+0x6a/0x74
> vt_console_print+0x2ac/0x330
> console_flush_one_record+0x208/0x3c8
> console_flush_one_record+0x3c4/0x3c8
> kthread+0xc6/0x100
> legacy_kthread_func+0x4c/0x114
> prio_changed_stop+0xc/0x10
> kthread+0xc6/0x100
> ret_from_fork_kernel_asm+0x12/0x18
> ret_from_fork_kernel+0xe/0x3fc
> rt_spin_unlock+0x56/0x128
> kthread_affine_node+0x88/0x8c
> ret_from_fork_kernel_asm+0x12/0x18
>
> If I understand it correctly, vt_console_print() grabs the spin lock
> "printing_lock", and then calls fbcon_redraw() which does
> console_conditional_schedule(), triggering the warning.
Sebastian has recently sent a patch which should remove the
cond_resched(), see
https://lore.kernel.org/all/20260126180836.SNCdMW2f@linutronix.de
It seems that the patch has made it upstream in this merge window
for 7.0, see the commit 8e9bf8b9e8c0 ("printk, vt, fbcon: Remove
console_conditional_schedule()").
Best Regards,
Petr
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: printk, vt: sleep from invalid context bug
2026-02-17 8:54 ` Petr Mladek
@ 2026-02-18 0:51 ` Nam Cao
0 siblings, 0 replies; 4+ messages in thread
From: Nam Cao @ 2026-02-18 0:51 UTC (permalink / raw)
To: Petr Mladek
Cc: Greg Kroah-Hartman, Jiri Slaby, Nicolas Pitre, Calixte Pernot,
Steven Rostedt, John Ogness, Sergey Senozhatsky,
Sebastian Andrzej Siewior, Clark Williams, linux-serial,
linux-kernel, linux-rt-devel
Petr Mladek <pmladek@suse.com> writes:
> Sebastian has recently sent a patch which should remove the
> cond_resched(), see
> https://lore.kernel.org/all/20260126180836.SNCdMW2f@linutronix.de
>
> It seems that the patch has made it upstream in this merge window
> for 7.0, see the commit 8e9bf8b9e8c0 ("printk, vt, fbcon: Remove
> console_conditional_schedule()").
Pulled and the problem goes away. Thanks Sebastian.
Nam
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-02-18 0:51 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-17 2:14 printk, vt: sleep from invalid context bug Nam Cao
2026-02-17 7:07 ` Sebastian Andrzej Siewior
2026-02-17 8:54 ` Petr Mladek
2026-02-18 0:51 ` Nam Cao
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox