Re: [PATCH 02/11] sky2: fix DMA sync_single length error

David Miller
2010-01-20T23:34:41Z

From: Jarek Poplawski <jarkao2@gmail.com>
Date: Thu, 21 Jan 2010 00:21:02 +0100

> "dma_sync_single_range(struct device *dev, dma_addr_t dma_handle,
> unsigned long offset, size_t size,
> enum dma_data_direction direction)
>
> Does a partial sync, starting at offset and continuing for size. You
> must be careful to observe the cache alignment and width when doing
> anything like this. You must also be extra careful about accessing
> memory you intend to sync partially." [Documentation/DMA-API.txt]
>
> looks like even if implemented might be very tricky, especially if
> untested.

This is an absurd set of requirements. What driver author is
going to get this right?

Any alignment issues are of the domain of the implementation and as
Alan said should be handled there.

Back to the main issue, these localized fixes in the driver leave all
of the other cases in the tree unhandled. There are likely to be
SCSI, USB host controller, SOUND, and other drivers with the same
issue.

At what point do we understand that peppering workarounds in the
drivers is the wrong way to go about this?

Whereas 1 patch in the 1 place in the DMA API implementation would fix
everything for everybody.

It's great that we had this report to track down the issue, now let's
fix it correctly so nobody else (regardless of device they have) has
to see it.