• Chuck Lever's avatar
    xprtrdma: Delay DMA mapping Send and Receive buffers · 54cbd6b0
    Chuck Lever authored
    Currently, each regbuf is allocated and DMA mapped at the same time.
    This is done during transport creation.
    
    When a device driver is unloaded, every DMA-mapped buffer in use by
    a transport has to be unmapped, and then remapped to the new
    device if the driver is loaded again. Remapping will have to be done
    _after_ the connect worker has set up the new device.
    
    But there's an ordering problem:
    
    call_allocate, which invokes xprt_rdma_allocate which calls
    rpcrdma_alloc_regbuf to allocate Send buffers, happens _before_
    the connect worker can run to set up the new device.
    
    Instead, at transport creation, allocate each buffer, but leave it
    unmapped. Once the RPC carries these buffers into ->send_request, by
    which time a transport connection should have been established,
    check to see that the RPC's buffers have been DMA mapped. If not,
    map them there.
    
    When device driver unplug support is added, it will simply unmap all
    the transport's regbufs, but it doesn't have to deallocate the
    underlying memory.
    Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
    Signed-off-by: default avatarAnna Schumaker <Anna.Schumaker@Netapp.com>
    54cbd6b0
verbs.c 34.1 KB