Re: [PATCH v2] powerpc/32: Add support for out-of-line static calls

From: Christophe Leroy
Date: Fri Mar 11 2022 - 09:57:03 EST


Hi Peter,

Le 31/08/2021 à 16:00, Peter Zijlstra a écrit :
On Tue, Aug 31, 2021 at 01:12:26PM +0000, Christophe Leroy wrote:

Yes, this should work nicely!

Since you have the two nop's at the end, you could frob in an
optimization for __static_call_return0 without too much issue.

Replace the two nops with (excuse my ppc asm):

li r3, 0
blr

and augment arch_static_call_transform() with something like:

if (func == &__static_call_return0)
err = patch_branch(tramp, tramp+24, 0);

I just discovered that we likely have an issue with the implementation of that RET0 static call.

Looking at System.map I have:

c0004fc0 t __static_call_return0
c0011518 t __static_call_return0
c00d8160 t __static_call_return0


So when we do:

if (func == &__static_call_return0)

It is unlikely that we'll get the expected one.


I see __static_call_return0 is defined as 'static inline' in include/linux/static_call.h

Any reason for not having it as a single global symbol instead ?

Thanks
Christophe