[PATCH v2 0/2] introduce unified static key mechanism for ISA ext

Jisheng Zhang posted 2 patches 3 years, 11 months ago
arch/riscv/include/asm/hwcap.h     | 25 +++++++++++++++++++++++++
arch/riscv/include/asm/switch_to.h |  4 ++--
arch/riscv/kernel/cpufeature.c     | 14 +++++++-------
3 files changed, 34 insertions(+), 9 deletions(-)
[PATCH v2 0/2] introduce unified static key mechanism for ISA ext
Posted by Jisheng Zhang 3 years, 11 months ago
Currently, riscv has several extensions which may not be supported on all
riscv platforms, for example, FPU and so on. To support unified kernel
Image style, we need to check whether the feature is supported or not.
If the check sits at hot code path, the performance will be impacted a
lot. static key can be used to solve the issue. In the past, FPU
support has been converted to use static key mechanism. I believe we
will have similar cases in the future.

Since v1:
  - fix typo, thank Atish
  - remove riscv_isa_have_key_extension() instead use the isa ext keys
    directly as pointed out by Atish.

Jisheng Zhang (2):
  riscv: introduce unified static key mechanism for ISA extensions
  riscv: switch has_fpu() to the unified static key mechanism

 arch/riscv/include/asm/hwcap.h     | 25 +++++++++++++++++++++++++
 arch/riscv/include/asm/switch_to.h |  4 ++--
 arch/riscv/kernel/cpufeature.c     | 14 +++++++-------
 3 files changed, 34 insertions(+), 9 deletions(-)

-- 
2.34.1
Re: [PATCH v2 0/2] introduce unified static key mechanism for ISA ext
Posted by Palmer Dabbelt 3 years, 10 months ago
On Sun, 22 May 2022 08:35:41 PDT (-0700), jszhang@kernel.org wrote:
> Currently, riscv has several extensions which may not be supported on all
> riscv platforms, for example, FPU and so on. To support unified kernel
> Image style, we need to check whether the feature is supported or not.
> If the check sits at hot code path, the performance will be impacted a
> lot. static key can be used to solve the issue. In the past, FPU
> support has been converted to use static key mechanism. I believe we
> will have similar cases in the future.
>
> Since v1:
>   - fix typo, thank Atish
>   - remove riscv_isa_have_key_extension() instead use the isa ext keys
>     directly as pointed out by Atish.
>
> Jisheng Zhang (2):
>   riscv: introduce unified static key mechanism for ISA extensions
>   riscv: switch has_fpu() to the unified static key mechanism
>
>  arch/riscv/include/asm/hwcap.h     | 25 +++++++++++++++++++++++++
>  arch/riscv/include/asm/switch_to.h |  4 ++--
>  arch/riscv/kernel/cpufeature.c     | 14 +++++++-------
>  3 files changed, 34 insertions(+), 9 deletions(-)

Thanks, this is on for-next.