Re: [PATCH] x86: fix duplicate calls of the nmi handler

From: Stephane Eranian
Date: Thu Sep 16 2010 - 16:18:48 EST


On Thu, Sep 16, 2010 at 7:42 PM, Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
> On Fri, 2010-09-10 at 17:56 +0200, Robert Richter wrote:
>> The commit:
>>
>> Âe40b172 x86: Move notify_die from nmi.c to traps.c
>>
>> moved the nmi handler call to default_do_nmi(). DIE_NMI_IPI and
>> DIE_NMI are called subsequently now. If the return code is
>> !NOTIFY_STOP, then the handlers are called twice. This patch fixes
>> this.
>
> What is this NMI_IPI thing, and why do we bother?
>
I think you only need to be on one of the callchains and most likely
the higher priority one. That's beauce you're using NMI for performance
monitoring and not debugging. Thus you expect a high rate of calls and
you don't want to be calling a bunch of other handlers for nothing.

The way the code is laid out in default_do_nmi() means that NMI_IPI
has higher priority over NMI. NMI also depends on X86_LOCAL_APIC,
but without it no PMU interrupts anyway.

The other thing to notice is that default_do_nmi() is the only place for
invoking NMI_IPI. I don't see the point of it vs. NMI (except APIC vs. no APIC).

Why not just have one level, NMI, and use the priority field to position
handlers correctly?

> If the hardware reason thin can discriminate between IPI and other NMIs
> we should never call both chains, if it cannot, why do we have 2 chains?
>
> In any case, I don't think perf/oprofile/etc,. should use NMI_IPI, that
> doesn't really make sense.
>
> Or am I totally confused about things here?
>
--
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/