Re: LOCK prefix on uni processor has its use (was Re: [BUG FIX] Makex86_32 uni-processor Atomic ops, Atomic)
From: H. Peter Anvin
Date: Wed May 27 2009 - 23:09:28 EST
Harald Welte wrote:
> * A read-modify-write sequence cannot be interupted.
> * All X86 instructions except rep-strings are atomic wrt interrupts.
> * The lock prefix has uses on a UP processor: It keeps DMA devices from
> interfering with a read-modify-write sequence
Correct.
> Now the question is: Is this a valid operation of a driver? Should the driver
> do such things, or is such a driver broken? When would that occur? I'm trying
> to come up with a case, but typically you e.g. allocate some DMA buffer and
> then don't touch it until the hardware has processed it.
The Linux driver model does not permit this as a *lot* of hardware
doesn't support this correctly, and even on x86 there are lots of
chipset bugs in this regard. It is of course possible to write x86-only
drivers that would do this anyway, but those should not use LOCK_PREFIX
instructions.
-hpa
--
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel. I don't speak on their behalf.
--
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/