From: Paolo Bonzini <pbonzini@redhat.com>
To: Xiaoyao Li <xiaoyao.li@intel.com>,
Sean Christopherson <sean.j.christopherson@intel.com>,
kvm@vger.kernel.org
Cc: Vitaly Kuznetsov <vkuznets@redhat.com>,
Jim Mattson <jmattson@google.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] KVM: X86: Call kvm_x86_ops.cpuid_update() after CPUIDs fully updated
Date: Thu, 28 May 2020 17:22:57 +0200 [thread overview]
Message-ID: <b639a333-d7fe-74fd-ee11-6daede184676@redhat.com> (raw)
In-Reply-To: <20200528151927.14346-1-xiaoyao.li@intel.com>
On 28/05/20 17:19, Xiaoyao Li wrote:
> kvm_x86_ops.cpuid_update() is used to update vmx/svm settings based on
> updated CPUID settings. So it's supposed to be called after CPUIDs are
> fully updated, not in the middle stage.
>
> Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
Are you seeing anything bad happening from this?
Paolo
> ---
> arch/x86/kvm/cpuid.c | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
> index cd708b0b460a..753739bc1bf0 100644
> --- a/arch/x86/kvm/cpuid.c
> +++ b/arch/x86/kvm/cpuid.c
> @@ -208,8 +208,11 @@ int kvm_vcpu_ioctl_set_cpuid(struct kvm_vcpu *vcpu,
> vcpu->arch.cpuid_nent = cpuid->nent;
> cpuid_fix_nx_cap(vcpu);
> kvm_apic_set_version(vcpu);
> - kvm_x86_ops.cpuid_update(vcpu);
> r = kvm_update_cpuid(vcpu);
> + if (r)
> + goto out;
> +
> + kvm_x86_ops.cpuid_update(vcpu);
>
> out:
> vfree(cpuid_entries);
> @@ -231,8 +234,11 @@ int kvm_vcpu_ioctl_set_cpuid2(struct kvm_vcpu *vcpu,
> goto out;
> vcpu->arch.cpuid_nent = cpuid->nent;
> kvm_apic_set_version(vcpu);
> - kvm_x86_ops.cpuid_update(vcpu);
> r = kvm_update_cpuid(vcpu);
> + if (r)
> + goto out;
> +
> + kvm_x86_ops.cpuid_update(vcpu);
> out:
> return r;
> }
>
next prev parent reply other threads:[~2020-05-28 15:23 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-28 15:19 [PATCH] KVM: X86: Call kvm_x86_ops.cpuid_update() after CPUIDs fully updated Xiaoyao Li
2020-05-28 15:22 ` Paolo Bonzini [this message]
2020-05-28 15:40 ` Xiaoyao Li
2020-05-28 16:15 ` Paolo Bonzini
2020-05-28 16:59 ` Xiaoyao Li
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=b639a333-d7fe-74fd-ee11-6daede184676@redhat.com \
--to=pbonzini@redhat.com \
--cc=jmattson@google.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sean.j.christopherson@intel.com \
--cc=vkuznets@redhat.com \
--cc=xiaoyao.li@intel.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;
as well as URLs for NNTP newsgroup(s).