Re: [PATCH] Define wc_wmb, a write barrier for PCI write combining

From: Bryan O'Sullivan
Date: Wed Mar 01 2006 - 14:40:49 EST


On Wed, 2006-03-01 at 20:27 +0100, Andi Kleen wrote:

> I don't interpret it as being a full synchronous write.

Nor do I. We don't expect or need the write to make it all the way to
the device. We already do config space reads for the tiny handful of
non-performance-critical cases where we need to know that a write has in
fact made it to the device.

> It's just a barrier
> preventing reordering. So the writes before could be in theory stuck
> forever in some buffer - it just means they won't be later than the writes
> after the fence.

At worst, they'll be off the CPU (guaranteed per spec, as I already
quoted for you), and on the northbridge. It might hold on to them for a
bit in turn, but there's nothing we can do about that except a config
space read, and we don't need to guarantee that the write has completely
gone to the device. Real northbridges just don't buffer writes for very
long.

> Implementing the fences in the way your're suggesting would be very costly
> because it could make them potentially stall for thousands of cycles.

But it *doesn't*. On existing CPUs and systems, today, the phantom
worse-case semantics you are conjuring up simply do not exist. If
someone builds such an asinine system, the right approach is to handle
it once it exists.

<b

--
Bryan O'Sullivan <bos@xxxxxxxxxxxxx>

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