RISCV Vector unit disabled by default for new task (was Re: [PATCH v12 17/17] riscv: prctl to enable vector commands)

Richard Henderson richard.henderson at linaro.org
Thu Dec 15 11:56:12 PST 2022


On 12/15/22 10:57, Vineet Gupta wrote:
>> The other thing of note for SVE is that, with the default function ABI all of the SVE 
>> state is call-clobbered, which allows the kernel to drop instead of save state across 
>> system calls.  (There is a separate vector function call ABI when SVE types are used.)
> 
> For the RV psABI, it is similar - all V regs are caller-saved/call-clobbered [1] and 
> syscalls are not required to preserve V regs [2]
> However last I checked ARM documentation the ABI doc seemed to suggest that some (parts) 
> of the SVE regs are callee-saved [3]

As Pinski mentioned, just some low bits that overlap with scalar fp state; the high bits 
and the predicate registers gets zeroed when re-enabling.


>> So while strcpy may enable SVE for the thread, the next syscall may disable it again.
> 
> Next syscall could trash them, but will it disable SVE ?

Yes.  See fp_user_discard() in arch/arm64/kernel/syscall.c.


r~



More information about the linux-riscv mailing list