Intel Improving NMI Source Reporting On Linux With FRED

Written by Michael Larabel in Intel on 30 May 2024 at 06:24 AM EDT. 2 Comments
INTEL
As part of Intel's Flexible Return Event Delivery (FRED), Intel open-source software engineers are now working on improving Non-Maskable Interrupt (NMI) source reporting for the Linux kernel.

Intel FRED was merged in Linux 6.9 as an important change coming with future Intel processors to overhaul CPU ring transitions. As part of the FRED specification, Intel engineers are now tackling NMI source reporting to address inefficiencies and increased latency for performance monitoring and handling with CPU backtraces, the kernel debugger, and more.

Intel's Jacob Pan explained elegantly of this new NMI source reporting work with FRED:
"Non-Maskable Interrupts (NMIs) are routed to the local Advanced Programmable Interrupt Controller (APIC) using vector #2. Before the advent of the Flexible Return and Event Delivery (FRED), the vector information set by the NMI initiator was disregarded or lost within the hardware, compelling system software to poll every registered NMI handler to pinpoint the source of the NMI. This approach led to several issues:

1. Inefficiency due to the CPU's time spent polling all handlers.
2. Increased latency from the additional time taken to poll all handlers.
3. The occurrence of unnecessary NMIs if they are triggered shortly after being processed by a different source.

To tackle these challenges, Intel introduced NMI source reporting as a part of the FRED specification (detailed in Chapter 9). This CPU feature ensures that while all NMI sources are still aggregated into NMI vector (#2) for delivery, the source of the NMI is now conveyed through FRED event data (a 16-bit bitmap on the stack). This allows for the selective dispatch of the NMI source handler based on the bitmap, eliminating the need to invoke all NMI source handlers indiscriminately.

In line with the hardware architecture, various interrupt sources can generate NMIs by encoding an NMI delivery mode. However, this patchset activates only the local NMI sources that are currently utilized by the Linux kernel, which includes:

1. Performance monitoring.
2. Inter-Processor Interrupts (IPIs) for functions like CPU backtrace, machine check, Kernel GNU Debugger (KGDB), reboot, panic stop, and self-test.

Other NMI sources will continue to be handled as previously when the NMI source is not utilized or remains unidentified."

So far I haven't seen any public confirmation of which Intel CPU generation will begin seeing FRED.

Intel FRED


Those interested in this improved NMI source reporting for Linux can find the newly-published patches on the Linux kernel mailing list.
Related News
About The Author
Michael Larabel

Michael Larabel is the principal author of Phoronix.com and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via MichaelLarabel.com.

Popular News This Week