Re: [PATCH 00/15] Implement CONFIG_DEBUG_BUGVERBOSE_DETAILED=y, to improve WARN_ON_ONCE() output by adding the condition string

From: Ingo Molnar
Date: Mon Jun 09 2025 - 03:52:30 EST



* David Laight <david.laight.linux@xxxxxxxxx> wrote:

> On Thu, 15 May 2025 14:46:29 +0200
> Ingo Molnar <mingo@xxxxxxxxxx> wrote:
>
> > Changes in -v2:
> >
> > - Incorporated review feedback:
> >
> > - Make the expanded strings conditional on the new
> > CONFIG_DEBUG_BUGVERBOSE_DETAILED=y switch, to address concerns
> > about the +100K kernel size increase, disabled by default.
> >
> > - Expanded the Cc: fields
> >
> > - Rebased to v6.15-rc6
> >
> > This tree can also be found at:
> >
> > git://git.kernel.org/pub/scm/linux/kernel/git/mingo/tip.git WIP.core/bugs
> >
> > Thanks,
> >
> > Ingo
> >
> > =========================>
> > Original -v1 announcement:
> >
> > This series improves the current WARN_ON_ONCE() output, if
> > the new CONFIG_DEBUG_BUGVERBOSE_DETAILED=y option is enabled,
> > from:
> >
> > WARN_ON_ONCE(idx < 0 && ptr);
> > ...
> >
> > WARNING: CPU: 0 PID: 0 at kernel/sched/core.c:8511 sched_init+0x20/0x410
>
> What happens if the condition contains #defines?
> Does it output what is in the source file, or the (bloated) expanded text?
> For instance:
> WARN_ON_ONCE(min(foo, bar) < baz);
> doesn't really want to show the expansion of min().

I'm using the '#' 'stringizing' CPP token to stringify the expression,
which doesn't expand macros but turns macro arguments into string
literals:

WARNING: [ptr == 0 && (min(0,1) < 1)] kernel/sched/core.c:8509 at sched_init+0x20/0x410, CPU#0: swapper/0

Thanks,

Ingo