* [PATCH] app/testpmd: fix testpmd crash when quit with mlx5 avail_thresh enabled
@ 2022-10-24 3:14 Spike Du
2022-10-27 9:04 ` Singh, Aman Deep
2022-11-02 11:44 ` [PATCH v2] mlx5/testpmd: fix crash on quit with avail thresh enabled Spike Du
0 siblings, 2 replies; 5+ messages in thread
From: Spike Du @ 2022-10-24 3:14 UTC (permalink / raw)
To: matan, viacheslavo, orika, thomas; +Cc: dev, rasland
When testpmd quit with mlx5 avail_thresh enabled, a rte timer handler
delays to reconfigure rx queue to re-arm this event. However at the same
time, testpmd is destroying rx queues.
It's never a valid use case for mlx5 avail_thresh. Before testpmd quit,
user should disable avail_thresh configuration to not handle the events.
This is documented in mlx5 driver guide.
To avoid the crash in such use case, check port status, if it is not
RTE_PORT_STARTED, don't process the avail_thresh event.
Fixes: 0edfc9b08316 ("app/testpmd: add Host Shaper command")
Signed-off-by: Spike Du <spiked@nvidia.com>
---
drivers/net/mlx5/mlx5_testpmd.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/net/mlx5/mlx5_testpmd.c b/drivers/net/mlx5/mlx5_testpmd.c
index ed84583..1a9ec78 100644
--- a/drivers/net/mlx5/mlx5_testpmd.c
+++ b/drivers/net/mlx5/mlx5_testpmd.c
@@ -25,6 +25,7 @@
static uint8_t host_shaper_avail_thresh_triggered[RTE_MAX_ETHPORTS];
#define SHAPER_DISABLE_DELAY_US 100000 /* 100ms */
+extern struct rte_port *ports;
/**
* Disable the host shaper and re-arm available descriptor threshold event.
@@ -39,7 +40,15 @@
uint16_t port_id = port_rxq_id & 0xffff;
uint16_t qid = (port_rxq_id >> 16) & 0xffff;
struct rte_eth_rxq_info qinfo;
+ struct rte_port *port;
+ port = &ports[port_id];
+ if (port->port_status != RTE_PORT_STARTED) {
+ printf("%s port_status(%d) is incorrect, stop avail_thresh "
+ "event processing.\n",
+ __func__, port->port_status);
+ return;
+ }
printf("%s disable shaper\n", __func__);
if (rte_eth_rx_queue_info_get(port_id, qid, &qinfo)) {
printf("rx_queue_info_get returns error\n");
--
1.8.3.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] app/testpmd: fix testpmd crash when quit with mlx5 avail_thresh enabled
2022-10-24 3:14 [PATCH] app/testpmd: fix testpmd crash when quit with mlx5 avail_thresh enabled Spike Du
@ 2022-10-27 9:04 ` Singh, Aman Deep
2022-11-02 11:44 ` [PATCH v2] mlx5/testpmd: fix crash on quit with avail thresh enabled Spike Du
1 sibling, 0 replies; 5+ messages in thread
From: Singh, Aman Deep @ 2022-10-27 9:04 UTC (permalink / raw)
To: Spike Du, matan, viacheslavo, orika, thomas; +Cc: dev, rasland
On 10/24/2022 8:44 AM, Spike Du wrote:
> When testpmd quit with mlx5 avail_thresh enabled, a rte timer handler
> delays to reconfigure rx queue to re-arm this event. However at the same
> time, testpmd is destroying rx queues.
> It's never a valid use case for mlx5 avail_thresh. Before testpmd quit,
> user should disable avail_thresh configuration to not handle the events.
> This is documented in mlx5 driver guide.
>
> To avoid the crash in such use case, check port status, if it is not
> RTE_PORT_STARTED, don't process the avail_thresh event.
>
> Fixes: 0edfc9b08316 ("app/testpmd: add Host Shaper command")
>
> Signed-off-by: Spike Du <spiked@nvidia.com>
Acked-by: Aman Singh<aman.deep.singh@intel.com>
> ---
> drivers/net/mlx5/mlx5_testpmd.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/drivers/net/mlx5/mlx5_testpmd.c b/drivers/net/mlx5/mlx5_testpmd.c
> index ed84583..1a9ec78 100644
> --- a/drivers/net/mlx5/mlx5_testpmd.c
> +++ b/drivers/net/mlx5/mlx5_testpmd.c
> @@ -25,6 +25,7 @@
>
> static uint8_t host_shaper_avail_thresh_triggered[RTE_MAX_ETHPORTS];
> #define SHAPER_DISABLE_DELAY_US 100000 /* 100ms */
> +extern struct rte_port *ports;
This might not be needed, as we have testpmd.h included.
>
> /**
> * Disable the host shaper and re-arm available descriptor threshold event.
> @@ -39,7 +40,15 @@
> uint16_t port_id = port_rxq_id & 0xffff;
> uint16_t qid = (port_rxq_id >> 16) & 0xffff;
> struct rte_eth_rxq_info qinfo;
> + struct rte_port *port;
>
> + port = &ports[port_id];
> + if (port->port_status != RTE_PORT_STARTED) {
> + printf("%s port_status(%d) is incorrect, stop avail_thresh "
> + "event processing.\n",
> + __func__, port->port_status);
> + return;
> + }
> printf("%s disable shaper\n", __func__);
> if (rte_eth_rx_queue_info_get(port_id, qid, &qinfo)) {
> printf("rx_queue_info_get returns error\n");
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2] mlx5/testpmd: fix crash on quit with avail thresh enabled
2022-10-24 3:14 [PATCH] app/testpmd: fix testpmd crash when quit with mlx5 avail_thresh enabled Spike Du
2022-10-27 9:04 ` Singh, Aman Deep
@ 2022-11-02 11:44 ` Spike Du
2022-11-06 13:26 ` Matan Azrad
2022-11-06 15:42 ` Raslan Darawsheh
1 sibling, 2 replies; 5+ messages in thread
From: Spike Du @ 2022-11-02 11:44 UTC (permalink / raw)
To: matan, viacheslavo, orika, thomas, Shahaf Shuler; +Cc: dev, rasland, stable
When testpmd quit with mlx5 avail_thresh enabled, a rte timer handler
delays to reconfigure rx queue to re-arm this event. However at the same
time, testpmd is destroying rx queues.
It's never a valid use case for mlx5 avail_thresh. Before testpmd quit,
user should disable avail_thresh configuration to not handle the events.
This is documented in mlx5 driver guide.
To avoid the crash in such use case, check port status, if it is not
RTE_PORT_STARTED, don't process the avail_thresh event.
Fixes: f41a5092e6ae ("app/testpmd: add host shaper command")
Cc: stable@dpdk.org
Signed-off-by: Spike Du <spiked@nvidia.com>
---
drivers/net/mlx5/mlx5_testpmd.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/net/mlx5/mlx5_testpmd.c b/drivers/net/mlx5/mlx5_testpmd.c
index ed84583..879ea28 100644
--- a/drivers/net/mlx5/mlx5_testpmd.c
+++ b/drivers/net/mlx5/mlx5_testpmd.c
@@ -39,7 +39,15 @@
uint16_t port_id = port_rxq_id & 0xffff;
uint16_t qid = (port_rxq_id >> 16) & 0xffff;
struct rte_eth_rxq_info qinfo;
+ struct rte_port *port;
+ port = &ports[port_id];
+ if (port->port_status != RTE_PORT_STARTED) {
+ printf("%s port_status(%d) is incorrect, stop avail_thresh "
+ "event processing.\n",
+ __func__, port->port_status);
+ return;
+ }
printf("%s disable shaper\n", __func__);
if (rte_eth_rx_queue_info_get(port_id, qid, &qinfo)) {
printf("rx_queue_info_get returns error\n");
--
1.8.3.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* RE: [PATCH v2] mlx5/testpmd: fix crash on quit with avail thresh enabled
2022-11-02 11:44 ` [PATCH v2] mlx5/testpmd: fix crash on quit with avail thresh enabled Spike Du
@ 2022-11-06 13:26 ` Matan Azrad
2022-11-06 15:42 ` Raslan Darawsheh
1 sibling, 0 replies; 5+ messages in thread
From: Matan Azrad @ 2022-11-06 13:26 UTC (permalink / raw)
To: Spike Du, Slava Ovsiienko, Ori Kam,
NBU-Contact-Thomas Monjalon (EXTERNAL),
Shahaf Shuler
Cc: dev, Raslan Darawsheh, stable
From: Spike Du <spiked@nvidia.com>
> When testpmd quit with mlx5 avail_thresh enabled, a rte timer handler
> delays to reconfigure rx queue to re-arm this event. However at the same
> time, testpmd is destroying rx queues.
> It's never a valid use case for mlx5 avail_thresh. Before testpmd quit, user
> should disable avail_thresh configuration to not handle the events.
> This is documented in mlx5 driver guide.
>
> To avoid the crash in such use case, check port status, if it is not
> RTE_PORT_STARTED, don't process the avail_thresh event.
>
> Fixes: f41a5092e6ae ("app/testpmd: add host shaper command")
> Cc: stable@dpdk.org
>
> Signed-off-by: Spike Du <spiked@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [PATCH v2] mlx5/testpmd: fix crash on quit with avail thresh enabled
2022-11-02 11:44 ` [PATCH v2] mlx5/testpmd: fix crash on quit with avail thresh enabled Spike Du
2022-11-06 13:26 ` Matan Azrad
@ 2022-11-06 15:42 ` Raslan Darawsheh
1 sibling, 0 replies; 5+ messages in thread
From: Raslan Darawsheh @ 2022-11-06 15:42 UTC (permalink / raw)
To: Spike Du, Matan Azrad, Slava Ovsiienko, Ori Kam,
NBU-Contact-Thomas Monjalon (EXTERNAL),
Shahaf Shuler
Cc: dev, stable
Hi,
> -----Original Message-----
> From: Spike Du <spiked@nvidia.com>
> Sent: Wednesday, November 2, 2022 1:44 PM
> To: Matan Azrad <matan@nvidia.com>; Slava Ovsiienko
> <viacheslavo@nvidia.com>; Ori Kam <orika@nvidia.com>; NBU-Contact-
> Thomas Monjalon (EXTERNAL) <thomas@monjalon.net>; Shahaf Shuler
> <shahafs@nvidia.com>
> Cc: dev@dpdk.org; Raslan Darawsheh <rasland@nvidia.com>;
> stable@dpdk.org
> Subject: [PATCH v2] mlx5/testpmd: fix crash on quit with avail thresh enabled
>
> When testpmd quit with mlx5 avail_thresh enabled, a rte timer handler
> delays to reconfigure rx queue to re-arm this event. However at the same
> time, testpmd is destroying rx queues.
> It's never a valid use case for mlx5 avail_thresh. Before testpmd quit,
> user should disable avail_thresh configuration to not handle the events.
> This is documented in mlx5 driver guide.
>
> To avoid the crash in such use case, check port status, if it is not
> RTE_PORT_STARTED, don't process the avail_thresh event.
>
> Fixes: f41a5092e6ae ("app/testpmd: add host shaper command")
> Cc: stable@dpdk.org
>
> Signed-off-by: Spike Du <spiked@nvidia.com>
Patch applied to next-net-mlx,
Kindest regards,
Raslan Darawsheh
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-11-06 15:42 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-24 3:14 [PATCH] app/testpmd: fix testpmd crash when quit with mlx5 avail_thresh enabled Spike Du
2022-10-27 9:04 ` Singh, Aman Deep
2022-11-02 11:44 ` [PATCH v2] mlx5/testpmd: fix crash on quit with avail thresh enabled Spike Du
2022-11-06 13:26 ` Matan Azrad
2022-11-06 15:42 ` Raslan Darawsheh
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.