[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <89f240cb-cb3a-c362-7ded-ee500cc12dc3@intel.com>
Date: Sat, 17 Jul 2021 11:55:37 +0800
From: Zeng Guang <guang.zeng@...el.com>
To: Paolo Bonzini <pbonzini@...hat.com>,
Sean Christopherson <seanjc@...gle.com>,
Vitaly Kuznetsov <vkuznets@...hat.com>,
Wanpeng Li <wanpengli@...cent.com>,
Jim Mattson <jmattson@...gle.com>,
Joerg Roedel <joro@...tes.org>, kvm@...r.kernel.org,
Dave Hansen <dave.hansen@...ux.intel.com>,
Tony Luck <tony.luck@...el.com>,
Kan Liang <kan.liang@...ux.intel.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
"H. Peter Anvin" <hpa@...or.com>,
Kim Phillips <kim.phillips@....com>,
Jarkko Sakkinen <jarkko@...nel.org>,
Jethro Beekman <jethro@...tanix.com>,
Kai Huang <kai.huang@...el.com>
Cc: x86@...nel.org, linux-kernel@...r.kernel.org,
Robert Hu <robert.hu@...el.com>, Gao Chao <chao.gao@...el.com>,
Emanuele Giuseppe Esposito <eesposit@...hat.com>
Subject: Re: [PATCH 6/6] KVM: VMX: enable IPI virtualization
On 7/16/2021 5:52 PM, Paolo Bonzini wrote:
> On 16/07/21 08:48, Zeng Guang wrote:
>>
>> + if (!(_cpu_based_3rd_exec_control & TERTIARY_EXEC_IPI_VIRT))
>> + enable_ipiv = 0;
>> +
>> }
>
> Please move this to hardware_setup(), using a new function
> cpu_has_vmx_ipiv() in vmx/capabilities.h.
>
ok, we will change it to follow current framework.
>> if (_cpu_based_exec_control &
>> CPU_BASED_ACTIVATE_TERTIARY_CONTROLS) {
>> - u64 opt3 = 0;
>> + u64 opt3 = enable_ipiv ? TERTIARY_EXEC_IPI_VIRT : 0;
>> u64 min3 = 0;
>
> I like the idea of changing opt3, but it's different from how
> setup_vmcs_config works for the other execution controls. Let me
> think if it makes sense to clean this up, and move the handling of
> other module parameters from hardware_setup() to setup_vmcs_config().
>
May be an exception for ipiv feature ?
>> +
>> + if (vmx->ipiv_active)
>> + install_pid(vmx);
>
> This should be if (enable_ipiv) instead, I think.
>
> In fact, in all other places that are using vmx->ipiv_active, you can
> actually replace it with enable_ipiv; they are all reached only with
> kvm_vcpu_apicv_active(vcpu) == true.
>
enable_ipiv as a global variable indicates the hardware capability to
enable IPIv. Each VM may have different IPIv configuration according to
kvm_vcpu_apicv_active status. So we use ipiv_active per VM to enclose
IPIv related operations.
>> + if (!enable_apicv) {
>> + enable_ipiv = 0;
>> + vmcs_config.cpu_based_3rd_exec_ctrl &= ~TERTIARY_EXEC_IPI_VIRT;
>> + }
>
> The assignment to vmcs_config.cpu_based_3rd_exec_ctrl should not be
> necessary; kvm_vcpu_apicv_active will always be false in that case and
> IPI virtualization would never be enabled.
>
We originally intend to make vmcs_config consistent with the actual ipiv
capability and decouple it from other factors. As you mentioned , it's
not necessary to update vmcs_config.cpu_based_3rd_exec_ctrl in this
case. We will remove it.
Thanks.
> Paolo
>
Powered by blists - more mailing lists