[PATCH v5 1/2] RISC-V: add infrastructure to allow different str* implementations

Conor Dooley conor at kernel.org
Fri Jan 13 13:59:06 PST 2023


Hey Heiko,

On Fri, Jan 13, 2023 at 10:23:00PM +0100, Heiko Stuebner wrote:
> From: Heiko Stuebner <heiko.stuebner at vrull.eu>
> 
> Depending on supported extensions on specific RISC-V cores,
> optimized str* functions might make sense.
> 
> This adds basic infrastructure to allow patching the function calls
> via alternatives later on.
> 
> The Linux kernel provides standard implementations for string functions
> but when architectures want to extend them, they need to provide their
> own.
> 
> The added generic string functions are done in assembler (taken from
> disassembling the main-kernel functions for now) to allow us to control
> the used registers and extend them with optimized variants.
> 


> This doesn't override the compiler's use of builtin replacements. So still
> first of all the compiler will select if a builtin will be better suitable
> i.e. for known strings. For all regular cases we will want to later
  ^
i.e. suggests that this will only happen for known strings.

> select possible optimized variants and in the worst case fall back to the
> generic implemention added with this change.
          ^ typo btw

I'm not expecting a resend for this, that'd be stupid, but does the
following say the same thing? (What you wrote was a bit -ENOPARSE)

"This doesn't override the compiler's use of builtin replacements. The
compiler will still select a builtin if it will be better suited, e.g.
for known strings. For all regular cases, we may want to select possibly
optimized variants, and in the worst case fall back to the generic
implementation added with this change."

I'm a philistine who was okay with previous version of the asm, so you
could've kept the:
Reviewed-by: Conor Dooley <conor.dooley at microchip.com>
I had a look and it seemed to match what Drew suggested.
Looking at the b4 diff output and seeing both side by side, the new one
does look nicer..

Thanks,
Conor.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-riscv/attachments/20230113/859d1fc2/attachment.sig>


More information about the linux-riscv mailing list