[v9, 02/10] riscv: vector: make Vector always available for softirq context

Eric Biggers ebiggers at kernel.org
Fri Dec 29 17:07:27 PST 2023


On Fri, Dec 29, 2023 at 02:36:19PM +0000, Andy Chiu wrote:
> The goal of this patch is to provide full support of Vector in kernel
> softirq context. So that some of the crypto alogrithms won't need scalar
> fallbacks.
> 
> By disabling bottom halves in active kernel-mode Vector, softirq will
> not be able to nest on top of any kernel-mode Vector. So, softirq
> context is able to use Vector whenever it runs.
> 
> After this patch, Vector context cannot start with irqs disabled.
> Otherwise local_bh_enable() may run in a wrong context.
> 
> Disabling bh is not enough for RT-kernel to prevent preeemption. So
> we must disable preemption, which also implies disabling bh on RT.
> 
> Related-to: commit 696207d4258b ("arm64/sve: Make kernel FPU protection RT friendly")
> Related-to: commit 66c3ec5a7120 ("arm64: neon: Forbid when irqs are disabled")
> Signed-off-by: Andy Chiu <andy.chiu at sifive.com>
> ---
> Changelog v8:
>  - refine comments, fix typos (Eric)
> Changelog v4:
>  - new patch since v4
> ---
>  arch/riscv/include/asm/processor.h     |  5 +++--
>  arch/riscv/include/asm/simd.h          |  6 +++++-
>  arch/riscv/kernel/kernel_mode_vector.c | 14 ++++++++++++--
>  3 files changed, 20 insertions(+), 5 deletions(-)

Reviewed-by: Eric Biggers <ebiggers at google.com>

- Eric



More information about the linux-riscv mailing list