AMD Zen 4 CPUs To Support Virtual NMI (VNMI) For Efficiency Optimization
AMD Zen 4 CPUs To Support Virtual NMI (VNMI) For Efficiency Optimization

On Thursday, AMD launched an open-source patch for the Linux kernel that would enable Virtual NMI or Non-Maskable Interrupt support on their Zen 4 CPUs. This particular feature for the processor in Linux OS is something rival Intel has supported with their CPUs for well more than the past decade.
VNMI support allows for the CPU ID to detect the feature, but due to the severely late release from AMD, it is possible that the company has chosen to not initiate it fully until the new Zen 4 architecture later this year.
Santosh Shukla of AMD summarizes the company's Virtual NMI implementation below:
Currently, NMI is delivered to the guest using the Event Injection mechanism. The Event Injection mechanism does not block the delivery of subsequent NMIs. So the Hypervisor needs to track the NMI delivery and its completion (by intercepting IRET) before sending a new NMI.
Virtual NMI (VNMI) allows the hypervisor to inject the NMI into the guest w/o using Event Injection mechanism meaning not required to track the guest NMI and intercepting the IRET. To achieve that, VNMI feature provides virtualized NMI and NMI_MASK capability bits in VMCB intr_control - V_NMI(11) - Indicates whether a virtual NMI is pending in the guest. V_NMI_MASK(12) - Indicates whether virtual NMI is masked in the guest. V_NMI_ENABLE(26) - Enables the NMI virtualization feature for the guest.
When Hypervisor wants to inject NMI, it will set V_NMI bit, Processor will clear the V_NMI bit and Set the V_NMI_MASK which means the Guest is handling NMI, After the guest handled the NMI, The processor will clear the V_NMI_MASK on the successful completion of IRET instruction Or if VMEXIT occurs while delivering the virtual NMI.
Michael Larabel of Phoronix states that the VNMI is only useful in optimizing efficiency in AMD's own virtualized guests that will not require themselves to follow the NMI state with any concerns about intercepting the interrupt return or IRET when the NMI handling is complete. Intel has had this utilization for virtualization as far back as 2008 in Linux platforms.
The inclusion from AMD now hints that the new series of patches will see use in the next Zen 4-powered Ryzen 7000 series, along with the company's EPYC 7004 series.
News Sources: Phoronix, Linux Kernel info page
What's Your Reaction?






