Re: [RFC PATCH] powerpc: Investigate static_call concept

From: Segher Boessenkool
Date: Fri Aug 27 2021 - 12:10:31 EST


On Fri, Aug 27, 2021 at 04:18:47PM +0200, Peter Zijlstra wrote:
> On Fri, Aug 27, 2021 at 09:45:37AM +0000, Christophe Leroy wrote:
> > This RFC is to validate the concept of static_call on powerpc.
> >
> > Highly copied from x86.
> >
> > It replaces ppc_md.get_irq() which is called at every IRQ, by
> > a static call.
>
> The code looks saner, but does it actually improve performance? I'm
> thinking the double branch also isn't free.

It isn't, but it is very cheap, while the branch-to-count is not, even
*if* it is correctly predicted.

> The paranoid in me would've made it:
>
> BUG_ON(patch_branch(...));
>
> just to make sure to notice the target not fitting. Ohh, patch_branch()
> doesn't return the create_branch() error, perhaps that wants to be
> fixed?

Should that be allowed to fail ever? I.e., should a failure be a fatal
error? Sounds very fragile otherwise.


Segher