Re: Patch to fix race between the NMI code and the CMOS clock

From: Corey Minyard
Date: Sun Jan 23 2005 - 10:50:20 EST


Andrew Morton wrote:

Corey Minyard <minyard@xxxxxxx> wrote:


This patch fixes a race between the CMOS clock setting and the NMI
code. The NMI code indiscriminatly sets index registers and values
in the same place the CMOS clock is set. If you are setting the
CMOS clock and an NMI occurs, Bad values could be written to or
read from the CMOS RAM, or the NMI operation might not occur
correctly.

Fixing this requires creating a special lock so the NMI code can
know its CPU owns the lock an "do the right thing" in that case.



hm, tricky patch. I can't see any holes in it. The volatile variable is
awkward but should be OK on x86 and I can see the need for it.


It took some thought and I couldn't think of anything simpler. I posted in on lkml a little while ago, and some people tried but nobody else found a simpler solution that worked with SMP.

There's a preposterous amount of inlining happening in this code. Hence
your patch took the size of drivers/char/rtc.o from

text data bss dec hex filename
3657 540 8 4205 106d drivers/char/rtc.o
to
5419 540 8 5967 174f drivers/char/rtc.o

Do you think you could take a look at uninlining everything sometime?


Certainly. I'll try to have it sometime today.

Thanks,

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