From: Tom Lendacky <thomas.lendacky@amd.com>
To: Jim Mattson <jmattson@google.com>
Cc: Babu Moger <babu.moger@amd.com>,
pbonzini@redhat.com, tglx@linutronix.de, mingo@redhat.com,
bp@alien8.de, fenghua.yu@intel.com, tony.luck@intel.com,
wanpengli@tencent.com, kvm@vger.kernel.org, peterz@infradead.org,
seanjc@google.com, joro@8bytes.org, x86@kernel.org,
kyung.min.park@intel.com, linux-kernel@vger.kernel.org,
krish.sadhukhan@oracle.com, hpa@zytor.com,
mgross@linux.intel.com, vkuznets@redhat.com,
kim.phillips@amd.com, wei.huang2@amd.com
Subject: Re: [PATCH v4 2/2] KVM: SVM: Add support for Virtual SPEC_CTRL
Date: Mon, 13 Jun 2022 15:16:14 -0500 [thread overview]
Message-ID: <17a3d97e-3087-e79a-120d-b4a45f6c4fba@amd.com> (raw)
In-Reply-To: <CALMp9eRnC1RgRwj64TJcXdhhL6g835N_-E8FbeHVre6aX=18-A@mail.gmail.com>
On 6/13/22 14:23, Jim Mattson wrote:
> On Mon, Jun 13, 2022 at 8:10 AM Tom Lendacky <thomas.lendacky@amd.com> wrote:
>>
>> On 6/3/22 22:11, Jim Mattson wrote:
>>> On Thu, Jan 28, 2021 at 4:43 PM Babu Moger <babu.moger@amd.com> wrote:
>>>
>>>> This support also fixes an issue where a guest may sometimes see an
>>>> inconsistent value for the SPEC_CTRL MSR on processors that support
>>>> this feature. With the current SPEC_CTRL support, the first write to
>>>> SPEC_CTRL is intercepted and the virtualized version of the SPEC_CTRL
>>>> MSR is not updated. When the guest reads back the SPEC_CTRL MSR, it
>>>> will be 0x0, instead of the actual expected value. There isn’t a
>>>> security concern here, because the host SPEC_CTRL value is or’ed with
>>>> the Guest SPEC_CTRL value to generate the effective SPEC_CTRL value.
>>>> KVM writes with the guest's virtualized SPEC_CTRL value to SPEC_CTRL
>>>> MSR just before the VMRUN, so it will always have the actual value
>>>> even though it doesn’t appear that way in the guest. The guest will
>>>> only see the proper value for the SPEC_CTRL register if the guest was
>>>> to write to the SPEC_CTRL register again. With Virtual SPEC_CTRL
>>>> support, the save area spec_ctrl is properly saved and restored.
>>>> So, the guest will always see the proper value when it is read back.
>>>
>>> Note that there are actually two significant problems with the way the
>>> new feature interacts with the KVM code before this patch:
>>> 1) All bits set by the first non-zero write become sticky until the
>>> vCPU is reset (because svm->spec_ctrl is never modified after the
>>> first non-zero write).
>>
>> When X86_FEATURE_V_SPEC_CTRL is set, then svm->spec_ctrl isn't used.
>
> Post-patch, yes. I'm talking about how this new hardware feature broke
> versions of KVM *before* this patch was submitted.
Ah, yes, I get it now. I wasn't picking up on the aspect of running older
KVM versions on the newer hardware, sorry.
I understand what you're driving at, now. We do tell the hardware teams
that add this type of feature that we need a VMCB enable bit, e.g. make it
an opt in feature. I'll be sure to communicate that to them again so that
this type of issue can be avoided in the future.
Thanks,
Tom
>
next prev parent reply other threads:[~2022-06-13 20:55 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-29 0:43 [PATCH v4 0/2] x86: Add the feature " Babu Moger
2021-01-29 0:43 ` [PATCH v4 1/2] x86/cpufeatures: Add the Virtual SPEC_CTRL feature Babu Moger
2021-01-29 0:43 ` [PATCH v4 2/2] KVM: SVM: Add support for Virtual SPEC_CTRL Babu Moger
2021-02-11 8:56 ` Paolo Bonzini
2021-02-11 22:42 ` Babu Moger
2022-06-04 3:11 ` Jim Mattson
2022-06-13 15:09 ` Tom Lendacky
2022-06-13 19:23 ` Jim Mattson
2022-06-13 20:16 ` Tom Lendacky [this message]
2022-06-13 20:28 ` Jim Mattson
2021-02-10 23:40 ` [PATCH v4 0/2] x86: Add the feature " Babu Moger
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=17a3d97e-3087-e79a-120d-b4a45f6c4fba@amd.com \
--to=thomas.lendacky@amd.com \
--cc=babu.moger@amd.com \
--cc=bp@alien8.de \
--cc=fenghua.yu@intel.com \
--cc=hpa@zytor.com \
--cc=jmattson@google.com \
--cc=joro@8bytes.org \
--cc=kim.phillips@amd.com \
--cc=krish.sadhukhan@oracle.com \
--cc=kvm@vger.kernel.org \
--cc=kyung.min.park@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mgross@linux.intel.com \
--cc=mingo@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peterz@infradead.org \
--cc=seanjc@google.com \
--cc=tglx@linutronix.de \
--cc=tony.luck@intel.com \
--cc=vkuznets@redhat.com \
--cc=wanpengli@tencent.com \
--cc=wei.huang2@amd.com \
--cc=x86@kernel.org \
/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®