[PATCH v4 0/5] Zbb string optimizations and call support in alternatives

Jisheng Zhang jszhang at kernel.org
Wed Jan 11 05:24:26 PST 2023


On Mon, Jan 09, 2023 at 07:17:50PM +0100, Heiko Stuebner wrote:
> From: Heiko Stuebner <heiko.stuebner at vrull.eu>
> 
> This series still tries to allow optimized string functions for specific
> extensions. The last approach of using an inline base function to hold
> the alternative calls did cause some issues in a number of places
> 
> So instead of that we're now just using an alternative j at the beginning
> of the generic function to jump to a separate place inside the function
> itself.
> 
> This of course needs a fixup for "j" instructions in alternative blocks,
> so that is provided here as well.
> 
> Technically patch4 got a review from Andrew, but that was still with
> the inline approach, so I didn't bring it over to v4.
> 
> 
> changes since v3:
> - rebase on top of 6.2-rc1 + the applied alternative-call series
> - add alternative fixup for jal instructions
> - drop the inline functions and instead just jump

Hi Heiko,

I think I have sent out the jal fixup a month ago. And similar as V3, Zbb
series need to be split from the general alternative improvement.

Thanks

> 
> changes since v2:
> - add patch fixing the c.jalr funct4 value
> - reword some commit messages
> - fix position of auipc addition patch (earlier)
> - fix compile errors from patch-reordering gone wrong
>   (worked at the end of v2, but compiling individual patches
>    caused issues) - patches are now tested individually
> - limit Zbb variants for GNU as for now
>   (LLVM support for .option arch is still under review)
> - prevent str-functions from getting optimized to builtin-variants
> 
> changes since v1:
> - a number of generalizations/cleanups for instruction parsing
> - use accessor function to access instructions (Emil)
> - actually patch the correct location when having more than one
>   instruction in an alternative block
> - string function cleanups (comments etc) (Conor)
> - move zbb extension above s* extensions in cpu.c lists
> 
> changes since rfc:
> - make Zbb code actually work
> - drop some unneeded patches
> - a lot of cleanups
> 
> Heiko Stuebner (5):
>   RISC-V: move some stray __RISCV_INSN_FUNCS definitions from kprobes
>   RISC-V: add helpers for J-type immediate handling
>   RISC-V: fix jal addresses in patched alternatives
>   RISC-V: add infrastructure to allow different str* implementations
>   RISC-V: add zbb support to string functions
> 
>  arch/riscv/Kconfig                       |  24 ++++
>  arch/riscv/include/asm/errata_list.h     |   3 +-
>  arch/riscv/include/asm/hwcap.h           |   1 +
>  arch/riscv/include/asm/insn.h            |  36 ++++++
>  arch/riscv/include/asm/string.h          |  12 ++
>  arch/riscv/kernel/alternative.c          |  27 ++++
>  arch/riscv/kernel/cpu.c                  |   1 +
>  arch/riscv/kernel/cpufeature.c           |  18 +++
>  arch/riscv/kernel/probes/simulate-insn.h |   3 -
>  arch/riscv/kernel/riscv_ksyms.c          |   3 +
>  arch/riscv/lib/Makefile                  |   3 +
>  arch/riscv/lib/strcmp.S                  | 131 ++++++++++++++++++++
>  arch/riscv/lib/strlen.S                  | 142 +++++++++++++++++++++
>  arch/riscv/lib/strncmp.S                 | 151 +++++++++++++++++++++++
>  arch/riscv/purgatory/Makefile            |  13 ++
>  15 files changed, 564 insertions(+), 4 deletions(-)
>  create mode 100644 arch/riscv/lib/strcmp.S
>  create mode 100644 arch/riscv/lib/strlen.S
>  create mode 100644 arch/riscv/lib/strncmp.S
> 
> -- 
> 2.35.1
> 



More information about the linux-riscv mailing list