Process context of perf sample from interrupt handler

From: Probir Roy
Date: Wed Oct 04 2017 - 09:54:22 EST


Hi,

I'm writing a Linux kernel module that uses debug-register to sample
Linux kernel using perf interface "register_wide_hw_breakpoint". I am
interested to get the "callchain" of the process context at the sample
handler. For this I have set PERF_SAMPLE_CALLCHAIN as a sample type.

One issue is that the associated instruction pointer(IP) and
callchain(perf_callchain) of the samples belongs to nmi context rather
than process context. How can I collect the information associated
with process context rather than nmi context? Previously, I have done
sampling from user-space which gave me correct callchain. But I cannot
make it work from kernel space. Any help would be appreciated.

Regards,
Probir