Page MenuHomeFreeBSD

Implement NMI window exiting on AMD/SVM processors.
Needs ReviewPublic

Authored by neel on Apr 23 2015, 2:40 AM.
Tags
None
Referenced Files
Unknown Object (File)
Dec 23 2023, 12:44 PM
Unknown Object (File)
Nov 10 2023, 10:16 AM
Unknown Object (File)
Nov 7 2023, 9:25 AM
Unknown Object (File)
Nov 5 2023, 2:31 PM
Unknown Object (File)
Oct 9 2023, 9:10 AM
Unknown Object (File)
Oct 6 2023, 8:21 AM
Unknown Object (File)
Sep 14 2023, 10:24 AM
Unknown Object (File)
Jun 27 2023, 5:37 PM
Subscribers

Details

Reviewers
rgrimes
Group Reviewers
bhyve
Summary

AMD/SVM does not have hardware assist for NMI window exiting. The hypervisor
tracks the state of NMI blocking in two stages.

In the first stage the "iret" intercept is enabled. This causes a #VMEXIT
when the guest tries to execute an "iret" to return from the NMI handler.

In the second stage the "iret" intercept is cleared and the "iret" instruction
is single-stepped by the hypervisor by setting the 'Trap' and 'Resume' bits
in the %rflags register. Additionally the hypervisor also enables intercepts
for all exceptions.

If the "iret" executes successfully the #DB exception triggers a #VMEXIT.
In response to this the hypervisor unblocks NMIs, disables the exception
intercepts and resumes guest execution.

If the "iret" causes an exception (#GP, #PF etc) then it will trigger a
#VMEXIT. In response to this the hypervisor unblocks NMIs, disables the
exception intercepts and reflects the exception back into the guest.

The odd case is when the "iret" results in a hardware task switch and the
single-stepping described above does not work. In this case the NMI is
unblocked before the "iret" is executed by the vcpu.

Test Plan

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage

Event Timeline

neel retitled this revision from to Implement NMI window exiting on AMD/SVM processors..
neel updated this object.
neel added a reviewer: grehan.
neel edited the test plan for this revision. (Show Details)