I'm trying to register an interrupt handler for the performance monitoring interrupt (PMI).
I was hoping I could just find the IRQ line number by looking in /proc/interrupts (grep PMI /proc/interrupts) but when I try to register that irq using register_irq, the system hangs.
I've also been reading about APIC/LAPIC in the Intel documentation, but it's not clear to me how to actually use it. There is an APIC register for the performance monitoring counter's local vector table (which is presumably related to the PMI), which can be read and written to, but I'm not sure if I can use that to define the entrypoint for my custom PMI handler.
What is the relationship between the Local Vector Table in the APIC and the value shown in /proc/interrupts? How do I register a handler for the PMI (which presumably occurs when a performance counter overflows)?
I should also mention I'm on a 2.6 kernel (HPC system, no chance to update), SandyBridge.
How to register PMI handler?
-
- Posts: 2
- Joined: Wed Aug 14, 2013 10:40 am
Re: How to register PMI handler?
reading a bit more (which I probably should have done in the first place I can use the performance counting LVT in the APIC to specify how the PMC interrupt is delivered.
The code for perf and oprofile both set it to deliver as an NMI. The question then becomes: how to register an NMI handler? also, NMI's are used for a bunch of critical stuff, how do I handle the NMI without overwriting critical handlers?
I'm doing this as a linux driver, and the latest linux actually includes "register_nmi_handler" function, but 2.6 does not. i'm still digging to figure out how to make it work in 2.6, i think "register_die_notifier" might help, hopefully they take care of critical handlers.
The code for perf and oprofile both set it to deliver as an NMI. The question then becomes: how to register an NMI handler? also, NMI's are used for a bunch of critical stuff, how do I handle the NMI without overwriting critical handlers?
I'm doing this as a linux driver, and the latest linux actually includes "register_nmi_handler" function, but 2.6 does not. i'm still digging to figure out how to make it work in 2.6, i think "register_die_notifier" might help, hopefully they take care of critical handlers.