Re: [PATCH] perfcounters: fix "perf counters kills oprofile" bug

From: Ingo Molnar
Date: Thu Feb 05 2009 - 09:26:35 EST



* Mike Galbraith <efault@xxxxxx> wrote:

> Impact: fix "perf counters kills oprofile" bug
>
> Both oprofile and perfcounters register an NMI die handler, but only one
> can handle the NMI. Conveniently, oprofile unregisters it's notifier
> when not actively in use, so setting it's notifier priority higher than
> perfcounter's allows oprofile to borrow the NMI for the duration of it's
> run. Tested/works both as module and built-in.
>
> While testing, I found that if kerneltop was generating NMIs at very
> high frequency, the kernel may panic when oprofile registered it's
> handler. This turned out to be because oprofile registers it's handler
> before reset_value has been allocated, so if an NMI comes in while it's
> still setting up, kabOom. Rather than try more invasive changes, I
> followed the lead of other places in op_model_ppro.c, and simply
> returned in that highly unlikely event. (debug warnings attached)

applied to tip:perfcounters/core, thanks Mike!

> I can break this into two patches if you prefer, but since the panic was
> initiated by borrowing the active NMI, I figured they belong together.

No need, it's fine this way. Note that there's two commits from you: i
applied your earier fix of this already, and now i did a delta patch of the
other bug you found. The delta patch i have applied is below.

Thanks,

Ingo

--------------------->