[lkml]   [2008]   [Nov]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [patch 05/24] perfmon: X86 generic code (x86)
On Thu, Nov 27, 2008 at 12:31 PM, Andi Kleen <> wrote:
>> The only reason why I have to deal with NMI is not so much to allow
>> for profiling irq-off regions but because I have to share the PMU with
>> the NMI watchdog. Otherwise I'd have to fail or disable the NMI watchdog
>> on the fly.
> The NMI watchdog is now off by default so failing with it enabled
> is fine.

Yes, but most likely it is on in distro kernels.

> Longer term having NMI profiling is still a useful feature I think,
> but of course it needs to be implemented cleanly.

The difficulty with NMI is locking. Unlike Oprofile, perfmon code needs
locking. If you recall our discussion yesterday about passing the file
around or even using it with multiple threads inside the same process.
You have to handle the case where the NMI fires while you are holding
a perfmon lock. What you have in the patch (and the the fully-featured version)
is that we get the NMI and we stop the PMU WITHOUT grabbing any perfmon
lock, and the we repost the interrupt with the regular vector. We also make sure
we grab the RIP at NMI. That is the one we want to see reported in the sampling

I am still wondering how Oprofile handles the case where multiple processes or
threads access the same file descriptor.

 \ /
  Last update: 2008-11-27 12:39    [W:0.069 / U:0.552 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site