From: Heiko Carstens <hca@linux.ibm.com>
To: Heiko Carstens <hca@linux.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
linux-kernel@vger.kernel.org,
Thomas Gleixner <tglx@linutronix.de>,
mathieu.desnoyers@efficios.com,
Mark Rutland <mark.rutland@arm.com>,
cmarinas@kernel.org, maddy@linux.ibm.com, ryan.roberts@arm.com
Subject: Re: [RFC] in-kernel rseq
Date: Tue, 24 Feb 2026 17:15:36 +0100 [thread overview]
Message-ID: <20260224161536.20006G71-hca@linux.ibm.com> (raw)
In-Reply-To: <20260224160208.20006F04-hca@linux.ibm.com>
On Tue, Feb 24, 2026 at 05:02:10PM +0100, Heiko Carstens wrote:
> 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:
...[random junk]...
Sorry, that was an incorrect version, only handling this_cpu_add().
So with
static DEFINE_PER_CPU(long, bar);
long foo(long val)
{
return this_cpu_add_return(bar, val);
}
and the above define the result would be the below (no stack frame -
up to the thunk to handle that, including register save/restore).
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 02 10 00 00 e8 laag %r0,%r2,0(%r1)
22: eb ff 03 a8 00 6e alsi 936,-1
28: a7 a4 00 05 jhe 32 <foo+0x32>
2c: b9 08 00 20 agr %r2,%r0
30: 07 fe br %r14
32: e3 e0 f0 88 00 24 stg %r14,136(%r15)
38: c0 e5 00 00 00 00 brasl %r14,38 <foo+0x38>
3a: R_390_PC32DBL preempt_schedule_notrace_thunk+0x2
3e: e3 e0 f0 88 00 04 lg %r14,136(%r15)
44: b9 08 00 20 agr %r2,%r0
48: 07 fe br %r14
next prev parent reply other threads:[~2026-02-24 16:15 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-23 16:38 [RFC] in-kernel rseq Peter Zijlstra
2026-02-23 17:53 ` David Laight
2026-02-23 18:22 ` Mathieu Desnoyers
2026-02-23 21:54 ` Peter Zijlstra
2026-02-24 10:27 ` David Laight
2026-02-24 13:33 ` Mathieu Desnoyers
2026-02-24 14:49 ` David Laight
2026-02-24 16:15 ` Mathieu Desnoyers
2026-02-24 11:16 ` Heiko Carstens
2026-02-24 13:48 ` Mathieu Desnoyers
2026-02-24 14:59 ` David Laight
2026-02-24 16:18 ` Mathieu Desnoyers
2026-02-24 15:17 ` Peter Zijlstra
2026-02-24 15:20 ` Peter Zijlstra
2026-02-24 16:02 ` Heiko Carstens
2026-02-24 16:15 ` Heiko Carstens [this message]
2026-04-10 17:57 ` Shrikanth Hegde
2026-04-15 8:51 ` Heiko Carstens
2026-04-17 9:29 ` Shrikanth Hegde
2026-04-17 9:36 ` Shrikanth Hegde
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=20260224161536.20006G71-hca@linux.ibm.com \
--to=hca@linux.ibm.com \
--cc=cmarinas@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maddy@linux.ibm.com \
--cc=mark.rutland@arm.com \
--cc=mathieu.desnoyers@efficios.com \
--cc=peterz@infradead.org \
--cc=ryan.roberts@arm.com \
--cc=tglx@linutronix.de \
/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