From: Andrew Morton <akpm@linux-foundation.org>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org,
sched-ext@lists.linux.dev, netdev@vger.kernel.org,
"David S . Miller" <davem@davemloft.net>,
Andrea Righi <arighi@nvidia.com>, Arnd Bergmann <arnd@arndb.de>,
Ben Segall <bsegall@google.com>, Breno Leitao <leitao@debian.org>,
Changwoo Min <changwoo@igalia.com>,
David Vernet <void@manifault.com>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
Eric Dumazet <edumazet@google.com>,
Ingo Molnar <mingo@redhat.com>, Jakub Kicinski <kuba@kernel.org>,
John Ogness <john.ogness@linutronix.de>,
Juri Lelli <juri.lelli@redhat.com>,
K Prateek Nayak <kprateek.nayak@amd.com>,
Paolo Abeni <pabeni@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
Petr Mladek <pmladek@suse.com>,
Sergey Senozhatsky <senozhatsky@chromium.org>,
Simon Horman <horms@kernel.org>,
Steven Rostedt <rostedt@goodmis.org>, Tejun Heo <tj@kernel.org>,
Vincent Guittot <vincent.guittot@linaro.org>,
Vlad Poenaru <vlad.wing@gmail.com>
Subject: Re: [PATCH 1/2] bug: Provide WARN_ON.*DEFERRED() macros for console deferred output
Date: Tue, 23 Jun 2026 08:12:58 -0700 [thread overview]
Message-ID: <20260623081258.580e034fdb5b98f4f8dba44a@linux-foundation.org> (raw)
In-Reply-To: <20260623142650.265721-2-bigeasy@linutronix.de>
On Tue, 23 Jun 2026 16:26:49 +0200 Sebastian Andrzej Siewior <bigeasy@linutronix.de> wrote:
> Provide a deferred version of the WARN_ON() macro. It will delay
> flushing the console until a later context. It is needed in a context
> where the caller holds locks which can lead to a deadlock content is
> flushed to the console driver.
> An example would from a warning from within the scheduler resulting in a
> wake-up of a task.
>
> Deferring the output works by using printk_deferred_enter/ exit() around
> the printing output. This must be used in a context where the task can't
> migrate to another CPU. This should be the case usually, since the
> scheduler would acquire the rq lock whith disabled interrupts, but to be
> safe preemption is disabled to guarantee this.
>
> In order not to bloat the code on architectures which provide an
> optimized __WARN_FLAGS() define BUGFLAG_DEFERRED which is handled by
> __report_bug() and does not increase the code size.
>
> Provide the DEFERRED macros based on __WARN_FLAGS and __WARN_FLAGS
> macros. Extend __report_bug() to handle the deferred case.
>
> ...
>
> --- a/include/asm-generic/bug.h
> +++ b/include/asm-generic/bug.h
> @@ -229,7 +230,10 @@ static enum bug_trap_type __report_bug(struct bug_entry *bug, unsigned long buga
> */
> bug->flags |= BUGFLAG_DONE;
> }
> -
> + if (deferred) {
> + preempt_disable_notrace();
> + printk_deferred_enter();
> + }
For some reason the comment over printk_deferred_enter() says
"Interrupts must be disabled for the deferred duration". Is that the
case for all the printk_deferred_enter() calls which this patch adds?
next prev parent reply other threads:[~2026-06-23 15:13 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-23 14:26 [PATCH 0/2] sched: Introduce and use deferred WARNs in sched Sebastian Andrzej Siewior
2026-06-23 14:26 ` [PATCH 1/2] bug: Provide WARN_ON.*DEFERRED() macros for console deferred output Sebastian Andrzej Siewior
2026-06-23 14:54 ` K Prateek Nayak
2026-06-23 15:12 ` Andrew Morton [this message]
2026-06-23 15:49 ` Petr Mladek
2026-06-23 14:26 ` [PATCH 2/2] sched: Use WARN_ON.*_DEFERRED() Sebastian Andrzej Siewior
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=20260623081258.580e034fdb5b98f4f8dba44a@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=arighi@nvidia.com \
--cc=arnd@arndb.de \
--cc=bigeasy@linutronix.de \
--cc=bsegall@google.com \
--cc=changwoo@igalia.com \
--cc=davem@davemloft.net \
--cc=dietmar.eggemann@arm.com \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=john.ogness@linutronix.de \
--cc=juri.lelli@redhat.com \
--cc=kprateek.nayak@amd.com \
--cc=kuba@kernel.org \
--cc=leitao@debian.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=peterz@infradead.org \
--cc=pmladek@suse.com \
--cc=rostedt@goodmis.org \
--cc=sched-ext@lists.linux.dev \
--cc=senozhatsky@chromium.org \
--cc=tj@kernel.org \
--cc=vincent.guittot@linaro.org \
--cc=vlad.wing@gmail.com \
--cc=void@manifault.com \
/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