[PATCH v4 3/8] arm64/fpsimd: Have KVM explicitly say which FP registers to save

Catalin Marinas catalin.marinas at arm.com
Sun Nov 13 14:27:03 PST 2022


On Sat, Oct 22, 2022 at 12:03:16AM +0100, Mark Brown wrote:
> In order to avoid needlessly saving and restoring the guest registers KVM
> relies on the host FPSMID code to save the guest registers when we context
> switch away from the guest. This is done by binding the KVM guest state to
> the CPU on top of the task state that was originally there, then carefully
> managing the TIF_SVE flag for the task to cause the host to save the full
> SVE state when needed regardless of the needs of the host task. This works
> well enough but isn't terribly direct about what is going on and makes it
> much more complicated to try to optimise what we're doing with the SVE
> register state.
> 
> Let's instead have KVM pass in the register state it wants saving when it
> binds to the CPU. We introduce a new FP_STATE_TASK for use during normal
> task binding to indicate that we should base our decisions on the current
> task. This should not ben used when actually saving. Ideally we might

s/ben/be/

> diff --git a/arch/arm64/include/asm/processor.h b/arch/arm64/include/asm/processor.h
> index 3cce0a4c4e8d..1d48398cb6dc 100644
> --- a/arch/arm64/include/asm/processor.h
> +++ b/arch/arm64/include/asm/processor.h
> @@ -123,6 +123,7 @@ enum vec_type {
>  };
>  
>  enum fp_type {
> +	FP_STATE_TASK,		/* Save based on current task state. */

Nitpick: FP_STATE_CURRENT instead?

Reviewed-by: Catalin Marinas



More information about the linux-arm-kernel mailing list