public inbox for linux-serial@vger.kernel.org
 help / color / mirror / Atom feed
* 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

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