[dpdk-stable] patch 'net/bnx2x: fix race for periodic flags' has been queued to LTS release 17.11.7
Yongseok Koh
yskoh at mellanox.com
Tue Jul 23 03:00:48 CEST 2019
Hi,
FYI, your patch has been queued to LTS release 17.11.7
Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objection by 07/27/19. So please
shout if anyone has objection.
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.
Thanks.
Yongseok
---
>From df8a13f3b793ed4cd6d9c01e2c8f47c8a3b544cb Mon Sep 17 00:00:00 2001
From: Rasesh Mody <rmody at marvell.com>
Date: Thu, 11 Apr 2019 18:47:41 -0700
Subject: [PATCH] net/bnx2x: fix race for periodic flags
[ upstream commit c19eafccb22e1b1ca52439a936908cfd6fd12ff1 ]
The periodic callout function and the interrupt handler both modify the
periodic flags. There is a possible race condition when an application
is going through dev_stop()/dev_start() and an interrupt handler is
invoked. We also need to ensure that periodic polling is not invoked in
interrupt context.
This patch handles such case by using separate variable to check for
interrupt context. Also, atomically load and store the periodic flag
value.
Fixes: 0f6ebeee2402 ("net/bnx2x: fix call to link handling periodic function")
Signed-off-by: Rasesh Mody <rmody at marvell.com>
---
drivers/net/bnx2x/bnx2x_ethdev.c | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c
index 997e9ba1a0..efd6fd6c6a 100644
--- a/drivers/net/bnx2x/bnx2x_ethdev.c
+++ b/drivers/net/bnx2x/bnx2x_ethdev.c
@@ -164,14 +164,15 @@ bnx2x_link_update(struct rte_eth_dev *dev)
}
static void
-bnx2x_interrupt_action(struct rte_eth_dev *dev)
+bnx2x_interrupt_action(struct rte_eth_dev *dev, int intr_cxt)
{
struct bnx2x_softc *sc = dev->data->dev_private;
uint32_t link_status;
bnx2x_intr_legacy(sc);
- if (sc->periodic_flags & PERIODIC_GO)
+ if ((atomic_load_acq_long(&sc->periodic_flags) == PERIODIC_GO) &&
+ !intr_cxt)
bnx2x_periodic_callout(sc);
link_status = REG_RD(sc, sc->link_params.shmem_base +
offsetof(struct shmem_region,
@@ -188,9 +189,7 @@ bnx2x_interrupt_handler(void *param)
PMD_DEBUG_PERIODIC_LOG(INFO, sc, "Interrupt handled");
- atomic_store_rel_long(&sc->periodic_flags, PERIODIC_STOP);
- bnx2x_interrupt_action(dev);
- atomic_store_rel_long(&sc->periodic_flags, PERIODIC_GO);
+ bnx2x_interrupt_action(dev, 1);
rte_intr_enable(&sc->pci_dev->intr_handle);
}
@@ -201,7 +200,7 @@ static void bnx2x_periodic_start(void *param)
int ret = 0;
atomic_store_rel_long(&sc->periodic_flags, PERIODIC_GO);
- bnx2x_interrupt_action(dev);
+ bnx2x_interrupt_action(dev, 0);
if (IS_PF(sc)) {
ret = rte_eal_alarm_set(BNX2X_SP_TIMER_PERIOD,
bnx2x_periodic_start, (void *)dev);
@@ -221,6 +220,8 @@ void bnx2x_periodic_stop(void *param)
atomic_store_rel_long(&sc->periodic_flags, PERIODIC_STOP);
rte_eal_alarm_cancel(bnx2x_periodic_start, (void *)dev);
+
+ PMD_DRV_LOG(DEBUG, sc, "Periodic poll stopped");
}
/*
@@ -310,8 +311,10 @@ bnx2x_dev_start(struct rte_eth_dev *dev)
PMD_INIT_FUNC_TRACE(sc);
/* start the periodic callout */
- if (sc->periodic_flags & PERIODIC_STOP)
+ if (atomic_load_acq_long(&sc->periodic_flags) == PERIODIC_STOP) {
bnx2x_periodic_start(dev);
+ PMD_DRV_LOG(DEBUG, sc, "Periodic poll re-started");
+ }
ret = bnx2x_init(sc);
if (ret) {
--
2.21.0
---
Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- - 2019-07-22 17:55:10.836916169 -0700
+++ 0081-net-bnx2x-fix-race-for-periodic-flags.patch 2019-07-22 17:55:06.350473000 -0700
@@ -1,8 +1,10 @@
-From c19eafccb22e1b1ca52439a936908cfd6fd12ff1 Mon Sep 17 00:00:00 2001
+From df8a13f3b793ed4cd6d9c01e2c8f47c8a3b544cb Mon Sep 17 00:00:00 2001
From: Rasesh Mody <rmody at marvell.com>
Date: Thu, 11 Apr 2019 18:47:41 -0700
Subject: [PATCH] net/bnx2x: fix race for periodic flags
+[ upstream commit c19eafccb22e1b1ca52439a936908cfd6fd12ff1 ]
+
The periodic callout function and the interrupt handler both modify the
periodic flags. There is a possible race condition when an application
is going through dev_stop()/dev_start() and an interrupt handler is
@@ -14,7 +16,6 @@
value.
Fixes: 0f6ebeee2402 ("net/bnx2x: fix call to link handling periodic function")
-Cc: stable at dpdk.org
Signed-off-by: Rasesh Mody <rmody at marvell.com>
---
@@ -22,10 +23,10 @@
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c
-index f85766c687..3063aea647 100644
+index 997e9ba1a0..efd6fd6c6a 100644
--- a/drivers/net/bnx2x/bnx2x_ethdev.c
+++ b/drivers/net/bnx2x/bnx2x_ethdev.c
-@@ -108,14 +108,15 @@ bnx2x_link_update(struct rte_eth_dev *dev)
+@@ -164,14 +164,15 @@ bnx2x_link_update(struct rte_eth_dev *dev)
}
static void
@@ -43,7 +44,7 @@
bnx2x_periodic_callout(sc);
link_status = REG_RD(sc, sc->link_params.shmem_base +
offsetof(struct shmem_region,
-@@ -132,9 +133,7 @@ bnx2x_interrupt_handler(void *param)
+@@ -188,9 +189,7 @@ bnx2x_interrupt_handler(void *param)
PMD_DEBUG_PERIODIC_LOG(INFO, sc, "Interrupt handled");
@@ -54,7 +55,7 @@
rte_intr_enable(&sc->pci_dev->intr_handle);
}
-@@ -145,7 +144,7 @@ static void bnx2x_periodic_start(void *param)
+@@ -201,7 +200,7 @@ static void bnx2x_periodic_start(void *param)
int ret = 0;
atomic_store_rel_long(&sc->periodic_flags, PERIODIC_GO);
@@ -63,7 +64,7 @@
if (IS_PF(sc)) {
ret = rte_eal_alarm_set(BNX2X_SP_TIMER_PERIOD,
bnx2x_periodic_start, (void *)dev);
-@@ -165,6 +164,8 @@ void bnx2x_periodic_stop(void *param)
+@@ -221,6 +220,8 @@ void bnx2x_periodic_stop(void *param)
atomic_store_rel_long(&sc->periodic_flags, PERIODIC_STOP);
rte_eal_alarm_cancel(bnx2x_periodic_start, (void *)dev);
@@ -72,7 +73,7 @@
}
/*
-@@ -226,8 +227,10 @@ bnx2x_dev_start(struct rte_eth_dev *dev)
+@@ -310,8 +311,10 @@ bnx2x_dev_start(struct rte_eth_dev *dev)
PMD_INIT_FUNC_TRACE(sc);
/* start the periodic callout */
More information about the stable
mailing list