Re: [patch] SMP alternatives
From: Alan Cox
Date: Wed Nov 23 2005 - 16:28:09 EST
On Mer, 2005-11-23 at 17:59 +0100, Andi Kleen wrote:
> You mean it might break an insane hack in someone's ECC scrubbing
> implementation. But last time I talked to people about this
> they suggested just using an uncacheable mapping instead of
> this horrible thing. Uncached is actually what you want there,
> not relying on some undocumented lock bus cycle behaviour.
I reviewed your suggestions before:
1. The lock behaviour *is* defined for main memory access by all bus
2. Uncached mappings are unworkable for this because we must never have
a page mapped with conflicting cache types - thats ugly, and plain
horrific on SMP.
3. Uncached has undefined semantics when racing a PCI master. Lock has
defined semantics. An uncached add #0 is permitted to read the memory
and then write it back as two different cycles and I suspect does.
4. The AMD BIOS guide requires both that LOCK is enabled by default and
that the "lock affects the external bus" bit is clear to enable locking
on the external bus.
The problems we would have would be if some smartarse chip designed
optimised lock addl #0 to a no-op and the fact we possibly ought to
wbinvd the page and read it again to check the ECC recovery worked.
> Which drivers? I don't think there is anything in tree. I went
> over all the drivers early in the x86-64 port.
eepro100 used to from memory but it now carefully does a 16bit I/O.
> I'm sure I would have noticed because they very likely needed inline
> assembly for this and this generally broke when moving to x86-64.
Or use xchg() which is implied lock on x86 so isn't magically made
non-atomic by the LOCK macros. I did a sweep for xchg and didn't see any
> DRM did some tricks, but generally not with the hardware I believe,
> only between user/kernel space.
It does it extensively for user/kernel. Whether it does it with the GPU
in user space I can't say. The cards I am familar with do not.
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/