Re: [PATCH v7 1/6] riscv: mm: dma-noncoherent: Switch using function pointers for cache management
From: Christoph Hellwig
Date: Tue Apr 04 2023 - 11:42:42 EST
On Tue, Apr 04, 2023 at 06:24:16AM +0000, Biju Das wrote:
> Just a question, how does function pointer makes a performance difference compared to
> ALTERNATIVE_X() macros?
>
> On both cases, we are pushing function parameters to stack, jumping to the actual routine
> And then on return pop the variables from stack. Am I missing something here?
Indirect calls have always been more expensive, and with the hard- and
software mitigations for spectre-like attacks they are becoming even
more expensive.
But other other point is adding more cache flushing variants should not
be easy. Everyone should be using the standardize version. If it's not
implemented in hardware despite having ratified extensions you can fake
it up in SBI. Yes, that's way more expensive than indirect calls, but
that's what you get for taping out new hardware that ignores the actual
architecture specification and just does their own made up shit.