lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aVMUjVoFEhazej6I@google.com>
Date: Mon, 29 Dec 2025 15:53:49 -0800
From: Sean Christopherson <seanjc@...gle.com>
To: Paolo Bonzini <pbonzini@...hat.com>
Cc: linux-kernel@...r.kernel.org, kvm@...r.kernel.org, x86@...nel.org
Subject: Re: [PATCH 5/5] KVM: x86: kvm_fpu_get() is fpregs_lock_and_load()

I'd prefer a shortlog that states what change is being made, but otherwise:

Reviewed-by: Sean Christopherson <seanjc@...gle.com>

On Wed, Dec 24, 2025, Paolo Bonzini wrote:
> The only difference is the usage of switch_fpu_return() vs.
> fpregs_restore_userregs().  In turn, these are only different
> if there is no FPU at all, but KVM requires one.  Therefore use the
> pre-made export---the code is simpler and there is no functional change.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@...hat.com>
> ---
>  arch/x86/kernel/fpu/core.c | 2 +--
>  arch/x86/kvm/fpu.h         | 6 +-----
>  2 files changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/arch/x86/kernel/fpu/core.c b/arch/x86/kernel/fpu/core.c
> index ff17c96d290a..6571952c6ef1 100644
> --- a/arch/x86/kernel/fpu/core.c
> +++ b/arch/x86/kernel/fpu/core.c
> @@ -846,7 +846,6 @@ void switch_fpu_return(void)
>  
>  	fpregs_restore_userregs();
>  }
> -EXPORT_SYMBOL_FOR_KVM(switch_fpu_return);
>  
>  void fpregs_lock_and_load(void)
>  {
> @@ -865,6 +864,7 @@ void fpregs_lock_and_load(void)
>  
>  	fpregs_assert_state_consistent();
>  }
> +EXPORT_SYMBOL_FOR_KVM(fpregs_lock_and_load);
>  
>  void fpu_load_guest_fpstate(struct fpu_guest *gfpu)
>  {
> @@ -899,7 +899,6 @@ void fpregs_assert_state_consistent(void)
>  
>  	WARN_ON_FPU(!fpregs_state_valid(fpu, smp_processor_id()));
>  }
> -EXPORT_SYMBOL_FOR_KVM(fpregs_assert_state_consistent);
>  #endif
>  
>  void fpregs_mark_activate(void)
> diff --git a/arch/x86/kvm/fpu.h b/arch/x86/kvm/fpu.h
> index f898781b6a06..b6a03d8fa8af 100644
> --- a/arch/x86/kvm/fpu.h
> +++ b/arch/x86/kvm/fpu.h
> @@ -149,11 +149,7 @@ static inline void _kvm_write_mmx_reg(int reg, const u64 *data)
>  
>  static inline void kvm_fpu_get(void)
>  {
> -	fpregs_lock();
> -
> -	fpregs_assert_state_consistent();
> -	if (test_thread_flag(TIF_NEED_FPU_LOAD))
> -		switch_fpu_return();
> +	fpregs_lock_and_load();
>  }
>  
>  static inline void kvm_fpu_put(void)
> -- 
> 2.52.0
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ