Add cpu policy helper and test#504
Conversation
glehmann
left a comment
There was a problem hiding this comment.
The test doesn't seem actually to validate anything. Am I missing something?
There's nothing to validate aside that it doesn't errors. |
200ad5e to
c5c5868
Compare
| # msr -> val | ||
| msr: dict[int, int] | ||
|
|
||
| def __init__(self, cpuid: dict[(int, int), int], msr: dict[int, int]): |
There was a problem hiding this comment.
| def __init__(self, cpuid: dict[(int, int), int], msr: dict[int, int]): | |
| def __init__(self, cpuid: dict[tuple[int, int], tuple[int, int, int, int]], msr: dict[int, int]): |
There was a problem hiding this comment.
@glehmann, is the current recommendation to use native types for typing or the ones from the typing module?
There was a problem hiding this comment.
tuple[int, int, int, int] might be better represented with
@dataclass(frozen=True)
class CpuidRegisters:
eax: int
ebx: int
ecx: int
edx: intand used as
def __init__(self, cpuid: dict[tuple[int, int], CpuidRegisters], msr: dict[int, int]): current_policy.cpuid[key] = CpuidRegisters(
int(eax, 16),
int(ebx, 16),
int(ecx, 16),
int(edx, 16)
)Each element can then be accessed by name:
current_policy.cpuid[key].eaxc5c5868 to
831e049
Compare
dinhngtu
left a comment
There was a problem hiding this comment.
Please fix the checkers first.
a31a080 to
8842d6b
Compare
|
@TSnake41 After a force push, if your PR is ready for re-review, always ask the reviewers who commented for a re-review. |
Add a CPU policy tooling to be able to check for certain CPU feature. The test_cpu_policy also logs hosts CPU policies for debugging purposes. Signed-off-by: Teddy Astie <teddy.astie@vates.tech>
8842d6b to
184bd3d
Compare
Signed-off-by: Samuel Verschelde <stormi-xcp@ylix.fr>
Add a CPU policy tooling to be able to check for certain CPU feature.
The test_cpu_policy also logs hosts CPU policies for debugging purposes (especially around live migrations).
Required by #393