patch 'raw/ntb: fix peer device status access' has been queued to stable release 24.11.9
luca.boccassi at gmail.com
luca.boccassi at gmail.com
Mon Nov 16 23:52:26 CET 2026
Hi,
FYI, your patch has been queued to stable release 24.11.9
Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 11/18/26. So please
shout if anyone has objections.
Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.
Queued patches are on a temporary branch at:
https://github.com/bluca/dpdk-stable
This queued commit can be viewed at:
https://github.com/bluca/dpdk-stable/commit/dde39f2654c64d2b72b4628726932ce1e5e72c2e
Thanks.
Luca Boccassi
---
>From dde39f2654c64d2b72b4628726932ce1e5e72c2e Mon Sep 17 00:00:00 2001
From: Raghavendra Ningoji <raghavendra.ningoji at amd.com>
Date: Wed, 11 Nov 2026 12:36:48 +0530
Subject: [PATCH] raw/ntb: fix peer device status access
[ upstream commit 6df69aaf98d0f3032dc3356974f38a34a6a91a3e ]
The peer device status is written by the interrupt thread when the
peer doorbells are handled, and read by the control and data paths;
in particular, device stop polls it while waiting for the peer to
acknowledge. Plain accesses do not guarantee that this update is seen,
the stop loop only works because the delay call is opaque to the
compiler.
Use atomic accesses with release/acquire ordering.
Fixes: 62012a76811e ("raw/ntb: add handshake process")
Signed-off-by: Raghavendra Ningoji <raghavendra.ningoji at amd.com>
---
drivers/raw/ntb/ntb.c | 28 +++++++++++++++++-----------
drivers/raw/ntb/ntb.h | 5 ++++-
2 files changed, 21 insertions(+), 12 deletions(-)
diff --git a/drivers/raw/ntb/ntb.c b/drivers/raw/ntb/ntb.c
index 74d189149c..f6751b71ff 100644
--- a/drivers/raw/ntb/ntb.c
+++ b/drivers/raw/ntb/ntb.c
@@ -42,6 +42,12 @@ static struct rte_rawdev_xstats_name ntb_xstats_names[] = {
};
#define NTB_XSTATS_NUM RTE_DIM(ntb_xstats_names)
+static inline bool
+ntb_peer_dev_is_up(struct ntb_hw *hw)
+{
+ return rte_atomic_load_explicit(&hw->peer_dev_up, rte_memory_order_acquire) != 0;
+}
+
static inline void
ntb_link_cleanup(struct rte_rawdev *dev)
{
@@ -173,7 +179,7 @@ ntb_dev_intr_handler(void *param)
* Peer dev is already up. All mw settings are already done.
* Skip them.
*/
- if (hw->peer_dev_up)
+ if (ntb_peer_dev_is_up(hw))
return;
if (hw->ntb_ops->spad_read == NULL) {
@@ -202,7 +208,7 @@ ntb_dev_intr_handler(void *param)
}
}
- hw->peer_dev_up = 1;
+ rte_atomic_store_explicit(&hw->peer_dev_up, 1, rte_memory_order_release);
/**
* Handshake with peer. Spad_write & mw_set_trans only works
@@ -234,7 +240,7 @@ ntb_dev_intr_handler(void *param)
/* Peer device will be down, So clean local side too. */
ntb_link_cleanup(dev);
- hw->peer_dev_up = 0;
+ rte_atomic_store_explicit(&hw->peer_dev_up, 0, rte_memory_order_release);
/* Response peer's dev_stop request. */
(*hw->ntb_ops->peer_db_set)(dev, 2);
return;
@@ -244,7 +250,7 @@ ntb_dev_intr_handler(void *param)
NTB_LOG(INFO, "DB2: Peer device agrees dev to be down.");
/* Clear received doorbell. */
(*hw->ntb_ops->db_clear)(dev, (1 << 2));
- hw->peer_dev_up = 0;
+ rte_atomic_store_explicit(&hw->peer_dev_up, 0, rte_memory_order_release);
return;
}
@@ -685,7 +691,7 @@ ntb_enqueue_bufs(struct rte_rawdev *dev,
return nb_tx;
}
- if (unlikely(dev->started == 0 || hw->peer_dev_up == 0)) {
+ if (unlikely(dev->started == 0 || !ntb_peer_dev_is_up(hw))) {
NTB_LOG(DEBUG, "Link is not up.");
return nb_tx;
}
@@ -796,7 +802,7 @@ ntb_dequeue_bufs(struct rte_rawdev *dev,
uint16_t off, last_avail, used_cnt, used_nb, nb_segs;
int i;
- if (unlikely(dev->started == 0 || hw->peer_dev_up == 0)) {
+ if (unlikely(dev->started == 0 || !ntb_peer_dev_is_up(hw))) {
NTB_LOG(DEBUG, "Link is not up");
return nb_rx;
}
@@ -978,7 +984,7 @@ ntb_dev_start(struct rte_rawdev *dev)
uint32_t i;
int ret;
- if (!hw->link_status || !hw->peer_dev_up)
+ if (!hw->link_status || !ntb_peer_dev_is_up(hw))
return -EINVAL;
/* Set total stats. */
@@ -1064,7 +1070,7 @@ ntb_dev_stop(struct rte_rawdev *dev)
uint32_t time_out;
int status, i;
- if (!hw->peer_dev_up)
+ if (!ntb_peer_dev_is_up(hw))
goto clean;
ntb_link_cleanup(dev);
@@ -1087,7 +1093,7 @@ ntb_dev_stop(struct rte_rawdev *dev)
time_out = 1000000;
/* Wait for cleanup work down before db mask clear. */
- while (hw->peer_dev_up && time_out) {
+ while (ntb_peer_dev_is_up(hw) && time_out) {
time_out -= 10;
rte_delay_us(10);
}
@@ -1228,7 +1234,7 @@ ntb_attr_get(struct rte_rawdev *dev, const char *attr_name,
if (!strncmp(attr_name, NTB_LINK_STATUS_NAME, NTB_ATTR_NAME_LEN)) {
/* hw->link_status only indicates hw link status. */
- *attr_value = hw->link_status && hw->peer_dev_up;
+ *attr_value = hw->link_status && ntb_peer_dev_is_up(hw);
NTB_LOG(DEBUG, "Attribute (%s) Value (%" PRIu64 ")",
attr_name, *attr_value);
return 0;
@@ -1460,7 +1466,7 @@ ntb_init_hw(struct rte_rawdev *dev, struct rte_pci_device *pci_dev)
int ret, i;
hw->pci_dev = pci_dev;
- hw->peer_dev_up = 0;
+ rte_atomic_store_explicit(&hw->peer_dev_up, 0, rte_memory_order_release);
hw->link_status = NTB_LINK_DOWN;
hw->link_speed = NTB_SPEED_NONE;
hw->link_width = NTB_WIDTH_NONE;
diff --git a/drivers/raw/ntb/ntb.h b/drivers/raw/ntb/ntb.h
index 41f5b773de..ca565efc01 100644
--- a/drivers/raw/ntb/ntb.h
+++ b/drivers/raw/ntb/ntb.h
@@ -7,6 +7,8 @@
#include <stdbool.h>
+#include <rte_stdatomic.h>
+
extern int ntb_logtype;
#define RTE_LOGTYPE_NTB ntb_logtype
@@ -218,7 +220,8 @@ struct ntb_hw {
struct rte_intr_handle **db_intr_handles;
uint16_t nb_db_intr_handles;
- uint8_t peer_dev_up;
+ /* Written by the interrupt thread, read by control and data paths. */
+ RTE_ATOMIC(uint8_t) peer_dev_up;
uint64_t mw_size[NTB_MAX_MW];
/* remote mem base addr */
uint64_t *peer_mw_base;
--
2.47.3
---
Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- - 2026-11-16 22:52:19.349395598 +0000
+++ 0072-raw-ntb-fix-peer-device-status-access.patch 2026-11-16 22:52:16.536234756 +0000
@@ -1 +1 @@
-From 6df69aaf98d0f3032dc3356974f38a34a6a91a3e Mon Sep 17 00:00:00 2001
+From dde39f2654c64d2b72b4628726932ce1e5e72c2e Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 6df69aaf98d0f3032dc3356974f38a34a6a91a3e ]
+
@@ -16 +17,0 @@
-Cc: stable at dpdk.org
@@ -25 +26 @@
-index 66f6dac5c4..cb31aeb362 100644
+index 74d189149c..f6751b71ff 100644
@@ -28 +29 @@
-@@ -48,6 +48,12 @@ static struct rte_rawdev_xstats_name ntb_xstats_names[] = {
+@@ -42,6 +42,12 @@ static struct rte_rawdev_xstats_name ntb_xstats_names[] = {
@@ -38,2 +39,2 @@
- static void
- ntb_dev_intr_handler(void *param)
+ static inline void
+ ntb_link_cleanup(struct rte_rawdev *dev)
@@ -41 +42 @@
-@@ -69,14 +75,14 @@ ntb_dev_intr_handler(void *param)
+@@ -173,7 +179,7 @@ ntb_dev_intr_handler(void *param)
@@ -49,3 +50,4 @@
- /* Check that the peer memory-window layout matches local. */
- if ((*hw->ntb_ops->peer_mw_validate)(dev) < 0)
- return;
+ if (hw->ntb_ops->spad_read == NULL) {
+@@ -202,7 +208,7 @@ ntb_dev_intr_handler(void *param)
+ }
+ }
@@ -57,2 +59,2 @@
- * Handshake with peer. Scratchpad and translation programming
-@@ -104,7 +110,7 @@ ntb_dev_intr_handler(void *param)
+ * Handshake with peer. Spad_write & mw_set_trans only works
+@@ -234,7 +240,7 @@ ntb_dev_intr_handler(void *param)
@@ -60 +62 @@
- (*hw->ntb_ops->link_cleanup)(dev);
+ ntb_link_cleanup(dev);
@@ -67 +69 @@
-@@ -114,7 +120,7 @@ ntb_dev_intr_handler(void *param)
+@@ -244,7 +250,7 @@ ntb_dev_intr_handler(void *param)
@@ -76,3 +78,3 @@
-@@ -549,7 +555,7 @@ ntb_enqueue_bufs(struct rte_rawdev *dev,
- void *buf_addr;
- int i;
+@@ -685,7 +691,7 @@ ntb_enqueue_bufs(struct rte_rawdev *dev,
+ return nb_tx;
+ }
@@ -85 +87 @@
-@@ -660,7 +666,7 @@ ntb_dequeue_bufs(struct rte_rawdev *dev,
+@@ -796,7 +802,7 @@ ntb_dequeue_bufs(struct rte_rawdev *dev,
@@ -94 +96 @@
-@@ -853,7 +859,7 @@ ntb_dev_start(struct rte_rawdev *dev)
+@@ -978,7 +984,7 @@ ntb_dev_start(struct rte_rawdev *dev)
@@ -103 +105 @@
-@@ -907,7 +913,7 @@ ntb_dev_stop(struct rte_rawdev *dev)
+@@ -1064,7 +1070,7 @@ ntb_dev_stop(struct rte_rawdev *dev)
@@ -111,2 +113,2 @@
- (*hw->ntb_ops->link_cleanup)(dev);
-@@ -926,7 +932,7 @@ ntb_dev_stop(struct rte_rawdev *dev)
+ ntb_link_cleanup(dev);
+@@ -1087,7 +1093,7 @@ ntb_dev_stop(struct rte_rawdev *dev)
@@ -121 +123 @@
-@@ -1061,7 +1067,7 @@ ntb_attr_get(struct rte_rawdev *dev, const char *attr_name,
+@@ -1228,7 +1234,7 @@ ntb_attr_get(struct rte_rawdev *dev, const char *attr_name,
@@ -130 +132 @@
-@@ -1325,7 +1331,7 @@ ntb_init_hw(struct rte_rawdev *dev, struct rte_pci_device *pci_dev)
+@@ -1460,7 +1466,7 @@ ntb_init_hw(struct rte_rawdev *dev, struct rte_pci_device *pci_dev)
@@ -140 +142 @@
-index f867f0323d..5111d766c2 100644
+index 41f5b773de..ca565efc01 100644
@@ -152 +154 @@
-@@ -226,7 +228,8 @@ struct ntb_hw {
+@@ -218,7 +220,8 @@ struct ntb_hw {
More information about the stable
mailing list