[dpdk-stable] 回复: [PATCH] net/mlx5: fix incorrect r/w lock usage in DMA unmap

Feifei Wang Feifei.Wang2 at arm.com
Tue Jun 22 03:54:17 CEST 2021


Hi, Slava

Would you please help review this patch?
Thanks.

Best Regards
Feifei

> -----邮件原件-----
> 发件人: Feifei Wang <feifei.wang2 at arm.com>
> 发送时间: 2021年5月27日 17:48
> 收件人: Matan Azrad <matan at nvidia.com>; Shahaf Shuler
> <shahafs at nvidia.com>; Viacheslav Ovsiienko <viacheslavo at nvidia.com>
> 抄送: dev at dpdk.org; nd <nd at arm.com>; Feifei Wang
> <Feifei.Wang2 at arm.com>; shahafs at mellanox.com; stable at dpdk.org;
> Ruifeng Wang <Ruifeng.Wang at arm.com>
> 主题: [PATCH] net/mlx5: fix incorrect r/w lock usage in DMA unmap
> 
> For mlx5 DMA unmap, write lock should be used for rebuilding memory
> region cache table rather than read lock.
> 
> Fixes: 989e999d9305 ("net/mlx5: support PCI device DMA map and unmap")
> Cc: shahafs at mellanox.com
> Cc: stable at dpdk.org
> 
> Signed-off-by: Feifei Wang <feifei.wang2 at arm.com>
> Reviewed-by: Ruifeng Wang <ruifeng.wang at arm.com>
> ---
>  drivers/net/mlx5/mlx5_mr.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/mlx5/mlx5_mr.c b/drivers/net/mlx5/mlx5_mr.c index
> e791b6338d..45a122f4f9 100644
> --- a/drivers/net/mlx5/mlx5_mr.c
> +++ b/drivers/net/mlx5/mlx5_mr.c
> @@ -395,10 +395,10 @@ mlx5_dma_unmap(struct rte_pci_device *pdev,
> void *addr,
>  	}
>  	priv = dev->data->dev_private;
>  	sh = priv->sh;
> -	rte_rwlock_read_lock(&sh->share_cache.rwlock);
> +	rte_rwlock_write_lock(&sh->share_cache.rwlock);
>  	mr = mlx5_mr_lookup_list(&sh->share_cache, &entry,
> (uintptr_t)addr);
>  	if (!mr) {
> -		rte_rwlock_read_unlock(&sh->share_cache.rwlock);
> +		rte_rwlock_write_unlock(&sh->share_cache.rwlock);
>  		DRV_LOG(WARNING, "address 0x%" PRIxPTR " wasn't
> registered "
>  				 "to PCI device %p", (uintptr_t)addr,
>  				 (void *)pdev);
> @@ -423,7 +423,7 @@ mlx5_dma_unmap(struct rte_pci_device *pdev, void
> *addr,
>  	DRV_LOG(DEBUG, "broadcasting local cache flush, gen=%d",
>  	      sh->share_cache.dev_gen);
>  	rte_smp_wmb();
> -	rte_rwlock_read_unlock(&sh->share_cache.rwlock);
> +	rte_rwlock_write_unlock(&sh->share_cache.rwlock);
>  	return 0;
>  }
> 
> --
> 2.25.1



More information about the stable mailing list