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

Jarek Poplawski
2010-01-20T23:52:51Z

On Wed, Jan 20, 2010 at 03:34:51PM -0800, David Miller wrote:
> 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?

*Temporary* only workarounds. Mainly simple cases. (e.g. I'm not sure
of tg3)

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

1) As I mentioned earlier there were similar dmar errors reported with
real oopses, but of course it might be unconnected. (But why risk...)

2) Why would the author of this doc above warn us so much if it were
so obviously simple and safe?

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

I hope you're right as usual! (But I disagree as usual ;-)

Jarek P.