From: John Ogness <john.ogness@linutronix.de>
To: Petr Mladek <pmladek@suse.com>
Cc: Marcos Paulo de Souza <mpdesouza@suse.com>,
Steven Rostedt <rostedt@goodmis.org>,
Sergey Senozhatsky <senozhatsky@chromium.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jiri Slaby <jirislaby@kernel.org>,
linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org
Subject: Re: [PATCH 1/2] printk: Introduce LOUD_CON flag
Date: Fri, 18 Oct 2024 09:20:19 +0206 [thread overview]
Message-ID: <847ca5rigk.fsf@jogness.linutronix.de> (raw)
In-Reply-To: <ZxDl-VcVAI8DGM40@pathway.suse.cz>
On 2024-10-17, Petr Mladek <pmladek@suse.com> wrote:
> # echo h >/proc/sysrq-trigger
>
> produced:
>
> [ 53.669907] BUG: assuming non migratable context at kernel/printk/printk_safe.c:23
> [ 53.669920] in_atomic(): 0, irqs_disabled(): 0, migration_disabled() 0 pid: 1637, name: bash
> [ 53.669931] 2 locks held by bash/1637:
> [ 53.669936] #0: ffff8ae680a384a8 (sb_writers#4){.+.+}-{0:0}, at: ksys_write+0x6e/0xf0
> [ 53.669968] #1: ffffffff83f226e0 (rcu_read_lock){....}-{1:3}, at: __handle_sysrq+0x3d/0x120
> [ 53.670002] CPU: 2 UID: 0 PID: 1637 Comm: bash Not tainted 6.12.0-rc3-default+ #67
> [ 53.670011] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.16.3-2-gc13ff2cd-prebuilt.qemu.org 04/01/2014
> [ 53.670020] Call Trace:
> [ 53.670026] <TASK>
> [ 53.670045] dump_stack_lvl+0x6c/0xa0
> [ 53.670064] __cant_migrate.cold+0x7c/0x89
> [ 53.670080] printk_loud_console_enter+0x15/0x30
> [ 53.670088] __handle_sysrq+0x60/0x120
> [ 53.670104] write_sysrq_trigger+0x6a/0xa0
> [ 53.670120] proc_reg_write+0x5f/0xb0
> [ 53.670132] vfs_write+0xf9/0x540
> [ 53.670147] ? __lock_release.isra.0+0x1a6/0x2c0
> [ 53.670172] ? do_user_addr_fault+0x38c/0x720
> [ 53.670197] ksys_write+0x6e/0xf0
> [ 53.670220] do_syscall_64+0x79/0x190
> [ 53.670238] entry_SYSCALL_64_after_hwframe+0x76/0x7e
>
> IMHO, the best solution would be to call migrate_disable()/enable()
> in printk_loud_console_enter()/exit().
That will not work because migrate_enable() can only be called from
can_sleep context. Instead, the migrate_disable()/enable() should be at
the few (one?) call sites where printk_loud_console_enter()/exit() is
used from task context.
This is also how printk_deferred_enter()/exit() works, relying on the
caller to disable migration if necessary.
John
next prev parent reply other threads:[~2024-10-18 7:14 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-16 17:03 [PATCH 0/2] printk: Add loud_console printk flag to not suppress sysrq header msgs Marcos Paulo de Souza
2024-10-16 17:03 ` [PATCH 1/2] printk: Introduce LOUD_CON flag Marcos Paulo de Souza
2024-10-16 18:11 ` John Ogness
2024-10-17 10:24 ` Petr Mladek
2024-10-18 7:14 ` John Ogness [this message]
2024-10-21 13:33 ` Petr Mladek
2024-10-21 14:11 ` John Ogness
2024-10-23 20:36 ` Marcos Paulo de Souza
2024-10-24 8:34 ` Petr Mladek
2024-10-18 12:11 ` Marcos Paulo de Souza
2024-10-19 1:28 ` kernel test robot
2024-10-16 17:03 ` [PATCH 2/2] tty: sysrq: Use printk_loud_console context on __handle_sysrq Marcos Paulo de Souza
2024-10-18 3:43 ` kernel test robot
2024-10-18 4:36 ` kernel test robot
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=847ca5rigk.fsf@jogness.linutronix.de \
--to=john.ogness@linutronix.de \
--cc=gregkh@linuxfoundation.org \
--cc=jirislaby@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=mpdesouza@suse.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).