All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, x86@kernel.org
Subject: Re: [PATCH 5/5] KVM: x86: kvm_fpu_get() is fpregs_lock_and_load()
Date: Mon, 29 Dec 2025 15:53:49 -0800	[thread overview]
Message-ID: <aVMUjVoFEhazej6I@google.com> (raw)
In-Reply-To: <20251224001249.1041934-6-pbonzini@redhat.com>

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

Reviewed-by: Sean Christopherson <seanjc@google.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@redhat.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
> 

      reply	other threads:[~2025-12-29 23:53 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-24  0:12 [PATCH 0/5] x86, fpu/kvm: fix crash with AMX Paolo Bonzini
2025-12-24  0:12 ` [PATCH 1/5] x86, fpu: introduce fpu_load_guest_fpstate() Paolo Bonzini
2025-12-26  6:51   ` Yao Yuan
2025-12-29 15:58     ` Sean Christopherson
2025-12-29 22:56       ` Paolo Bonzini
2025-12-24  0:12 ` [PATCH 2/5] x86, fpu: separate fpstate->xfd and guest XFD Paolo Bonzini
2025-12-25 22:52   ` Yao Yuan
2025-12-29 22:45   ` Sean Christopherson
2025-12-29 23:31     ` Paolo Bonzini
2025-12-29 23:46       ` Sean Christopherson
2025-12-24  0:12 ` [PATCH 3/5] selftests: kvm: renumber some sync points in amx_test Paolo Bonzini
2025-12-29 23:34   ` Sean Christopherson
2025-12-24  0:12 ` [PATCH 4/5] selftests, kvm: try getting XFD and XSAVE state out of sync Paolo Bonzini
2025-12-24  0:12 ` [PATCH 5/5] KVM: x86: kvm_fpu_get() is fpregs_lock_and_load() Paolo Bonzini
2025-12-29 23:53   ` Sean Christopherson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aVMUjVoFEhazej6I@google.com \
    --to=seanjc@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.