From: Xiaoyao Li <xiaoyao.li@intel.com>
To: "Krish Sadhukhan" <krish.sadhukhan@oracle.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Radim Krčmář" <rkrcmar@redhat.com>,
"Sean Christopherson" <sean.j.christopherson@intel.com>,
"Vitaly Kuznetsov" <vkuznets@redhat.com>,
"Jim Mattson" <jmattson@google.com>,
"Joerg Roedel" <joro@8bytes.org>
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/4] KVM: VMX: rename {vmx,nested_vmx}_vcpu_setup functions
Date: Thu, 17 Oct 2019 09:25:56 +0800 [thread overview]
Message-ID: <b5e42cff-146d-d802-ce9b-e9b3299b9da9@intel.com> (raw)
In-Reply-To: <2cb1e187-c633-e11c-985c-24ad1e5434c2@oracle.com>
On 10/17/2019 2:09 AM, Krish Sadhukhan wrote:
>
> On 10/15/19 6:27 PM, Xiaoyao Li wrote:
>> On 10/16/2019 6:05 AM, Krish Sadhukhan wrote:
>>>
>>>
>>> On 10/15/2019 09:40 AM, Xiaoyao Li wrote:
>>>> Rename {vmx,nested_vmx}_vcpu_setup to {vmx,nested_vmx}_vmcs_setup,
>>>> to match what they really do.
>>>>
>>>> No functional change.
>>>>
>>>> Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
>>>> ---
>>>> arch/x86/kvm/vmx/nested.c | 2 +-
>>>> arch/x86/kvm/vmx/nested.h | 2 +-
>>>> arch/x86/kvm/vmx/vmx.c | 9 +++------
>>>> 3 files changed, 5 insertions(+), 8 deletions(-)
>>>>
>>>> diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c
>>>> index 5e231da00310..7935422d311f 100644
>>>> --- a/arch/x86/kvm/vmx/nested.c
>>>> +++ b/arch/x86/kvm/vmx/nested.c
>>>> @@ -5768,7 +5768,7 @@ static int vmx_set_nested_state(struct
>>>> kvm_vcpu *vcpu,
>>>> return ret;
>>>> }
>>>> -void nested_vmx_vcpu_setup(void)
>>>> +void nested_vmx_vmcs_setup(void)
>>>> {
>>>> if (enable_shadow_vmcs) {
>>>> vmcs_write64(VMREAD_BITMAP, __pa(vmx_vmread_bitmap));
>>>> diff --git a/arch/x86/kvm/vmx/nested.h b/arch/x86/kvm/vmx/nested.h
>>>> index 187d39bf0bf1..2be1ba7482c9 100644
>>>> --- a/arch/x86/kvm/vmx/nested.h
>>>> +++ b/arch/x86/kvm/vmx/nested.h
>>>> @@ -11,7 +11,7 @@ void nested_vmx_setup_ctls_msrs(struct
>>>> nested_vmx_msrs *msrs, u32 ept_caps,
>>>> bool apicv);
>>>> void nested_vmx_hardware_unsetup(void);
>>>> __init int nested_vmx_hardware_setup(int (*exit_handlers[])(struct
>>>> kvm_vcpu *));
>>>> -void nested_vmx_vcpu_setup(void);
>>>> +void nested_vmx_vmcs_setup(void);
>>>> void nested_vmx_free_vcpu(struct kvm_vcpu *vcpu);
>>>> int nested_vmx_enter_non_root_mode(struct kvm_vcpu *vcpu, bool
>>>> from_vmentry);
>>>> bool nested_vmx_exit_reflected(struct kvm_vcpu *vcpu, u32
>>>> exit_reason);
>>>> diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
>>>> index e660e28e9ae0..58b77a882426 100644
>>>> --- a/arch/x86/kvm/vmx/vmx.c
>>>> +++ b/arch/x86/kvm/vmx/vmx.c
>>>> @@ -4161,15 +4161,12 @@ static void ept_set_mmio_spte_mask(void)
>>>> #define VMX_XSS_EXIT_BITMAP 0
>>>> -/*
>>>> - * Sets up the vmcs for emulated real mode.
>>>> - */
>>>> -static void vmx_vcpu_setup(struct vcpu_vmx *vmx)
>>>> +static void vmx_vmcs_setup(struct vcpu_vmx *vmx)
>>>> {
>>>> int i;
>>>> if (nested)
>>>> - nested_vmx_vcpu_setup();
>>>> + nested_vmx_vmcs_setup();
>>>> if (cpu_has_vmx_msr_bitmap())
>>>> vmcs_write64(MSR_BITMAP, __pa(vmx->vmcs01.msr_bitmap));
>>>> @@ -6777,7 +6774,7 @@ static struct kvm_vcpu *vmx_create_vcpu(struct
>>>> kvm *kvm, unsigned int id)
>>>> cpu = get_cpu();
>>>> vmx_vcpu_load(&vmx->vcpu, cpu);
>>>> vmx->vcpu.cpu = cpu;
>>>> - vmx_vcpu_setup(vmx);
>>>> + vmx_vmcs_setup(vmx);
>>>> vmx_vcpu_put(&vmx->vcpu);
>>>> put_cpu();
>>>> if (cpu_need_virtualize_apic_accesses(&vmx->vcpu)) {
>>>
>>> May be we should rename vmx_vcpu_reset() to vmx_vmcs_reset() as well ?
>>
>> Not really. vmx_vcpu_reset() not only resets vmcs but also the
>> emulated field of vmx vcpu.
>
> It would be a better organization of the code if the resetting of the
> VMCS fields were placed in a separate function.
>
OK, will do it in next version.
> Reviewed-by: Krish Sadhukhan <krish.sadhukhan@oracle.com>
>
next prev parent reply other threads:[~2019-10-17 1:26 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-15 16:40 [PATCH 0/4] Refactor vcpu creation flow of x86 arch Xiaoyao Li
2019-10-15 16:40 ` [PATCH 1/4] KVM: VMX: rename {vmx,nested_vmx}_vcpu_setup functions Xiaoyao Li
2019-10-15 22:05 ` Krish Sadhukhan
2019-10-16 1:27 ` Xiaoyao Li
2019-10-16 18:09 ` Krish Sadhukhan
2019-10-17 1:25 ` Xiaoyao Li [this message]
2019-10-15 16:40 ` [PATCH 2/4] KVM: VMX: Setup MSR bitmap only when has msr_bitmap capability Xiaoyao Li
2019-10-16 0:40 ` Krish Sadhukhan
2019-10-16 1:29 ` Xiaoyao Li
2019-10-15 16:40 ` [PATCH 3/4] KVM: X86: Refactor kvm_arch_vcpu_create Xiaoyao Li
2019-10-17 16:12 ` Sean Christopherson
2019-10-15 16:40 ` [PATCH 4/4] KVM: X86: Make vcpu's FPU allocation a common function 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=b5e42cff-146d-d802-ce9b-e9b3299b9da9@intel.com \
--to=xiaoyao.li@intel.com \
--cc=jmattson@google.com \
--cc=joro@8bytes.org \
--cc=krish.sadhukhan@oracle.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=rkrcmar@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).