Re: [PATCH 6/9] s390/bug: Implement __WARN_printf()
From: Heiko Carstens
Date: Tue Dec 09 2025 - 09:42:59 EST
On Tue, Dec 09, 2025 at 01:35:40PM +0100, Peter Zijlstra wrote:
> On Tue, Dec 09, 2025 at 01:16:58PM +0100, Heiko Carstens wrote:
> > +#define __WARN_print_arg(flags, format, arg...) \
> > +do { \
> > + int __flags = (flags) | BUGFLAG_WARNING | BUGFLAG_ARGS; \
> > + \
> > + __WARN_trap(__WARN_bug_entry(__flags, format), ## arg); \
> > +} while (0)
>
> So on x86 I had to add:
>
> asm("");
>
> after the __WARN_trap() call above, to inhibit tail call optimization,
> because:
>
> > +void *__warn_args(struct arch_va_list *args, struct pt_regs *regs)
> > +{
> > + struct stack_frame *stack_frame;
...
> > + stack_frame = (struct stack_frame *)regs->gprs[15];
> > + args->__overflow_arg_area = stack_frame + 1;
> > + args->__reg_save_area = regs->gprs;
> > + args->__gpr = 1;
> > + return args;
> > +}
>
> that would affect the stack layout here. You don't suffer this because
> you have a link register like setup?
Yes, in case of tail call optimization everything which needs to be known to
setup va_list is passed in registers. __overflow_arg_area will then point to
garbage, but it doesn't matter since it is unused for such cases.