KVM: x86: Disallow guest CPUID lookups when IRQs are disabled
authorSean Christopherson <seanjc@google.com>
Tue, 15 Aug 2023 20:36:53 +0000 (13:36 -0700)
committerSean Christopherson <seanjc@google.com>
Thu, 17 Aug 2023 18:43:32 +0000 (11:43 -0700)
commit9717efbe5ba3f52d4b3cc637c7f7f6149ea264bb
tree0e108a699af57665f687770294f2f08ef58e1563
parentee785c870d6f80380be6549772137a41c527d0ba
KVM: x86: Disallow guest CPUID lookups when IRQs are disabled

Now that KVM has a framework for caching guest CPUID feature flags, add
a "rule" that IRQs must be enabled when doing guest CPUID lookups, and
enforce the rule via a lockdep assertion.  CPUID lookups are slow, and
within KVM, IRQs are only ever disabled in hot paths, e.g. the core run
loop, fast page fault handling, etc.  I.e. querying guest CPUID with IRQs
disabled, especially in the run loop, should be avoided.

Link: https://lore.kernel.org/r/20230815203653.519297-16-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
arch/x86/kvm/cpuid.c