Re: [PATCH rdma-next 1/4] IB/core: Improve ODP to use hmm_range_fault()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 9/16/2020 8:21 PM, Jason Gunthorpe wrote:
On Wed, Sep 16, 2020 at 05:45:16PM +0100, Christoph Hellwig wrote:
Note that 0 is a valid DMA address.  I think due the access bit this
works, but it is a little subtle..
It should be checked again carefully.. This looks a bit questionable
if the flags are what makes it work:

+               dma_addr = dma & ODP_DMA_ADDR_MASK;
+               if (dma_addr) {

I have changed the check to be on dma, the masking to get the dma_address will be just later on so this should be fine even for potential valid NULL dma address.
Will be part of V1.

But more importantly except for (dma_addr_t)-1 (DMA_MAPPING_ERROR)
all dma_addr_t values are valid, so taking more than a single bit
from a dma_addr_t is not strictly speaking correct.
This is the result of dma_map_page(). The HW requires that
dma_map_page(page_size) returns a DMA address that is page_size
aligned, even for huge pages.

So at least the last 12 bits of the DMA address are always 0, they can
be used for flags. This is also the HW representation in the page
table.

Last time you pointed at this code you agreed this alignment was met,
is it still OK?

Jason

Yes, this was confirmed by Christoph in next mail.

Thanks,
Yishai




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux