0
votes

I'm currently writing a custom driver for Intel Processor Trace (PT).

According to Intel's Software Developers Manual Vol. 3C 36-13, the CPU "will attempt to signal a ToPA PMI interrupt before the output wraps and overwrites the top of the buffer."

I am struggling to find out how to get notified by the kernel when this PMI occurs. I have various resources about writing generic IRQ handlers (in particular LDD3 Ch. 10), but was not able to figure out the IRQ number of the PT interrupt - or if it even has one.

I also looked at the code that handles PT in the Linux kernel, but couldn't figure out where or how the interrupt handler is registered: https://elixir.bootlin.com/linux/v4.17.2/source/arch/x86/events/intel/pt.c#L1245

Any pointers, resources or even references to code are greatly appreciated.

1
Seems Intel makes a distinction between interrupts and events and that link provides the background how to use the Intel events, events can be either interrupt based or counting based and the hardware event interface is how to access pmu - Sean F
@SeanF: Thank you for that link. It was certainly very interesting and probably one of the most in-depth answers on SO, but I did not really get an answer on how to register such an interrupt. - JacksGT

1 Answers

0
votes

To find where an identifier is referenced, we use the "Search identifier" box on that web site. It immediately gives this result: https://elixir.bootlin.com/linux/v4.17.2/source/arch/x86/events/intel/core.c#L2299

So, intel_pt_interrupt is called from intel_pmu_handle_irq

The comments there explain what it the latter and how it is called. In short, PMI is not a normal interrupt, so reading the LDD book won't yield useful info. For further questions on esoteric Intel arch details, please visit the Intel forums at communities.intel.com