[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <498eb39c-c50a-afef-4d46-5c6753489d7e@redhat.com>
Date: Tue, 18 Jan 2022 17:17:01 +0100
From: Paolo Bonzini <pbonzini@...hat.com>
To: Igor Mammedov <imammedo@...hat.com>,
Vitaly Kuznetsov <vkuznets@...hat.com>
Cc: kvm@...r.kernel.org, Sean Christopherson <seanjc@...gle.com>,
Wanpeng Li <wanpengli@...cent.com>,
Jim Mattson <jmattson@...gle.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 0/4] KVM: x86: Partially allow KVM_SET_CPUID{,2} after
KVM_RUN for CPU hotplug
On 1/18/22 15:35, Igor Mammedov wrote:
> Can you check following scenario:
> * on host that has IA32_TSX_CTRL and TSX enabled (RTM/HLE cpuid bits present)
> * boot 2 vcpus VM with TSX enabled on VMM side but with tsx=off on kernel CLI
>
> that should cause kernel to set MSR_IA32_TSX_CTRL to 3H from initial 0H
> and clear RTM+HLE bits in CPUID, check that RTM/HLE cpuid it cleared
>
> * hotunplug a VCPU and then replug it again
> if IA32_TSX_CTRL is reset to initial state, that should re-enable
> RTM/HLE cpuid bits and KVM_SET_CPUID2 might fail due to difference
>
> and as Sean pointed out there might be other non constant leafs,
> where exact match check could leave userspace broken.
MSR_IA32_TSX_CTRL is handled differently straight during the CPUID call:
if (function == 7 && index == 0) {
u64 data;
if (!__kvm_get_msr(vcpu, MSR_IA32_TSX_CTRL, &data, true) &&
(data & TSX_CTRL_CPUID_CLEAR))
*ebx &= ~(F(RTM) | F(HLE));
}
and I think we should redo all or most of kvm_update_cpuid_runtime
the same way.
Paolo
Powered by blists - more mailing lists