[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2072e066-1ffb-867e-60ec-04a6bb9075c1@c-s.fr>
Date: Wed, 27 Nov 2019 16:15:15 +0100
From: Christophe Leroy <christophe.leroy@....fr>
To: Segher Boessenkool <segher@...nel.crashing.org>
Cc: Michael Ellerman <mpe@...erman.id.au>,
Benjamin Herrenschmidt <benh@...nel.crashing.org>,
Paul Mackerras <paulus@...ba.org>,
linux-kernel@...r.kernel.org, linuxppc-dev@...ts.ozlabs.org
Subject: Re: [PATCH v4 2/2] powerpc/irq: inline call_do_irq() and
call_do_softirq()
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. The compiler does
> *not* see this call, so you will have to make sure that all that the
> compiler and linker do will work, or prevent some of those things (say,
> inlining of the function containing the call).
But the whole purpose of the patch is to inline the call to __do_irq()
in order to avoid the trampoline function.
>
>> Otherwise, to be on the safe side we can just save r2 in a local var
>> before the bl and restore it after. I guess it won't collapse CPU time
>> on a performant PPC64.
>
> That does not fix everything. The called function requires a specific
> value in r2 on entry.
Euh ... but there is nothing like that when using existing
call_do_irq(). How does GCC know that call_do_irq() has same TOC as
__do_irq() ?
>
> So all this needs verification. Hopefully you can get away with just
> not clobbering r2 (and not adding a nop after the bl), sure. But this
> needs to be checked.
>
> Changing control flow inside inline assembler always is problematic.
> Another problem in this case (on all ABIs) is that the compiler does
> not see you call __do_irq. Again, you can probably get away with that
> too, but :-)
Anyway it sees I reference it, as it is in input arguments. Isn't it
enough ?
Christophe
Powered by blists - more mailing lists