Re: [PATCH v4 2/2] powerpc/irq: inline call_do_irq() and call_do_softirq()

2019-12-18 Thread Christophe Leroy
Le 09/12/2019 à 11:53, Michael Ellerman a écrit : Segher Boessenkool writes: On Sat, Dec 07, 2019 at 10:42:28AM +0100, Christophe Leroy wrote: Le 06/12/2019 à 21:59, Segher Boessenkool a écrit : If the compiler can see the callee wants the same TOC as the caller has, it does not arrange to

Re: [PATCH v4 2/2] powerpc/irq: inline call_do_irq() and call_do_softirq()

2019-12-09 Thread Michael Ellerman
Segher Boessenkool writes: > On Sat, Dec 07, 2019 at 10:42:28AM +0100, Christophe Leroy wrote: >> Le 06/12/2019 à 21:59, Segher Boessenkool a écrit : >> >If the compiler can see the callee wants the same TOC as the caller has, >> >it does not arrange to set (and restore) it, no. If it sees it may

Re: [PATCH v4 2/2] powerpc/irq: inline call_do_irq() and call_do_softirq()

2019-12-07 Thread Segher Boessenkool
On Sat, Dec 07, 2019 at 10:42:28AM +0100, Christophe Leroy wrote: > Le 06/12/2019 à 21:59, Segher Boessenkool a écrit : > >If the compiler can see the callee wants the same TOC as the caller has, > >it does not arrange to set (and restore) it, no. If it sees it may be > >different, it does arrange

Re: [PATCH v4 2/2] powerpc/irq: inline call_do_irq() and call_do_softirq()

2019-12-07 Thread Christophe Leroy
Le 06/12/2019 à 21:59, Segher Boessenkool a écrit : On Wed, Dec 04, 2019 at 05:32:54AM +0100, Christophe Leroy wrote: Le 29/11/2019 à 19:46, Segher Boessenkool a écrit : The existing call_do_irq isn't C code. It doesn't do anything with r2, as far as I can see; __do_irq just gets whatever t

Re: [PATCH v4 2/2] powerpc/irq: inline call_do_irq() and call_do_softirq()

2019-12-06 Thread Segher Boessenkool
On Wed, Dec 04, 2019 at 05:32:54AM +0100, Christophe Leroy wrote: > Le 29/11/2019 à 19:46, Segher Boessenkool a écrit : > >The existing call_do_irq isn't C code. It doesn't do anything with r2, > >as far as I can see; __do_irq just gets whatever the caller of call_do_irq > >has. > > > >So I guess

Re: [PATCH v4 2/2] powerpc/irq: inline call_do_irq() and call_do_softirq()

2019-12-03 Thread Christophe Leroy
Hi, Le 29/11/2019 à 19:46, Segher Boessenkool a écrit : Hi! On Wed, Nov 27, 2019 at 04:15:15PM +0100, Christophe Leroy wrote: Le 27/11/2019 à 15:59, Segher Boessenkool a écrit : On Wed, Nov 27, 2019 at 02:50:30PM +0100, Christophe Leroy wrote: So what do we do ? We just drop the "r2" clobber

Re: [PATCH v4 2/2] powerpc/irq: inline call_do_irq() and call_do_softirq()

2019-11-29 Thread Segher Boessenkool
Hi! On Wed, Nov 27, 2019 at 04:15:15PM +0100, Christophe Leroy wrote: > Le 27/11/2019 à 15:59, Segher Boessenkool a écrit : > >On Wed, Nov 27, 2019 at 02:50:30PM +0100, Christophe Leroy wrote: > >>So what do we do ? We just drop the "r2" clobber ? > > > >You have to make sure your asm code works f

Re: [PATCH v4 2/2] powerpc/irq: inline call_do_irq() and call_do_softirq()

2019-11-27 Thread Christophe Leroy
Le 27/11/2019 à 15:59, Segher Boessenkool a écrit : On Wed, Nov 27, 2019 at 02:50:30PM +0100, Christophe Leroy wrote: So what do we do ? We just drop the "r2" clobber ? You have to make sure your asm code works for all ABIs. This is quite involved if you do a call to an external function.

Re: [PATCH v4 2/2] powerpc/irq: inline call_do_irq() and call_do_softirq()

2019-11-27 Thread Segher Boessenkool
On Wed, Nov 27, 2019 at 02:50:30PM +0100, Christophe Leroy wrote: > So what do we do ? We just drop the "r2" clobber ? You have to make sure your asm code works for all ABIs. This is quite involved if you do a call to an external function. The compiler does *not* see this call, so you will have

Re: [PATCH v4 2/2] powerpc/irq: inline call_do_irq() and call_do_softirq()

2019-11-27 Thread Christophe Leroy
Le 25/11/2019 à 15:25, Segher Boessenkool a écrit : On Mon, Nov 25, 2019 at 09:32:23PM +1100, Michael Ellerman wrote: Segher Boessenkool writes: +static inline void call_do_irq(struct pt_regs *regs, void *sp) +{ + register unsigned long r3 asm("r3") = (unsigned long)regs; + + /*

Re: [PATCH v4 2/2] powerpc/irq: inline call_do_irq() and call_do_softirq()

2019-11-25 Thread Segher Boessenkool
On Mon, Nov 25, 2019 at 09:32:23PM +1100, Michael Ellerman wrote: > Segher Boessenkool writes: > >> > +static inline void call_do_irq(struct pt_regs *regs, void *sp) > >> > +{ > >> > +register unsigned long r3 asm("r3") = (unsigned long)regs; > >> > + > >> > +/* Temporarily switch

Re: [PATCH v4 2/2] powerpc/irq: inline call_do_irq() and call_do_softirq()

2019-11-25 Thread Michael Ellerman
Segher Boessenkool writes: > On Thu, Nov 21, 2019 at 05:14:45PM +1100, Michael Ellerman wrote: >> Christophe Leroy writes: >> That breaks 64-bit with GCC9: >> >> arch/powerpc/kernel/irq.c: In function 'do_IRQ': >> arch/powerpc/kernel/irq.c:650:2: error: PIC register clobbered by 'r2' in >>

Re: [PATCH v4 2/2] powerpc/irq: inline call_do_irq() and call_do_softirq()

2019-11-21 Thread Segher Boessenkool
On Thu, Nov 21, 2019 at 05:14:45PM +1100, Michael Ellerman wrote: > Christophe Leroy writes: > That breaks 64-bit with GCC9: > > arch/powerpc/kernel/irq.c: In function 'do_IRQ': > arch/powerpc/kernel/irq.c:650:2: error: PIC register clobbered by 'r2' in > 'asm' > 650 | asm volatile( >

Re: [PATCH v4 2/2] powerpc/irq: inline call_do_irq() and call_do_softirq()

2019-11-20 Thread Michael Ellerman
Christophe Leroy writes: > call_do_irq() and call_do_softirq() are quite similar on PPC32 and > PPC64 and are simple enough to be worth inlining. > > Inlining them avoids an mflr/mtlr pair plus a save/reload on stack. > > This is inspired from S390 arch. Several other arches do more or > less the

[PATCH v4 2/2] powerpc/irq: inline call_do_irq() and call_do_softirq()

2019-10-09 Thread Christophe Leroy
call_do_irq() and call_do_softirq() are quite similar on PPC32 and PPC64 and are simple enough to be worth inlining. Inlining them avoids an mflr/mtlr pair plus a save/reload on stack. This is inspired from S390 arch. Several other arches do more or less the same. The way sparc arch does seems od