* [dpdk-dev] [PATCH] net/mlx5: fix incorrect r/w lock usage in DMA unmap
@ 2021-05-27 9:48 Feifei Wang
2021-06-22 1:54 ` [dpdk-dev] 回复: " Feifei Wang
2021-07-06 9:34 ` [dpdk-dev] " Raslan Darawsheh
0 siblings, 2 replies; 5+ messages in thread
From: Feifei Wang @ 2021-05-27 9:48 UTC (permalink / raw)
To: Matan Azrad, Shahaf Shuler, Viacheslav Ovsiienko
Cc: dev, nd, Feifei Wang, shahafs, stable, Ruifeng Wang
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@mellanox.com
Cc: stable@dpdk.org
Signed-off-by: Feifei Wang <feifei.wang2@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@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
^ permalink raw reply [flat|nested] 5+ messages in thread
* [dpdk-dev] 回复: [PATCH] net/mlx5: fix incorrect r/w lock usage in DMA unmap
2021-05-27 9:48 [dpdk-dev] [PATCH] net/mlx5: fix incorrect r/w lock usage in DMA unmap Feifei Wang
@ 2021-06-22 1:54 ` Feifei Wang
2021-07-01 14:26 ` [dpdk-dev] " Slava Ovsiienko
2021-07-06 9:34 ` [dpdk-dev] " Raslan Darawsheh
1 sibling, 1 reply; 5+ messages in thread
From: Feifei Wang @ 2021-06-22 1:54 UTC (permalink / raw)
To: Feifei Wang, Matan Azrad, Shahaf Shuler, Viacheslav Ovsiienko
Cc: dev, nd, shahafs, stable, Ruifeng Wang, nd
Hi, Slava
Would you please help review this patch?
Thanks.
Best Regards
Feifei
> -----邮件原件-----
> 发件人: Feifei Wang <feifei.wang2@arm.com>
> 发送时间: 2021年5月27日 17:48
> 收件人: Matan Azrad <matan@nvidia.com>; Shahaf Shuler
> <shahafs@nvidia.com>; Viacheslav Ovsiienko <viacheslavo@nvidia.com>
> 抄送: dev@dpdk.org; nd <nd@arm.com>; Feifei Wang
> <Feifei.Wang2@arm.com>; shahafs@mellanox.com; stable@dpdk.org;
> Ruifeng Wang <Ruifeng.Wang@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@mellanox.com
> Cc: stable@dpdk.org
>
> Signed-off-by: Feifei Wang <feifei.wang2@arm.com>
> Reviewed-by: Ruifeng Wang <ruifeng.wang@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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dpdk-dev] [PATCH] net/mlx5: fix incorrect r/w lock usage in DMA unmap
2021-06-22 1:54 ` [dpdk-dev] 回复: " Feifei Wang
@ 2021-07-01 14:26 ` Slava Ovsiienko
2021-07-02 1:02 ` [dpdk-dev] 回复: " Feifei Wang
0 siblings, 1 reply; 5+ messages in thread
From: Slava Ovsiienko @ 2021-07-01 14:26 UTC (permalink / raw)
To: Feifei Wang, Matan Azrad, Shahaf Shuler
Cc: dev, nd, Shahaf Shuler, stable, Ruifeng Wang, nd
Hi, Feifei
Sorry for the delayed review.
I think it is a good catch, thank you for the patch.
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
With best regards,
Slava
> -----Original Message-----
> From: Feifei Wang <Feifei.Wang2@arm.com>
> Sent: Tuesday, June 22, 2021 4:54
> To: Feifei Wang <Feifei.Wang2@arm.com>; Matan Azrad
> <matan@nvidia.com>; Shahaf Shuler <shahafs@nvidia.com>; Slava Ovsiienko
> <viacheslavo@nvidia.com>
> Cc: dev@dpdk.org; nd <nd@arm.com>; Shahaf Shuler <shahafs@nvidia.com>;
> stable@dpdk.org; Ruifeng Wang <Ruifeng.Wang@arm.com>; nd
> <nd@arm.com>
> Subject: 回复: [PATCH] net/mlx5: fix incorrect r/w lock usage in DMA unmap
>
> Hi, Slava
>
> Would you please help review this patch?
> Thanks.
>
> Best Regards
> Feifei
>
> > -----邮件原件-----
> > 发件人: Feifei Wang <feifei.wang2@arm.com>
> > 发送时间: 2021年5月27日 17:48
> > 收件人: Matan Azrad <matan@nvidia.com>; Shahaf Shuler
> > <shahafs@nvidia.com>; Viacheslav Ovsiienko <viacheslavo@nvidia.com>
> > 抄送: dev@dpdk.org; nd <nd@arm.com>; Feifei Wang
> <Feifei.Wang2@arm.com>;
> > shahafs@mellanox.com; stable@dpdk.org; Ruifeng Wang
> > <Ruifeng.Wang@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@mellanox.com
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Feifei Wang <feifei.wang2@arm.com>
> > Reviewed-by: Ruifeng Wang <ruifeng.wang@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
^ permalink raw reply [flat|nested] 5+ messages in thread
* [dpdk-dev] 回复: [PATCH] net/mlx5: fix incorrect r/w lock usage in DMA unmap
2021-07-01 14:26 ` [dpdk-dev] " Slava Ovsiienko
@ 2021-07-02 1:02 ` Feifei Wang
0 siblings, 0 replies; 5+ messages in thread
From: Feifei Wang @ 2021-07-02 1:02 UTC (permalink / raw)
To: Slava Ovsiienko, Matan Azrad, Shahaf Shuler
Cc: dev, nd, Shahaf Shuler, stable, Ruifeng Wang, nd, nd
Hi, Slava
That's OK. Thanks for your reviewing.
Best Regards
Feifei
> -----邮件原件-----
> 发件人: Slava Ovsiienko <viacheslavo@nvidia.com>
> 发送时间: 2021年7月1日 22:27
> 收件人: Feifei Wang <Feifei.Wang2@arm.com>; Matan Azrad
> <matan@nvidia.com>; Shahaf Shuler <shahafs@nvidia.com>
> 抄送: dev@dpdk.org; nd <nd@arm.com>; Shahaf Shuler
> <shahafs@nvidia.com>; stable@dpdk.org; Ruifeng Wang
> <Ruifeng.Wang@arm.com>; nd <nd@arm.com>
> 主题: RE: [PATCH] net/mlx5: fix incorrect r/w lock usage in DMA unmap
>
> Hi, Feifei
>
> Sorry for the delayed review.
> I think it is a good catch, thank you for the patch.
>
> Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
>
> With best regards,
> Slava
>
> > -----Original Message-----
> > From: Feifei Wang <Feifei.Wang2@arm.com>
> > Sent: Tuesday, June 22, 2021 4:54
> > To: Feifei Wang <Feifei.Wang2@arm.com>; Matan Azrad
> > <matan@nvidia.com>; Shahaf Shuler <shahafs@nvidia.com>; Slava
> > Ovsiienko <viacheslavo@nvidia.com>
> > Cc: dev@dpdk.org; nd <nd@arm.com>; Shahaf Shuler
> <shahafs@nvidia.com>;
> > stable@dpdk.org; Ruifeng Wang <Ruifeng.Wang@arm.com>; nd
> <nd@arm.com>
> > Subject: 回复: [PATCH] net/mlx5: fix incorrect r/w lock usage in DMA
> > unmap
> >
> > Hi, Slava
> >
> > Would you please help review this patch?
> > Thanks.
> >
> > Best Regards
> > Feifei
> >
> > > -----邮件原件-----
> > > 发件人: Feifei Wang <feifei.wang2@arm.com>
> > > 发送时间: 2021年5月27日 17:48
> > > 收件人: Matan Azrad <matan@nvidia.com>; Shahaf Shuler
> > > <shahafs@nvidia.com>; Viacheslav Ovsiienko <viacheslavo@nvidia.com>
> > > 抄送: dev@dpdk.org; nd <nd@arm.com>; Feifei Wang
> > <Feifei.Wang2@arm.com>;
> > > shahafs@mellanox.com; stable@dpdk.org; Ruifeng Wang
> > > <Ruifeng.Wang@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@mellanox.com
> > > Cc: stable@dpdk.org
> > >
> > > Signed-off-by: Feifei Wang <feifei.wang2@arm.com>
> > > Reviewed-by: Ruifeng Wang <ruifeng.wang@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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dpdk-dev] [PATCH] net/mlx5: fix incorrect r/w lock usage in DMA unmap
2021-05-27 9:48 [dpdk-dev] [PATCH] net/mlx5: fix incorrect r/w lock usage in DMA unmap Feifei Wang
2021-06-22 1:54 ` [dpdk-dev] 回复: " Feifei Wang
@ 2021-07-06 9:34 ` Raslan Darawsheh
1 sibling, 0 replies; 5+ messages in thread
From: Raslan Darawsheh @ 2021-07-06 9:34 UTC (permalink / raw)
To: Feifei Wang, Matan Azrad, Shahaf Shuler, Slava Ovsiienko
Cc: dev, nd, Shahaf Shuler, stable, Ruifeng Wang
Hi,
> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Feifei Wang
> Sent: Thursday, May 27, 2021 12:48 PM
> To: Matan Azrad <matan@nvidia.com>; Shahaf Shuler
> <shahafs@nvidia.com>; Slava Ovsiienko <viacheslavo@nvidia.com>
> Cc: dev@dpdk.org; nd@arm.com; Feifei Wang <feifei.wang2@arm.com>;
> Shahaf Shuler <shahafs@nvidia.com>; stable@dpdk.org; Ruifeng Wang
> <ruifeng.wang@arm.com>
> Subject: [dpdk-dev] [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@mellanox.com
> Cc: stable@dpdk.org
>
> Signed-off-by: Feifei Wang <feifei.wang2@arm.com>
> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Patch rebased and applied to next-net-mlx,
Kindest regards,
Raslan Darawsheh
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-07-06 9:34 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-27 9:48 [dpdk-dev] [PATCH] net/mlx5: fix incorrect r/w lock usage in DMA unmap Feifei Wang
2021-06-22 1:54 ` [dpdk-dev] 回复: " Feifei Wang
2021-07-01 14:26 ` [dpdk-dev] " Slava Ovsiienko
2021-07-02 1:02 ` [dpdk-dev] 回复: " Feifei Wang
2021-07-06 9:34 ` [dpdk-dev] " Raslan Darawsheh
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).