From: Paolo Bonzini <pbonzini@redhat.com>
To: Igor Mammedov <imammedo@redhat.com>,
Vitaly Kuznetsov <vkuznets@redhat.com>
Cc: kvm@vger.kernel.org, Sean Christopherson <seanjc@google.com>,
Wanpeng Li <wanpengli@tencent.com>,
Jim Mattson <jmattson@google.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 0/4] KVM: x86: Partially allow KVM_SET_CPUID{,2} after KVM_RUN for CPU hotplug
Date: Tue, 18 Jan 2022 17:17:01 +0100 [thread overview]
Message-ID: <498eb39c-c50a-afef-4d46-5c6753489d7e@redhat.com> (raw)
In-Reply-To: <20220118153531.11e73048@redhat.com>
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
next prev parent reply other threads:[~2022-01-18 16:17 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-17 15:05 Vitaly Kuznetsov
2022-01-17 15:05 ` [PATCH v2 1/4] KVM: x86: Do runtime CPUID update before updating vcpu->arch.cpuid_entries Vitaly Kuznetsov
2022-01-17 15:05 ` [PATCH v2 2/4] KVM: x86: Partially allow KVM_SET_CPUID{,2} after KVM_RUN Vitaly Kuznetsov
2022-01-17 17:30 ` Paolo Bonzini
2022-01-18 8:40 ` Vitaly Kuznetsov
2022-01-18 14:37 ` Vitaly Kuznetsov
2022-01-17 15:05 ` [PATCH v2 3/4] KVM: selftests: Rename 'get_cpuid_test' to 'cpuid_test' Vitaly Kuznetsov
2022-01-17 15:05 ` [PATCH v2 4/4] KVM: selftests: Test KVM_SET_CPUID2 after KVM_RUN Vitaly Kuznetsov
2022-01-18 14:35 ` [PATCH v2 0/4] KVM: x86: Partially allow KVM_SET_CPUID{,2} after KVM_RUN for CPU hotplug Igor Mammedov
2022-01-18 16:17 ` Paolo Bonzini [this message]
2022-01-18 16:53 ` Sean Christopherson
2022-01-18 17:12 ` Paolo Bonzini
2022-01-18 16:34 ` Vitaly Kuznetsov
2022-01-19 7:59 ` Igor Mammedov
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=498eb39c-c50a-afef-4d46-5c6753489d7e@redhat.com \
--to=pbonzini@redhat.com \
--cc=imammedo@redhat.com \
--cc=jmattson@google.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=seanjc@google.com \
--cc=vkuznets@redhat.com \
--cc=wanpengli@tencent.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
all inboxes | Powered by JetHome®