Re: [RFC] in-kernel rseq
From: Heiko Carstens
Date: Tue Feb 24 2026 - 11:05:29 EST
On Tue, Feb 24, 2026 at 04:20:32PM +0100, Peter Zijlstra wrote:
> > With PREEMPT_LAZY this turns into:
> >
> > 0000000000000000 <foo>:
> > 0: c0 04 00 00 00 00 jgnop 0 <foo>
> > 6: eb af f0 68 00 24 stmg %r10,%r15,104(%r15)
> > c: b9 04 00 ef lgr %r14,%r15
> > 10: b9 04 00 b2 lgr %r11,%r2
> > 14: e3 f0 ff c8 ff 71 lay %r15,-56(%r15)
> > 1a: e3 e0 f0 98 00 24 stg %r14,152(%r15) <- up to here: create stack frame
>
> So some of that could be elided with that asm call thunk thing we talked
> about yesterday, right?
Yes, with
#define __preempt_schedule_notrace() \
asm volatile("brasl %%r14,preempt_schedule_notrace_thunk" : : : "cc", "memory", "r14")
we would end up with:
0000000000000000 <foo>:
0: c0 04 00 00 00 00 jgnop 0 <foo>
6: eb 01 03 a8 00 6a asi 936,1
c: c0 10 00 00 00 00 larl %r1,c <foo+0xc>
e: R_390_PC32DBL .data..percpu+0x2
12: a7 39 00 00 lghi %r3,0
16: e3 10 33 b8 00 08 ag %r1,952(%r3)
1c: eb 22 10 00 00 f8 laa %r2,%r2,0(%r1)
22: eb ff 03 a8 00 6e alsi 936,-1
28: a7 a4 00 03 jhe 2e <foo+0x2e>
2c: 07 fe br %r14
2e: e3 e0 f0 88 00 24 stg %r14,136(%r15)
34: c0 e5 00 00 00 00 brasl %r14,34 <foo+0x34>
36: R_390_PC32DBL preempt_schedule_notrace_thunk+0x2
3a: e3 e0 f0 88 00 04 lg %r14,136(%r15)
40: 07 fe br %r14
The stack setup is gone, like wanted :)