Re: Deprecate pci_dma_sync_{single,sg}()?

David S. Miller (davem@redhat.com)
Wed, 05 Jun 2002 16:02:01 -0700 (PDT)


From: Pete Zaitcev <zaitcev@redhat.com>
Date: Wed, 5 Jun 2002 17:56:29 -0400

>[...]
> In the current linux-mips implementation, this has some subtle problems:
> pci_unmap_{single,sg}() is essentially a no-op. Thus, in the above
> example, a driver would break (stale cachelines from a previous
> pci_dma_sync_*/read would not be invalidated). One might argue that a
> cache invalidate should happen in the pci_unmap_single(). But then the
> other case (where a driver does a pci_map, DMAs, does a pci_unmap, and
> sends it up the stack) would require an additional cache
> flush/invalidate that is not needed at all.

Frist, fix mips, it is broken.

No, MIPS is not broken. If there is no intervening call into
the PCI DMA layer between the read of the data and giving
the buffer back to the device, it has no reason to flush.

It flushes when it should, at pci_map_single() time for
PCI_DMA_FROM_DEVICE direction.

This provides the behavior exactly as inteded by the API.
It is precisely the optimization non-cache-coherent cpu
systems are expected to do for best performance.
-
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/