WIP: Make CPU profiles MSR aware#70
Draft
olivereanderson wants to merge 16 commits intocyberus-technology:gardenlinuxfrom
Draft
WIP: Make CPU profiles MSR aware#70olivereanderson wants to merge 16 commits intocyberus-technology:gardenlinuxfrom
olivereanderson wants to merge 16 commits intocyberus-technology:gardenlinuxfrom
Conversation
7a0c713 to
abe10dd
Compare
324135c to
b8fa2a0
Compare
This was referenced Feb 9, 2026
b85447c to
1463253
Compare
7d80ea0 to
b348d8a
Compare
In order to apply CPU profiles we need to modify the MSR-based features according to the profile. The first step is to obtain these MSR-based features from the hypervisor as introduced in this commit. Signed-off-by: Oliver Anderson <oliver.anderson@cyberus-technology.de> On-behalf-of: SAP oliver.anderson@sap.com
We want to deny MSRs that are not available, or should not be available for a given CPU profile, but in order to do that we must also have some means to see which MSRs are supported by the host. Signed-off-by: Oliver Anderson <oliver.anderson@cyberus-technology.de> On-behalf-of: SAP oliver.anderson@sap.com
We realized that we only need a method for obtaining supported MSR indices and the buffer can be built from that in the `CpuManager`'s constructor. Signed-off-by: Oliver Anderson <oliver.anderson@cyberus-technology.de> On-behalf-of: SAP oliver.anderson@sap.com
In order to ensure that MSRs that are not compatible with a given CPU profile do no get accessed by the guests we need to introduce functionality to deny such MSRs via filters. The implementation introduced here is mostly a temporary workaround until rust-vmm/kvm#359 gets integrated in CHV. Signed-off-by: Oliver Anderson <oliver.anderson@cyberus-technology.de> On-behalf-of: SAP oliver.anderson@sap.com
In preparation for making CPU profiles MSR aware we prepare for having two pieces of data associated with a CPU profile: CPUID and MSR adjustments. We thus rename the pre-existing CpuProfileData struct to CpuIdProfileData and adapt the CPU profile generation tool accordingly. We also make the CPU profile generation tool write directly to file and automatically introduce the required license file as well. This makes the profile generation process more convenient. Signed-off-by: Oliver Anderson <oliver.anderson@cyberus-technology.de> On-behalf-of: SAP oliver.anderson@sap.com
Introduce convenience methods for looking up CPUID value definitions. We will later use these methods to assert certain policies at compile time in order to stay consistent with MSR policies we introduce. Signed-off-by: Oliver Anderson <oliver.anderson@cyberus-technology.de> On-behalf-of: SAP oliver.anderson@sap.com
In order to generate CPU profiles we also need definitions and policies for MSR-based features, as some CPU features are exposed through MSRs rather than CPUID. This commit introduces the MSR analogues of the data structures we previously introduced for CPUID definitions. Signed-off-by: Oliver Anderson <oliver.anderson@cyberus-technology.de> On-behalf-of: SAP oliver.anderson@sap.com
We introduce MSR-based feature 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
In order for live migrations to be safe it is necessary to ensure that the destination VM exposes MSR-based features compatible with those of the source VM. These checks have been omitted from CHV thus far, but we introduce them here for Intel CPUs. Our checks provide logs at the error level and debug level. The former aims to provide the minimal amount of information required to investigate the problem further, while the debug logs provide (much) more convenience when debugging. We will also incorporate these checks in the context of CPU profiles in a later commit. Signed-off-by: Oliver Anderson <oliver.anderson@cyberus-technology.de> On-behalf-of: SAP oliver.anderson@sap.com
This list will be used to help us detect unknown MSRs when generating CPU profiles. It serves no other purpose beyond that. Signed-off-by: Oliver Anderson <oliver.anderson@cyberus-technology.de> On-behalf-of: SAP oliver.anderson@sap.com
We include a list of non-architectural MSRS. This list will only be used to help the CPU profile generation tool rule out MSRs that it does not know how to handle. Signed-off-by: Oliver Anderson <oliver.anderson@cyberus-technology.de> On-behalf-of: SAP oliver.anderson@sap.com
We include a list of MSRS defined by KVM that may be approved by CPU profiles and another list of those that may not be approved by CPU profiles. These lists will later be used by the CPU profile generation tool. Signed-off-by: Oliver Anderson <oliver.anderson@cyberus-technology.de> On-behalf-of: SAP oliver.anderson@sap.com
We introduce functionality related to adjusting MSR-based features according to the CPU profile. The functionality introduced here will be utilized in a follow up commit. Signed-off-by: Oliver Anderson <oliver.anderson@cyberus-technology.de> On-behalf-of: SAP oliver.anderson@sap.com
We record the necessary MSR-based feature modifications that need to be set in the `CpuManager` and make sure to set these MSR values upon vCPU configuration. Signed-off-by: Oliver Anderson <oliver.anderson@cyberus-technology.de> On-behalf-of: SAP oliver.anderson@sap.com
We adapt the CPU profile generation tool to also take the MSR-based features into account. Signed-off-by: Oliver Anderson <oliver.anderson@cyberus-technology.de> On-behalf-of: SAP oliver.anderson@sap.com
We regenerate the CPU profiles and include the MSR-related data. Signed-off-by: Oliver Anderson <oliver.anderson@cyberus-technology.de> On-behalf-of: SAP oliver.anderson@sap.com
b348d8a to
18c1575
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
WIP: Do not review
TODO: