[openib-general] High memory

Roland Dreier rolandd at cisco.com
Thu Nov 17 20:46:53 PST 2005


    Shuang> Hi, I am new here with some problem of gen2 programming,
    Shuang> hope somebody can help me. I was trying to send a message
    Shuang> from a kernel buffer to a remote userland program on IA-32
    Shuang> machines.  Basically, what happened was I used get_dma_mr
    Shuang> to get memory registered. And I noticed if a buffer is
    Shuang> allocated from high memory (address >f8000000), then the
    Shuang> data can not be delivered correctly to the receiver
    Shuang> side(both send recv completes successfully, but with wrong
    Shuang> data). I thought the problem could have been that I used
    Shuang> virt_to_phys for address translation. But I can't find any
    Shuang> appropriate ones for high memory address translation. I
    Shuang> wondering if somebody could give me some suggestions on
    Shuang> this.

Yes, virt_to_phys is essentially always wrong.

I'm not sure I really understand what you're doing.  By high memory do
you mean "highmem"?  If so your comment about address > f8000000
doesn't make sense to me -- the definition of highmem is that it does
not have any kernel mapping at all.

The right way to use the MR from get_dma_mr() is to use "bus
addresses" from the DMA mapping API.  For highmem, the right way to
get those addresses is with dma_map_sg() or dma_map_page().

 - R.



More information about the general mailing list