From: Segher Boessenkool <segher@kernel.crashing.org>
To: Michael Ellerman <mpe@ellerman.id.au>
Cc: Christophe Leroy <christophe.leroy@c-s.fr>,
Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Paul Mackerras <paulus@samba.org>,
linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH v4 2/2] powerpc/irq: inline call_do_irq() and call_do_softirq()
Date: Mon, 25 Nov 2019 08:25:56 -0600 [thread overview]
Message-ID: <20191125142556.GU9491@gate.crashing.org> (raw)
In-Reply-To: <87y2w49rgo.fsf@mpe.ellerman.id.au>
On Mon, Nov 25, 2019 at 09:32:23PM +1100, Michael Ellerman wrote:
> Segher Boessenkool <segher@kernel.crashing.org> writes:
> >> > +static inline void call_do_irq(struct pt_regs *regs, void *sp)
> >> > +{
> >> > + register unsigned long r3 asm("r3") = (unsigned long)regs;
> >> > +
> >> > + /* Temporarily switch r1 to sp, call __do_irq() then restore r1 */
> >> > + asm volatile(
> >> > + " "PPC_STLU" 1, %2(%1);\n"
> >> > + " mr 1, %1;\n"
> >> > + " bl %3;\n"
> >> > + " "PPC_LL" 1, 0(1);\n" :
> >> > + "+r"(r3) :
> >> > + "b"(sp), "i"(THREAD_SIZE - STACK_FRAME_OVERHEAD), "i"(__do_irq) :
> >> > + "lr", "xer", "ctr", "memory", "cr0", "cr1", "cr5", "cr6", "cr7",
> >> > + "r0", "r2", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12");
> >> > +}
> >>
> >> If we add a nop after the bl, so the linker could insert a TOC restore,
> >> then I don't think there's any circumstance under which we expect this
> >> to actually clobber r2, is there?
> >
> > That is mostly correct.
>
> That's the standard I aspire to :P
>
> > If call_do_irq was a no-inline function, there would not be problems.
> >
> > What TOC does __do_irq require in r2 on entry, and what will be there
> > when it returns?
>
> The kernel TOC, and also the kernel TOC, unless something's gone wrong
> or I'm missing something.
If that is the case, we can just do the bl, no nop at all? And that works
for all of our ABIs.
If we can be certain that we have the kernel TOC in r2 on entry to
call_do_irq, that is! (Or it establishes it itself).
Segher
next prev parent reply other threads:[~2019-11-25 14:26 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-10 5:36 [PATCH v4 1/2] powerpc/irq: bring back ksp_limit management in C functions Christophe Leroy
2019-10-10 5:36 ` [PATCH v4 2/2] powerpc/irq: inline call_do_irq() and call_do_softirq() Christophe Leroy
2019-11-21 6:14 ` Michael Ellerman
2019-11-21 10:15 ` Segher Boessenkool
2019-11-25 10:32 ` Michael Ellerman
2019-11-25 14:25 ` Segher Boessenkool [this message]
2019-11-27 13:50 ` Christophe Leroy
2019-11-27 14:59 ` Segher Boessenkool
2019-11-27 15:15 ` Christophe Leroy
2019-11-29 18:46 ` Segher Boessenkool
2019-12-04 4:32 ` Christophe Leroy
2019-12-06 20:59 ` Segher Boessenkool
2019-12-07 9:42 ` Christophe Leroy
2019-12-07 17:40 ` Segher Boessenkool
2019-12-09 10:53 ` Michael Ellerman
2019-12-19 6:57 ` Christophe Leroy
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=20191125142556.GU9491@gate.crashing.org \
--to=segher@kernel.crashing.org \
--cc=benh@kernel.crashing.org \
--cc=christophe.leroy@c-s.fr \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
--cc=paulus@samba.org \
/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