-
Notifications
You must be signed in to change notification settings - Fork 22
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
lib: move cpuid::Set to cpuid_utils; prevent semantic subleaf conflicts #782
Conversation
f37ff55
to
9a9605c
Compare
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.
Very nice! I had a very small suggestions and questions, but nothing big.
9a9605c
to
79204d2
Compare
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.
i echo the proptest enthusiasm and appreciation for nice docs here 🙏
Thanks as always for the reviews! Will merge once CI is green. |
Move the functionality in
propolis::cpuid::Set
intocpuid_utils
, then tidy it up a bit by removing itsfor_regs
andinto_inner
functions (the former was dead code and the latter is no longer needed).Rework
CpuidMap
to prevent callers from using bothCpuidIdent { leaf: x, subleaf: None }
andCpuidIdent { leaf: x, subleaf: Some(y) }
as keys in the same map (does CPUID with eax = x ignore the value passed in ecx or not?).1 This requires a fair bit of new code to handle insert/remove and iteration. Add tests for these cases, including a property test to verify a larger number of iteration patterns than we could hope to write by hand.Finally, add a theory statement and some additional function documentation to the
cpuid_utils
crate.Footnotes
In practice the behavior depends on the order in which the conflicting entries appear in the
vcpu_cpuid_entry
array that Propolis passes to bhyve (the first one to match an incoming CPUID request wins); see bhyve'scpuid_find_entry
. ↩