-
Notifications
You must be signed in to change notification settings - Fork 2
Cpu profiles (2/3): CPUID definitions #55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: gardenlinux
Are you sure you want to change the base?
Cpu profiles (2/3): CPUID definitions #55
Conversation
Since enabling AMX tile state components affect the result returned by `Hypervisor::get_supported_cpuid` we want this enabled prior to checking CPUID compatibility between the source and destination VMs. Although this is not required today, it is necessary in order for the upcoming CPU profiles correctly, and it will also be necessary once the check_cpuid_compatibility checks are extended to take state components into account. Signed-off-by: Oliver Anderson <oliver.anderson@cyberus-technology.de> On-behalf-of: SAP oliver.anderson@sap.com
Temporary workaround until we switch over to the WIP fix upstream Signed-off-by: Oliver Anderson <oliver.anderson@cyberus-technology.de> On-behalf-of: SAP oliver.anderson@sap.com
These data structures are required to define CPU profiles. Signed-off-by: Oliver Anderson <oliver.anderson@cyberus-technology.de> On-behalf-of: SAP oliver.anderson@sap.com
We want CPU profiles to keep a record of the hypervisor type and cpu vendor that they are intended to work with. This is made more convenient if all of these types implement common traits (used for serialization). Signed-Off-by: Oliver Anderson <oliver.anderson@cyberus-technology.de> On-behalf-of: SAP oliver.anderson@sap.com
We introduce essential data structures together with basic functionality that is necessary to apply a CPU profile to a host. Signed-off-by: Oliver Anderson <oliver.anderson@cyberus-technology.de> On-behalf-of: SAP oliver.anderson@sap.com
We integrate the CPU profile into the various configs that ultimately get set by the user. This quickly ends up involving multiple files, luckily Rust helps us find which ones via compilation errors. Signed-Off-by: Oliver Anderson <oliver.anderson@cyberus-technology.de> On-behalf-of: SAP oliver.anderson@sap.com
4923d54 to
c651d96
Compare
If a CPU profile is configured it should result in guests seeing a restricted subset of CPUID. This is what we finally achieve in this commit. Signed-off-by: Oliver Anderson <oliver.anderson@cyberus-technology.de> On-behalf-of: SAP oliver.anderson@sap.com
We include CPU profiles corresponding to Intel Skylake and Sapphire rapids server that we generated using our WIP CPU profile generation tool. Signed-of-by: Oliver Anderson <oliver.anderson@cyberus-technology.de> On-behalf-of: SAP oliver.anderson@sap.com
We introduce data structures to describe values within the registers modified by the CPUID instruction. These data structures will later be used by the upcoming CPU profile generation tool. Signed-off-by: Oliver Anderson <oliver.anderson@cyberus-technology.de> On-behalf-of: SAP oliver.anderson@sap.com
We introduce CPUID definitions for Intel CPUs that will be utilized by the upcoming CPU Profile generation tool. Signed-off-by: Oliver Anderson <oliver.anderson@cyberus-technology.de> On-behalf-of: SAP oliver.anderson@sap.com
We introduce CPUID definitions defined for the KVM hypervisor. These definitions will later be utilized by the upcoming CPU profile generation tool. Signed-off-by: Oliver Anderson <oliver.anderson@cyberus-technology.de> On-behalf-of: SAP oliver.anderson@sap.com
We use the Intel CPUID definitions to provide more information when CPUID compatibility checks fail (when both the source and destination VM run on Intel CPUs). Signed-off-by: Oliver Anderson <oliver.anderson@cyberus-technology.de> On-behalf-of: SAP oliver.anderson@sap.com
c651d96 to
a707a16
Compare
phip1611
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Truely incredible work. For obvious reasons, I cannot review every CPUID leaf. Given the immense time and testing Thomas and especially you Oliver invested into this, I'm more than happy to approve this.
| /// | ||
| /// ### How we produced this table | ||
| /// | ||
| /// We first ran the [`cpuidgen` tool](https://gitlab.com/x86-cpuid.org/x86-cpuid-db), whose |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we first ran the
cpuidgentool, whos
Is this still true? You wrote your own tool, didn't you?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The linked tool does something quite different than the one I wrote. The linked tool generates a CSV file describing CPUID values. The output of the aforementioned tool is not too different from the INTEL_CPUID_DEFINITIONS table here, except that it is CSV, not Rust code and more importantly does not contain ProfilePolicy values.
The tool I wrote on the other hand, produces CpuProfileData serialized to file. This data structure contains actual values and not descriptions.
This is the second PR in the CPU profiles series.
In this PR we introduce CPUID definitions describing the values within registers modified by the CPUID instruction. We write out an (almost) complete table of such descriptions of Intel CPUs and also for the KVM hypervisor.
These tables will be utilized by the upcoming CPU profile generation tool, but we also utilize the Intel table already in this PR in order to give more detailed logs when CPUID compatibility checks fail.
This PR depends on #50. A diff view between the two can be found here: olivereanderson/cloud-hypervisor@olivereanderson:cloud-hypervisor:cpu-profiles-cpuid...cpuid-definitions
Outlook
We also want to support generating CPU profiles for AMD CPUs, but we do not have the time to do that right now.
If someone else wants to pick that up (before we do) then we suggest creating separate CPUID definitions for AMD
even though maybe 80% or more of the tables will coincide.