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)
Fri, Nov 15, 2:51 PM
Unknown Object (File)
Oct 20 2024, 2:18 PM
Unknown Object (File)
Sep 27 2024, 11:29 PM
Unknown Object (File)
Sep 26 2024, 2:29 PM
Unknown Object (File)
Sep 24 2024, 4:50 AM
Unknown Object (File)
Sep 23 2024, 1:18 PM
Unknown Object (File)
Sep 19 2024, 10:20 AM
Unknown Object (File)
Sep 4 2024, 7:29 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)