[PATCH] arm64/fpsimd: Clarify the purpose of using last in fpsimd_save()

Catalin Marinas catalin.marinas at arm.com
Fri Feb 4 09:51:03 PST 2022


On Mon, Jan 24, 2022 at 04:11:15PM +0000, Mark Brown wrote:
> diff --git a/arch/arm64/kernel/fpsimd.c b/arch/arm64/kernel/fpsimd.c
> index 5280e098cfb5..47af76e53221 100644
> --- a/arch/arm64/kernel/fpsimd.c
> +++ b/arch/arm64/kernel/fpsimd.c
> @@ -348,7 +348,13 @@ static void task_fpsimd_load(void)
>  
>  /*
>   * Ensure FPSIMD/SVE storage in memory for the loaded context is up to
> - * date with respect to the CPU registers.
> + * date with respect to the CPU registers. Note carefully that the
> + * current context is the context last bound to the CPU stored in
> + * last, if KVM is involved this may be the guest VM context rather
> + * than the host thread for the VM pointed to by current. This means
> + * that we must always reference the state storage via last rather
> + * than via current, other than the TIF_ flags which KVM will
> + * carefully maintain for us.
>   */
>  static void fpsimd_save(void)
>  {

It's good to have the text here, otherwise it's hidden somewhere in the
commit logs.

Reviewed-by: Catalin Marinas <catalin.marinas at arm.com>



More information about the linux-arm-kernel mailing list