Re: (*(unsigned long *)&jiffies)++;

Stephen Satchell (satch@concentric.net)
Fri, 07 Jan 2000 10:29:19 -0800


At 12:46 AM 1/7/00 , you wrote:
>AFAIK incl _lock_ the bus even without "lock" in fornt of the
>instruction
>on 386 machine. Or at least i386 instruction set manual say so.
>But there is no word about all this in the newest manual i got from
>Intel.
>Is this changed on i[56]86?

It isn't that the bus is locked (assert the LOCK# pin on the chip) during
the "inc" instruction but that the instruction can't be interrupted by the
CPU once the memory operand is fetched (except for write fault, which makes
sense). The LOCK prefix asserts a hardware line to tell all the other
processors to stay the hell off the bus while the CPU does its thing.

This dates back to the original 8086.

To the topic at hand. This blocks multiple WRITERS of a memory area. It
also permits sequencing of READERS and WRITERS if sequencing is
important. From my understanding of this thread, there is exactly one
WRITER of the variable "jiffies", and sequencing isn't important because if
two CPUs are racing the LOCK prefix isn't going to fix the problems that
two or more CPUs can run into if the timer changes value in the middle of
certain routines.

(Want to avoid problems? Don't allow the setup of any delay of less than
two clock ticks from "now".)

Stephen Satchell

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