[openib-general] [PATCH v2 1/7] IB/core - Add DMA mapping functions to allow device drivers to interpose

Ralph Campbell ralph.campbell at qlogic.com
Mon Dec 4 11:17:24 PST 2006


On Sun, 2006-12-03 at 10:31 +0200, Or Gerlitz wrote:
> Ralph Campbell wrote:
> >> On 11/30/06, Ralph Campbell <ralph.campbell at qlogic.com> wrote:
> >>> On Thu, 2006-11-30 at 12:10 -0800, Roland Dreier wrote:
> 
> >>>> So what did you change since v1?  How do you deal with fitting 64-bit
> >>>> addresses into an sg list entry that has a 32-bit dma_addr_t?
> 
> > Although the driver compiles on 32-bit kernels, it is unsupported
> > and never been tested. All known 64-bit systems don't define
> > CONFIG_HIGHMEM.  In spite of previous emails suggesting that
> > page_address() can return NULL without CONFIG_HIGHMEM defined,
> > the code in include/linux/mm.h doesn't allow it (assuming the
> > page pointer is valid and not some random address).
> > I verified this with Andrew Morton.
> 
> Can you provide the quote from include/linux/mm.h of the code that 
> disallows it? looking there i don't see the enforcement.
> 
> mmm, your consulting with Andrew Morton was not over this thread... well
> Christoph Hellwig comment on the V1 thread tells a different story:
> 
> Only for GFP_KERNEL allocations you can assume page_address is valid, 
> and the scatterlist passed to a SCSI LLDD can contain any type of pages. 
>   Currently on all 64bit architectures page_address works on all pages, 
> but that's an implementation detail that could change any time and that 
> you should not rely on.
> 
> see http://www.mail-archive.com/openib-general@openib.org/msg27132.html
> 
> As i have mentioned in the past, this (no kvaddr for a page) comes into 
> play when a SCSI LLD (eg iSER, SRP) gets DIRECT I/O or AIO (SDP) pages 
> from user space.
> 
> Or.

I appreciate your pointing out the potential problems.  I agree that
future kernel changes could certainly break existing drivers.  That
happens frequently even when following the guarantees.

I still don't understand how a valid struct page * (regardless of
whether it is mapped into user space or not) can not have a valid
kernel address when CONFIG_HIGHMEM is not defined for the current
source base.  In include/linux/mm.h, page_address() is defined as
lowmem_page_address() which is defined as
	__va(page_to_pfn(page) << PAGE_SHIFT)
which can only fail if there isn't a valid PFN for the page.
I don't see how that can happen.

If I am wrong, I would like to understand why.

If you have suggestions for fixing these issues,
please let me know.





More information about the general mailing list