mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Wanpeng Li <kernellwp@gmail.com>,
	linux-kernel@vger.kernel.org, kvm@vger.kernel.org
Cc: Sean Christopherson <seanjc@google.com>,
	Vitaly Kuznetsov <vkuznets@redhat.com>,
	Wanpeng Li <wanpengli@tencent.com>,
	Jim Mattson <jmattson@google.com>, Joerg Roedel <joro@8bytes.org>
Subject: Re: [PATCH] KVM: X86: Fix always skip to boost kernel lock holder candidate for SEV-ES guests
Date: Thu, 22 Apr 2021 12:34:34 +0200	[thread overview]
Message-ID: <a5dc4068-050e-b651-2e8a-8e90164694a6@redhat.com> (raw)
In-Reply-To: <1619080459-30032-1-git-send-email-wanpengli@tencent.com>

On 22/04/21 10:34, Wanpeng Li wrote:
> From: Wanpeng Li <wanpengli@tencent.com>
> 
> Commit f1c6366e3043 ("KVM: SVM: Add required changes to support intercepts under
> SEV-ES") prevents hypervisor accesses guest register state when the guest is
> running under SEV-ES. The initial value of vcpu->arch.guest_state_protected
> is false, it will not be updated in preemption notifiers after this commit which
> means that the kernel spinlock lock holder will always be skipped to boost. Let's
> fix it by always treating preempted is in the guest kernel mode, false positive
> is better than skip completely.
> 
> Fixes: f1c6366e3043 (KVM: SVM: Add required changes to support intercepts under SEV-ES)
> Signed-off-by: Wanpeng Li <wanpengli@tencent.com>
> ---
>   arch/x86/kvm/x86.c | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index d696a9f..e52ca09 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -11151,6 +11151,9 @@ bool kvm_arch_dy_has_pending_interrupt(struct kvm_vcpu *vcpu)
>   
>   bool kvm_arch_vcpu_in_kernel(struct kvm_vcpu *vcpu)
>   {
> +	if (vcpu->arch.guest_state_protected)
> +		return true;
> +
>   	return vcpu->arch.preempted_in_kernel;
>   }
>   
> 

Queued, thanks.

Paolo


      reply	other threads:[~2021-04-22 10:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-22  8:34 Wanpeng Li
2021-04-22 10:34 ` Paolo Bonzini [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=a5dc4068-050e-b651-2e8a-8e90164694a6@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=jmattson@google.com \
    --cc=joro@8bytes.org \
    --cc=kernellwp@gmail.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=seanjc@google.com \
    --cc=vkuznets@redhat.com \
    --cc=wanpengli@tencent.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®