Re: [BUG] x86_64 pci_map_sg modifies sg list - fails multiple map/unmaps

David S. Miller
2004-01-05T20:41:13Z

On Mon, 05 Jan 2004 20:47:19 +0100
Andi Kleen <ak@muc.de> wrote:

> Actually I disabled merging by default in the latest x86-64 code,
> but it can be still enabled by the user using options (it makes some
> adapters run several percent faster). I would appreciate if you could
> fix the problem anyways.
>
> I was actually planning to add a BUG() for this. Should do that.
> There is already one that triggers often when the problem occurs.

Andi, you must not modify sg->length in any way shape or form.

The following is legal:

pci_map_sg(..&sg);
pci_unmap_sg(...&sg);
pci_map_sg(..&sg);

If you must modify the length field for DMA, you must have a seperate
dma_length member of the scatterlist structure on your platform, see what
sparc64 does here.

If the documentation states this wrongly, it's a doc bug.