kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Xiaoyao Li <xiaoyao.li@intel.com>
To: Paolo Bonzini <pbonzini@redhat.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: Fri, 29 May 2020 00:59:51 +0800	[thread overview]
Message-ID: <54497675-2b35-b351-4259-8eb819daca87@intel.com> (raw)
In-Reply-To: <5d8bc1da-f866-4741-7746-1fa2a3cfbafd@redhat.com>

On 5/29/2020 12:15 AM, Paolo Bonzini wrote:
> On 28/05/20 17:40, 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?
>>
>> Not yet.
>>
>> IMO changing the order is more reasonable and less confusing.
> 
> Indeed, I just could not decide whether to include it in 5.7 or not.

Maybe for 5.8

I have a new idea to refactor a bit more that I find it does three 
things in kvm_update_cpuid():
- update cpuid;
- update vcpu states, e.g., apic->lapic_timer.timer_mode_mask, 
guest_supported_xcr0, maxphyaddr, ... etc,
- cpuid check, for vaddr_bits

I'm going to split it, and make the order as:
1. kvm_check_cpuid(), if invalid value return error;
2. kvm_update_cpuid();
3. kvm_update_state_based_on_cpuid();
    and kvm_x86_ops.kvm_x86_ops.cpuid_update() can be called inside it.

If you feel OK, I'll do it tomorrow.

-Xiaoyao



      reply	other threads:[~2020-05-28 17:00 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
2020-05-28 15:40   ` Xiaoyao Li
2020-05-28 16:15     ` Paolo Bonzini
2020-05-28 16:59       ` Xiaoyao Li [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=54497675-2b35-b351-4259-8eb819daca87@intel.com \
    --to=xiaoyao.li@intel.com \
    --cc=jmattson@google.com \
    --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 \
    /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).