Re: Race betwen the NMI handler and the RTC clock in practially allkernels II

From: Maciej W. Rozycki
Date: Mon Oct 25 2004 - 21:50:36 EST


On Mon, 25 Oct 2004, Corey Minyard wrote:

> If you look at my patch, it does create a shadow index.

I've noticed, yes. Actually yours is the right approach as we can't use
an arbitrary index in the NMI handler -- C register reads from the RTC
have a side effect of clearing pending interrupts.

> And you need a mutex for SMP systems. If one processor is handling an
> NMI, another processor may still be accessing the device.

Actually this path is meant to be ever accessed by one CPU only (one that
has its LINT1 line enabled), but it may be reached by other ones due to
the NMI watchdog as code does not check if its run by the right processor.
This probably qualifies as a bug. Only the watchdog code of the NMI
handler is expected to run everywhere.

> The complexity comes because the claiming of the lock, the CPU that owns
> the lock, and the index has to be atomic because the NMI handler has to
> know all these things when the lock is claimed.

If not the mentioned bug all the hassle wouldn't be needed.

Maciej
-
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/