Re: PCI DMA to small buffers on cache-incoherent arch

From: Benjamin Herrenschmidt (benh@kernel.crashing.org)
Date: Sun Jun 09 2002 - 05:54:48 EST


>
>Now at this point the driver calls pci_unmap_single or whatever. What
>is pci_unmap_single to do? If it does nothing, or does a writeback,
>we lose the DMA data. If it does an invalidate we lose the value
>written to X. Clearly, neither is correct.
>
>The bottom line is that we can only have one writer to any given cache
>line at a time. If a buffer is being used for DMA from a device to
>memory, the cpu MUST NOT write to any cache line that overlaps the
>buffer.

Note that this typically happen with network drivers, some infos in
the skbuf getting lost when they happen to share a cache line with
the data portion of the skbuf. When writing a driver specific to a
non-coherent CPU, it can be worked around by reserving enough space,
but "generic" PCI drivers are still affected.

On those architectures, the core skbuf alloc routines should probably
make sure the data portion don't share a cache line with other
informations.

Ben.

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



This archive was generated by hypermail 2b29 : Sat Jun 15 2002 - 22:00:13 EST