From: Nam Cao <namcao@linutronix.de>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jiri Slaby <jirislaby@kernel.org>,
Nicolas Pitre <npitre@baylibre.com>,
Calixte Pernot <calixte.pernot@grenoble-inp.org>,
Petr Mladek <pmladek@suse.com>,
Steven Rostedt <rostedt@goodmis.org>,
John Ogness <john.ogness@linutronix.de>,
Sergey Senozhatsky <senozhatsky@chromium.org>,
Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
Clark Williams <clrkwllms@kernel.org>
Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-rt-devel@lists.linux.dev
Subject: printk, vt: sleep from invalid context bug
Date: Tue, 17 Feb 2026 09:14:12 +0700 [thread overview]
Message-ID: <87v7fwdsln.fsf@yellow.woof> (raw)
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
next reply other threads:[~2026-02-17 2:14 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-17 2:14 Nam Cao [this message]
2026-02-17 7:07 ` printk, vt: sleep from invalid context bug Sebastian Andrzej Siewior
2026-02-17 8:54 ` Petr Mladek
2026-02-18 0:51 ` Nam Cao
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87v7fwdsln.fsf@yellow.woof \
--to=namcao@linutronix.de \
--cc=bigeasy@linutronix.de \
--cc=calixte.pernot@grenoble-inp.org \
--cc=clrkwllms@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=jirislaby@kernel.org \
--cc=john.ogness@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rt-devel@lists.linux.dev \
--cc=linux-serial@vger.kernel.org \
--cc=npitre@baylibre.com \
--cc=pmladek@suse.com \
--cc=rostedt@goodmis.org \
--cc=senozhatsky@chromium.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.