Commit ebd1a33
committed
KVM: SVM: Handle #MCs in guest outside of fastpath
Handle Machine Checks (#MC) that happen in the guest (by forwarding them
to the host) outside of KVM's fastpath so that as much host state as
possible is re-loaded before invoking the kernel's #MC handler. The only
requirement is that KVM invokes the #MC handler before enabling IRQs (and
even that could _probably_ be relaxed to handling #MCs before enabling
preemption).
Waiting to handle #MCs until "more" host state is loaded hardens KVM
against flaws in the #MC handler, which has historically been quite
brittle. E.g. prior to commit 5567d11 ("x86/mce: Send #MC singal from
task work"), the #MC code could trigger a schedule() with IRQs and
preemption disabled. That led to a KVM hack-a-fix in commit 1811d97
("x86/kvm: move kvm_load/put_guest_xcr0 into atomic context").
Note, except for #MCs on VM-Enter, VMX already handles #MCs outside of the
fastpath.
Reviewed-by: Rick Edgecombe <rick.p.edgecombe@intel.com>
Reviewed-by: Jon Kohler <jon@nutanix.com>
Link: https://patch.msgid.link/20251118222328.2265758-2-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>1 parent 38ee66c commit ebd1a33
1 file changed
+9
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4325 | 4325 | | |
4326 | 4326 | | |
4327 | 4327 | | |
4328 | | - | |
4329 | | - | |
4330 | | - | |
4331 | | - | |
4332 | | - | |
4333 | | - | |
4334 | | - | |
4335 | | - | |
4336 | 4328 | | |
4337 | 4329 | | |
4338 | 4330 | | |
| |||
4621 | 4613 | | |
4622 | 4614 | | |
4623 | 4615 | | |
4624 | | - | |
| 4616 | + | |
| 4617 | + | |
| 4618 | + | |
| 4619 | + | |
| 4620 | + | |
4625 | 4621 | | |
| 4622 | + | |
| 4623 | + | |
| 4624 | + | |
| 4625 | + | |
4626 | 4626 | | |
4627 | 4627 | | |
4628 | 4628 | | |
| |||
0 commit comments