All of lore.kernel.org
 help / color / mirror / Atom feed
From: Xiaoyao Li <xiaoyao.li@intel.com>
To: Sean Christopherson <sean.j.christopherson@intel.com>,
	Paolo Bonzini <pbonzini@redhat.com>
Cc: Vitaly Kuznetsov <vkuznets@redhat.com>,
	Wanpeng Li <wanpengli@tencent.com>,
	Jim Mattson <jmattson@google.com>, Joerg Roedel <joro@8bytes.org>,
	kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] KVM: x86: Restore update of required xstate size in guest's CPUID
Date: Sat, 9 May 2020 10:09:00 +0800	[thread overview]
Message-ID: <dd7bfdb9-dcad-8a4b-29bb-c48d4c98b515@intel.com> (raw)
In-Reply-To: <20200508233749.3417-1-sean.j.christopherson@intel.com>

On 5/9/2020 7:37 AM, Sean Christopherson wrote:
> Restore a guest CPUID update that was unintentional collateral damage
> when the per-vCPU guest_xstate_size field was removed.

It's really unintentional. None of us noticed it. :(

It's good that you catch it!

> Cc: Xiaoyao Li <xiaoyao.li@intel.com>
> Fixes: d87277414b851 ("kvm: x86: Cleanup vcpu->arch.guest_xstate_size")
> Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
> ---
> 
> There's nothing more thrilling than watching bisect home in on your own
> commits, only to land on someone else's on the very last step.
> 
>   arch/x86/kvm/cpuid.c | 6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
> index 35845704cf57a..cd708b0b460a0 100644
> --- a/arch/x86/kvm/cpuid.c
> +++ b/arch/x86/kvm/cpuid.c
> @@ -84,11 +84,13 @@ int kvm_update_cpuid(struct kvm_vcpu *vcpu)
>   				   kvm_read_cr4_bits(vcpu, X86_CR4_PKE));
>   
>   	best = kvm_find_cpuid_entry(vcpu, 0xD, 0);
> -	if (!best)
> +	if (!best) {
>   		vcpu->arch.guest_supported_xcr0 = 0;
> -	else
> +	} else {
>   		vcpu->arch.guest_supported_xcr0 =
>   			(best->eax | ((u64)best->edx << 32)) & supported_xcr0;
> +		best->ebx = xstate_required_size(vcpu->arch.xcr0, false);
> +	}
>   
>   	best = kvm_find_cpuid_entry(vcpu, 0xD, 1);
>   	if (best && (cpuid_entry_has(best, X86_FEATURE_XSAVES) ||
> 


  reply	other threads:[~2020-05-09  2:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-08 23:37 [PATCH] KVM: x86: Restore update of required xstate size in guest's CPUID Sean Christopherson
2020-05-09  2:09 ` Xiaoyao Li [this message]
2020-05-09 12:51 ` Paolo Bonzini

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=dd7bfdb9-dcad-8a4b-29bb-c48d4c98b515@intel.com \
    --to=xiaoyao.li@intel.com \
    --cc=jmattson@google.com \
    --cc=joro@8bytes.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=sean.j.christopherson@intel.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 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.