Re: [PATCH] 2.4.1-ac1 UP-APIC/NMI watchdog fixes

From: Mikael Pettersson (
Date: Fri Feb 02 2001 - 11:28:26 EST

Maciej W. Rozycki writes:
> I've forgotten to cc you when sending Ingo my patch-2.4.0-ac12-upapic-19
> fixes a few days ago, my apologies. Since the two patches conflict with
> each other, I've merged them together and provide the result below.
> Please check if it is fine for you.

Looks fine to me.

> I'm unsure about the K7_NMI_EVENT macro -- I think it should go into
> include/asm-i386/msr.h, but the comment should remain here. It should get
> reworded a bit in this case, I suppose, though.

I'd prefer to keep it in nmi.c -- it doesn't really have any relevance
elsewhere. I made a macro of it so that I wouldn't need any #ifdef:s
or long explanations in the code proper.

There is one thing which bothers me. Look at the end of the NMI handler:

> + if (cpu_has_apic && (nmi_watchdog == NMI_LOCAL_APIC))
> + wrmsr(nmi_perfctr_msr, -(cpu_khz/HZ*1000), -1);

This becomes a series of loads and tests. Ideally, a _single_ test should suffice
to inform the NMI handler whether we're in NMI_LOCAL_APIC mode or not. One problem
is that we aren't resetting nmi_watchdog to NMI_NONE if we fail to detect or
initialise the local APIC; if we did, we could kill the cpu_has_apic test.

... however, nmi_perfctr_msr could serve this purpose since it will be
non-zero if and only if (cpu_has_apic && nmi_watchdog == NMI_LOCAL_APIC).
So I would actually suggest something like:

        if (nmi_perfctr_msr)
                wrmsr(nmi_perfctr_msr, -(cpu_khz/HZ*1000), -1);

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
Please read the FAQ at

This archive was generated by hypermail 2b29 : Wed Feb 07 2001 - 21:00:15 EST