Why does it need to happen at NMI time? Why can't you just do it in the user process's context,
before resuming execution of their code?
The setitimer(ITIMER_PROF) solution that userspace profilers use clearly works out fine for
userspace profiling. Can't you do something similar for userspace profiling from within the kernel?
The stack trace of the userspace half clearly can't change between when you received the NMI and
when you resume execution of the process...
That just leaves the complication of implementing the DWARF unwinder in the kernel, but there's
already much more complex code in the kernel...that really seems like it should be a non-issue.
Posted Mar 26, 2010 23:28 UTC (Fri) by nix (subscriber, #2304)
[Link]
There is already a DWARF unwinder in the kernel (or was, and it could be
resurrected). The tricky part is making it paranoid enough to be
non-DoSable, even by hostile generators of DWARF2. IIRC the kernel
unwinder was ripped out by Linus because it kept falling over when
unwinding purely kernel stack frames...
Finding a profiler that works, damnit
Posted Mar 27, 2010 14:10 UTC (Sat) by garloff (subscriber, #319)
[Link]
Posted Mar 27, 2010 15:12 UTC (Sat) by foom (subscriber, #14868)
[Link]
Care to expand upon that link with some explanatory text?
Finding a profiler that works, damnit
Posted Mar 28, 2010 0:26 UTC (Sun) by garloff (subscriber, #319)
[Link]
Sorry, that was somewhat terse. The Novell Kernel Debugger has stack
unwinding features built-in; so this is something that might be leveraged
in another project.
Finding a profiler that works, damnit
Posted Apr 4, 2010 12:35 UTC (Sun) by chantecode (subscriber, #54535)
[Link]
We need to profile from NMI if we want to profile irqs as well. Otherwise a hardware pmu event would occur at the end of an irq disabled section, not at the exact place of the event, messing completely the result.
Finding a profiler that works, damnit
Posted Apr 5, 2010 1:37 UTC (Mon) by foom (subscriber, #14868)
[Link]
You need to get stack traces for the *kernel* from an NMI. Surely the userspace backtracing can
wait until a more convenient time...