[3/7] net/hns3: fix pseudo-sharing between threads

Message ID 20220406092240.52900-4-humin29@huawei.com (mailing list archive)
State Superseded, archived
Delegated to: Ferruh Yigit
Headers
Series bugfix for hns3 PMD |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

humin (Q) April 6, 2022, 9:22 a.m. UTC
  From: Huisong Li <lihuisong@huawei.com>

Some fields in the end of 'struct hns3_rx_queue' and 'struct hns3_tx_queue'
are not accessed in the I/O path. But these fields may be accessed in other
threads, which may lead to the problem of pseudo-sharing of IO threads.
This patch add a cacheline alignment to avoid it.

Fixes: 9261fd3caf1f ("net/hns3: improve IO path data cache usage")
Cc: stable@dpdk.org

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
---
 drivers/net/hns3/hns3_rxtx.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
  

Comments

Ferruh Yigit May 3, 2022, 7:05 p.m. UTC | #1
On 4/6/2022 10:22 AM, Min Hu (Connor) wrote:
> From: Huisong Li <lihuisong@huawei.com>
> 
> Some fields in the end of 'struct hns3_rx_queue' and 'struct hns3_tx_queue'
> are not accessed in the I/O path. But these fields may be accessed in other
> threads, which may lead to the problem of pseudo-sharing of IO threads.

... problem of cache pseudo-sharing ...

> This patch add a cacheline alignment to avoid it.
> 
> Fixes: 9261fd3caf1f ("net/hns3: improve IO path data cache usage")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Huisong Li <lihuisong@huawei.com>
> Signed-off-by: Min Hu (Connor) <humin29@huawei.com>

<...>
  

Patch

diff --git a/drivers/net/hns3/hns3_rxtx.h b/drivers/net/hns3/hns3_rxtx.h
index a000318357..62efc854e4 100644
--- a/drivers/net/hns3/hns3_rxtx.h
+++ b/drivers/net/hns3/hns3_rxtx.h
@@ -348,7 +348,7 @@  struct hns3_rx_queue {
 	 * The following fields are not accessed in the I/O path, so they are
 	 * placed at the end.
 	 */
-	void *io_base;
+	void *io_base __rte_cache_aligned;
 	struct hns3_adapter *hns;
 	uint64_t rx_ring_phys_addr; /* RX ring DMA address */
 	const struct rte_memzone *mz;
@@ -521,7 +521,7 @@  struct hns3_tx_queue {
 	 * The following fields are not accessed in the I/O path, so they are
 	 * placed at the end.
 	 */
-	void *io_base;
+	void *io_base __rte_cache_aligned;
 	struct hns3_adapter *hns;
 	uint64_t tx_ring_phys_addr; /* TX ring DMA address */
 	const struct rte_memzone *mz;