From: Xiaoyao Li <xiaoyao.li@intel.com>
To: Jim Mattson <jmattson@google.com>, kvm list <kvm@vger.kernel.org>
Cc: "Gao, Chao" <chao.gao@intel.com>
Subject: Re: KVM's sloppiness wrt IA32_SPEC_CTRL and IA32_PRED_CMD
Date: Thu, 20 Jul 2023 09:25:14 +0800 [thread overview]
Message-ID: <529cd705-f5c3-a5d1-9999-a3d2ccd09dd6@intel.com> (raw)
In-Reply-To: <CALMp9eRQeZESeCmsiLyxF80Bsgp2r54eSwXC+TvWLQAWghCdZg@mail.gmail.com>
On 7/20/2023 2:08 AM, Jim Mattson wrote:
> Normally, we would restrict guest MSR writes based on guest CPU
> features. However, with IA32_SPEC_CTRL and IA32_PRED_CMD, this is not
> the case.
>
> For the first non-zero write to IA32_SPEC_CTRL, we check to see that
> the host supports the value written. We don't care whether or not the
> guest supports the value written (as long as it supports the MSR).
> After the first non-zero write, we stop intercepting writes to
> IA32_SPEC_CTRL, so the guest can write any value supported by the
> hardware. This could be problematic in heterogeneous migration pools.
> For instance, a VM that starts on a Cascade Lake host may set
> IA32_SPEC_CTRL.PSFD[bit 7], even if the guest
> CPUID.(EAX=07H,ECX=02H):EDX.PSFD[bit 0] is clear. Then, if that VM is
> migrated to a Skylake host, KVM_SET_MSRS will refuse to set
> IA32_SPEC_CTRL to its current value, because Skylake doesn't support
> PSFD.
>
> We disable write intercepts IA32_PRED_CMD as long as the guest
> supports the MSR. That's fine for now, since only one bit of PRED_CMD
> has been defined. Hence, guest support and host support are
> equivalent...today. But, are we really comfortable with letting the
> guest set any IA32_PRED_CMD bit that may be defined in the future?
>
> The same question applies to IA32_SPEC_CTRL. Are we comfortable with
> letting the guest write to any bit that may be defined in the future?
My point is we need to fix it, though Chao has different point that
sometimes performance may be more important[*]
[*] https://lore.kernel.org/all/ZGdE3jNS11wV+V2w@chao-email/
> At least the AMD approach with V_SPEC_CTRL prevents the guest from
> clearing any bits set by the host, but on Intel, it's a total
> free-for-all. What happens when a new bit is defined that absolutely
> must be set to 1 all of the time?
next prev parent reply other threads:[~2023-07-20 1:25 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-19 18:08 KVM's sloppiness wrt IA32_SPEC_CTRL and IA32_PRED_CMD Jim Mattson
2023-07-20 1:25 ` Xiaoyao Li [this message]
2023-07-20 1:58 ` Chao Gao
2023-07-20 4:04 ` Xiaoyao Li
2023-07-20 10:38 ` Chao Gao
2023-07-20 4:04 ` Jim Mattson
2023-07-20 8:03 ` Chao Gao
2023-07-20 17:52 ` Jim Mattson
2023-07-21 3:37 ` Chao Gao
2023-07-21 19:01 ` Pawan Gupta
2023-07-21 19:18 ` Jim Mattson
2023-07-21 20:54 ` Pawan Gupta
2023-07-21 22:18 ` Jim Mattson
2023-07-21 22:29 ` Pawan Gupta
2023-07-24 19:25 ` Pawan Gupta
2023-07-24 20:01 ` Jim Mattson
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=529cd705-f5c3-a5d1-9999-a3d2ccd09dd6@intel.com \
--to=xiaoyao.li@intel.com \
--cc=chao.gao@intel.com \
--cc=jmattson@google.com \
--cc=kvm@vger.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