patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Feifei Wang <feifei.wang2@arm.com>
To: Matan Azrad <matan@nvidia.com>,
	Shahaf Shuler <shahafs@nvidia.com>,
	Viacheslav Ovsiienko <viacheslavo@nvidia.com>
Cc: dev@dpdk.org, nd@arm.com, Feifei Wang <feifei.wang2@arm.com>,
	shahafs@mellanox.com, stable@dpdk.org,
	Ruifeng Wang <ruifeng.wang@arm.com>
Subject: [dpdk-stable] [PATCH] net/mlx5: fix incorrect r/w lock usage in DMA unmap
Date: Thu, 27 May 2021 17:48:06 +0800
Message-ID: <20210527094806.1383353-1-feifei.wang2@arm.com> (raw)

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


             reply	other threads:[~2021-05-27  9:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-27  9:48 Feifei Wang [this message]
2021-06-22  1:54 ` [dpdk-stable] 回复: " Feifei Wang
2021-07-01 14:26   ` [dpdk-stable] " Slava Ovsiienko
2021-07-02  1:02     ` [dpdk-stable] 回复: " Feifei Wang
2021-07-06  9:34 ` [dpdk-stable] [dpdk-dev] " Raslan Darawsheh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210527094806.1383353-1-feifei.wang2@arm.com \
    --to=feifei.wang2@arm.com \
    --cc=dev@dpdk.org \
    --cc=matan@nvidia.com \
    --cc=nd@arm.com \
    --cc=ruifeng.wang@arm.com \
    --cc=shahafs@mellanox.com \
    --cc=shahafs@nvidia.com \
    --cc=stable@dpdk.org \
    --cc=viacheslavo@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

patches for DPDK stable branches

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/stable/0 stable/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 stable stable/ https://inbox.dpdk.org/stable \
		stable@dpdk.org
	public-inbox-index stable

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.stable


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git