mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
In order to safely apply CPU profiles we need to ensure that the host's feature MSRs that are permitted by the CPU profile are also compatible with the values the CPU profile dictates. KVM_SET_MSRs takes care of checking compatibility for most feature MSRs on both Intel and AMD CPUs that we will permit CPU profiles to have (more on this in the upcoming CPU profile generation tool PRs), but there is one exception. Userspace may set whatever value for the Intel exclusive IA32_ARCH_CAPABILITIES MSR without receiving any complaints from KVM. We thus introduce our own compatibility check for IA32_ARCH_CAPABILITIES. One might even argue that KVM_SET_MSRs is called relatively late when creating or receiving a VM and that it would be preferable to have compatibility checks for all permitted feature MSRs run earlier. This would also mean more informative debug logs. We argue however that those additional checks would lead to too much code that is not strictly necessary which is why we decided against doing that in this patch set. The code introduced here is only intended to be used with CPU profiles at this point in time, but it is written in such a way that it could also be used for MSR compatibility checks between a migration source and destination (when the Host profile is in use) should that be desired in the future. Signed-off-by: Oliver Anderson <oliver.anderson@cyberus-technology.de> On-behalf-of: SAP oliver.anderson@sap.com