Re: [PATCH 1/2] bug: Provide WARN_ON.*DEFERRED() macros for console deferred output

From: Sebastian Andrzej Siewior

Date: Wed Jun 24 2026 - 06:08:55 EST


On 2026-06-24 11:31:17 [+0200], Peter Zijlstra wrote:
> On Tue, Jun 23, 2026 at 04:26:49PM +0200, Sebastian Andrzej Siewior wrote:
>
> > +#ifndef WARN_ON_DEFERRED
> > +#define WARN_ON_DEFERRED(condition) ({ \
> > + int __ret_warn_on = !!(condition); \
> > + if (unlikely(__ret_warn_on)) { \
> > + guard(preempt)(); \
> > + printk_deferred_enter() \
> > + __WARN(); \
> > + printk_deferred_exit() \
> > + } \
> > + unlikely(__ret_warn_on); \
> > +})
> > +#endif
>
> This will generate atrocious shite at the WARN sites.

You mean the missing semicolon and huge size increase?
On x86 with these guard+deffered in the upper variant, before:
text data bss dec filename
93910 37424 832 132166 kernel/sched/core.o
61802 4945 152 66899 kernel/sched/fair.o
215108 24453 3768 243329 kernel/sched/build_policy.o
86128 30092 12704 128924 kernel/sched/build_utility.o
456948 96914 17456 571318 total
After:
96140 37408 832 134380 kernel/sched/core.o
64490 4937 152 69579 kernel/sched/fair.o
222980 24157 3768 250905 kernel/sched/build_policy.o
86544 30100 12704 129348 kernel/sched/build_utility.o
470154 96602 17456 584212 total + 1.3%

total went up by 1.3% or 12.59KiB.
This effects: alpha, arc, arm, csky, hexagon, m68k, microblaze, mips,
nios2, openrisc, sparc, um, xtensa
and could motivate them to implement __WARN_FLAGS which would lower size
in general and this stunt would have no effect.

Just looked at arm and it has support for invalid opcodes somehow but
not for this.

Sebastian