All of lore.kernel.org
 help / color / mirror / Atom feed
From: Heiko Carstens <hca@linux.ibm.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: 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:02:08 +0100	[thread overview]
Message-ID: <20260224160208.20006F04-hca@linux.ibm.com> (raw)
In-Reply-To: <20260224152032.GZ1395266@noisy.programming.kicks-ass.net>

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 :)

  reply	other threads:[~2026-02-24 16:02 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 [this message]
2026-02-24 16:15       ` Heiko Carstens
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=20260224160208.20006F04-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.