Re: [PATCH 1/3] perf_event: fix race inperf_swevent_get_recursion_context()

From: Peter Zijlstra
Date: Tue Jan 19 2010 - 03:46:37 EST


On Tue, 2010-01-19 at 09:19 +0800, Xiao Guangrong wrote:
>
>
> It's because hard-irq(we can handle interruption with interruption enabled)
> and NMI are nested, for example:
>
> int perf_swevent_get_recursion_context(void)
> {
> ......
> if (cpuctx->recursion[rctx]) {
> put_cpu_var(perf_cpu_context);
> return -1;
> }
>
> /*
> * Another interruption handler/NMI will re-enter there if it
> * happed, it make the recursion value chaotic
> */
> cpuctx->recursion[rctx]++;
> ......
> }

This doesn't make any sense at all, if IRQs are nested (bad bad bad)
then it will still end up with the same recursion context and detect
that recursion and bail on the nested one. So what's the problem?

NMIs are not allowed to nest, ever.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/