Re: Shared memory not SMP safe to user-mode code.

Alan Cox (alan@lxorguk.ukuu.org.uk)
Tue, 30 Nov 1999 20:40:06 +0000 (GMT)


> Currently, if you were to do the trivial:
>
> *ptr = shared_memory;
>
> while (!*ptr)
> ;
>
> This will loop forever, even when hardware writes non-zero to shared
> memory. This is because the CPU "knows" that it didn't write something

If *ptr is in PCI space it will be uncached, if it is in main memory it will
cause a cache line invalidation on the CPUs holding the line. Any CPU holding
the like in E or S state will go to I, a CPU holding the line in M state
may block the write and write its data from cache to main memory then go I
and allow the transaction to continue.

On non PC hardware things can of course be very different indeed.

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