Re: [Bug 1412] Copy from USB1 CF/SM reader stalls, no actual content is read (only directory structure)

From: Jens Axboe
Date: Fri Nov 07 2003 - 17:39:46 EST

On Fri, Nov 07 2003, Alan Stern wrote:
> On Fri, 7 Nov 2003, Jens Axboe wrote:
> > I've lost the original mail in the thread, but I'm quite sure it listed
> > sg[0].page as being valid. Maybe the driver cleared it somewhere too
> > early? page_address() will not have returned NULL for a valid page.
> > Unless it's a highmem page, in that case you have to map it and unmap
> > after use. For drivers like this that aren't performance critical and
> > are by no means highmem ready, it's easier just to set your dma mask low
> > enough that you wont be handed such pages.
> I think you may have put your finger on the problem. Our difficulty is
> that we have no control over where these sg pages are allocated; that
> depends on the capabilities of the USB host controller that our device
> happens to be plugged into. Probably all the spots in the usb-storage
> driver that directly access those sg pages will have to be rewritten to
> take into account that they may not be located in mapped memory.
> So I will need to learn the proper way of doing that. Is it as simple as
> calling page_address(), and if the result is 0 then calling kmap()
> followed by kunmap()?

Forget page_address(), you should never use it. _Always_ kmap the page
(or kmap_atomic() in irq context) and it will do the right thing

Jens Axboe

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at