• Moni Shoua's avatar
    IB/mlx5: Protect against prefetch of invalid MR · a6bc3875
    Moni Shoua authored
    When deferring a prefetch request we need to protect against MR or PD
    being destroyed while the request is still enqueued.
    
    The first step is to validate that PD owns the lkey that describes the MR
    and that the MR that the lkey refers to is owned by that PD.
    
    The second step is to dequeue all requests when MR is destroyed.
    
    Since PD can't be destroyed while it owns MRs it is guaranteed that when a
    worker wakes up the request it refers to is still valid.
    
    Now, it is possible to refrain from taking a reference on the device since
    it is assured to be present as pd.
    
    While that, replace the dedicated ordered workqueue with the system
    unbound workqueue to reuse an existing resource and improve
    performance. This will also fix a bug of queueing to the wrong workqueue.
    
    Fixes: 813e90b1 ("IB/mlx5: Add advise_mr() support")
    Reported-by: default avatarParav Pandit <parav@mellanox.com>
    Signed-off-by: default avatarMoni Shoua <monis@mellanox.com>
    Signed-off-by: default avatarLeon Romanovsky <leonro@mellanox.com>
    Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
    a6bc3875
mlx5_ib.h 40.6 KB