DPDK patches and discussions
 help / color / mirror / Atom feed
From: Maxime Leroy <maxime@leroys.fr>
To: Hemant Agrawal <hemant.agrawal@nxp.com>
Cc: dev@dpdk.org, stephen@networkplumber.org,
	david.marchand@redhat.com,  jun.yang@nxp.com, stable@dpdk.org
Subject: Re: [PATCH v3 2/4] net/dpaa2: clear active VDQ state when freeing Rx queues
Date: Thu, 13 Nov 2025 12:27:37 +0100	[thread overview]
Message-ID: <CAHHRULU5Lm3VDj8dp1tzuwmPSkbz6rKPteK4u4FCxEyXbZg2=w@mail.gmail.com> (raw)
In-Reply-To: <20251113095917.1973514-2-hemant.agrawal@nxp.com>

Hi Hemant,

Le jeu. 13 nov. 2025 à 10:59, Hemant Agrawal <hemant.agrawal@nxp.com> a écrit :
>
> From: Maxime Leroy <maxime@leroys.fr>
>
> When using the prefetch Rx path (dpaa2_dev_prefetch_rx), the driver keeps
> track of one outstanding VDQCR command per DPIO portal in the global
> rte_global_active_dqs_list[] array. Each queue_storage_info_t also stores
> the active result buffer and portal index:
>
>   qs->active_dqs
>   qs->active_dpio_id
>
> Before issuing a new pull command, dpaa2_dev_prefetch_rx() checks for an
> active entry and spins on qbman_check_command_complete() until the
> corresponding VDQCR completes.
>
> On port close / hotplug remove, dpaa2_free_rx_tx_queues() frees all
> per-lcore queue_storage_info_t structures and their dq_storage[] buffers,
> but never clears the global rte_global_active_dqs_list[] entries. After a
> detach/attach sequence (or "del/add" in grout), the prefetch Rx path
> still sees an active entry for the portal and spins forever on a stale dq
> buffer that has been freed and will never be completed by hardware. In
> gdb, dq->dq.tok stays 0 and dpaa2_dev_prefetch_rx() loops in:
>
>   while (!qbman_check_command_complete(get_swp_active_dqs(idx)))
>       ;
>
> Fix this by clearing the active VDQ state before freeing queue storage.
> For each Rx queue and lcore, if qs->active_dqs is non-NULL, call
> clear_swp_active_dqs(qs->active_dpio_id) and set qs->active_dqs to NULL.
> Then dpaa2_queue_storage_free() can safely free q_storage and
> dq_storage[].
>
> After this change, a DPNI detach/attach sequence no longer leaves stale
> entries in rte_global_active_dqs_list[], and the prefetch Rx loop does
> not hang waiting for a completion from a previous device instance.
>
> Reproduction:
>   - grout:
>       grcli interface add  port dpni.1 devargs fslmc:dpni.1
>       grcli interface del  dpni.1
>       grcli interface add  port dpni.1 devargs fslmc:dpni.1
>     -> Rx was stuck in qbman_check_command_complete(), now works.
>
>   - testpmd:
>       dpdk-testpmd -n1 -a fslmc:dpni.65535 -- -i --forward-mode=rxonly
>       testpmd> port attach fslmc:dpni.1
>       testpmd> port start all
>       testpmd> start
>       testpmd> stop
>       testpmd> port stop all
>       testpmd> port detach 0
>       testpmd> port attach fslmc:dpni.1
>       testpmd> port start all
>       testpmd> start
>     -> Rx was hanging, now runs normal
>
> Fixes: 12d98eceb8ac ("bus/fslmc: enhance QBMAN DQ storage logic")
> Cc: jun.yang@nxp.com
> Cc: stable@dpdk.org
>
> Signed-off-by: Maxime Leroy <maxime@leroys.fr>
> ---
>  .mailmap                         |  2 +-
>  drivers/net/dpaa2/dpaa2_ethdev.c | 22 ++++++++++++++++++++++
>  2 files changed, 23 insertions(+), 1 deletion(-)
>
> diff --git a/.mailmap b/.mailmap
> index 10c37a97a6..d92d4fc24b 100644
> --- a/.mailmap
> +++ b/.mailmap
> @@ -1035,7 +1035,7 @@ Mauricio Vasquez B <mauricio.vasquez@polito.it> <mauricio.vasquezbernal@studenti
>  Mauro Annarumma <mauroannarumma@hotmail.it>
>  Maxime Coquelin <maxime.coquelin@redhat.com>
>  Maxime Gouin <maxime.gouin@6wind.com>
> -Maxime Leroy <maxime.leroy@6wind.com>
> +Maxime Leroy <maxime.leroy@6wind.com> <maxime@leroys.fr>
>  Md Fahad Iqbal Polash <md.fahad.iqbal.polash@intel.com>
>  Megha Ajmera <megha.ajmera@intel.com>
>  Meijuan Zhao <meijuanx.zhao@intel.com>
> diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c
> index fc63cf4f09..c94034104a 100644
> --- a/drivers/net/dpaa2/dpaa2_ethdev.c
> +++ b/drivers/net/dpaa2/dpaa2_ethdev.c
> @@ -631,6 +631,27 @@ dpaa2_alloc_rx_tx_queues(struct rte_eth_dev *dev)
>         return ret;
>  }
>
> +static void
> +dpaa2_clear_queue_active_dps(struct dpaa2_queue *q)
> +{
> +       int lcore_id;
> +
> +       RTE_LCORE_FOREACH(lcore_id) {

RTE_LCORE_FOREACH does not iterate over NON-EAL threads. However,
Grout creates NON-EAL threads using the pthread library to poll the RX
queue.

As a result, using RTE_LCORE_FOREACH breaks the fix. We should revert
to the previous version of the fix.

Thanks,

Maxime Leroy

  reply	other threads:[~2025-11-13 11:27 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-06 16:38 [PATCH 1/3] net/dpaa2: fix duplicate calling of dpaa2 dev close Hemant Agrawal
2025-11-06 16:38 ` [PATCH 2/3] net/dpaa2: clear active VDQ state when freeing Rx queues Hemant Agrawal
2025-11-06 19:29   ` Stephen Hemminger
2025-11-07  9:51     ` Maxime Leroy
2025-11-07 10:38       ` Hemant Agrawal
2025-11-07  8:34   ` David Marchand
2025-11-06 16:38 ` [PATCH 3/3] bus/fslmc: add support for hotplug of dpni Hemant Agrawal
2025-11-07  8:32 ` [PATCH 1/3] net/dpaa2: fix duplicate calling of dpaa2 dev close David Marchand
2025-11-08 15:35   ` David Marchand
2025-11-12 23:06 ` Stephen Hemminger
2025-11-13  5:29 ` [PATCH v2 1/5] " Hemant Agrawal
2025-11-13  5:29   ` [PATCH v2 2/5] net/dpaa2: clear active VDQ state when freeing Rx queues Hemant Agrawal
2025-11-13  5:29   ` [PATCH v2 3/5] net/dpaa2: fix queue free cleanup Hemant Agrawal
2025-11-13  5:29   ` [PATCH v2 4/5] net/dpaa2: bifurcate close into close and deinit Hemant Agrawal
2025-11-13  9:48     ` Maxime Leroy
2025-11-13  9:49     ` Maxime Leroy
2025-11-13  9:55       ` Hemant Agrawal
2025-11-13  5:29   ` [PATCH v2 5/5] bus/fslmc: add support for hotplug of dpni Hemant Agrawal
2025-11-13  9:59   ` [PATCH v3 1/4] net/dpaa2: fix duplicate calling of dpaa2 dev close Hemant Agrawal
2025-11-13  9:59     ` [PATCH v3 2/4] net/dpaa2: clear active VDQ state when freeing Rx queues Hemant Agrawal
2025-11-13 11:27       ` Maxime Leroy [this message]
2025-11-13  9:59     ` [PATCH v3 3/4] net/dpaa2: fix queue free cleanup Hemant Agrawal
2025-11-13  9:59     ` [PATCH v3 4/4] bus/fslmc: add support for hotplug of dpni Hemant Agrawal
2025-11-13 11:43     ` [PATCH v4 1/4] net/dpaa2: fix duplicate calling of dpaa2 dev close Hemant Agrawal
2025-11-13 11:43       ` [PATCH v4 2/4] net/dpaa2: clear active VDQ state when freeing Rx queues Hemant Agrawal
2025-11-13 11:43       ` [PATCH v4 3/4] net/dpaa2: fix queue free cleanup Hemant Agrawal
2025-11-13 11:43       ` [PATCH v4 4/4] bus/fslmc: add support for hotplug of dpni Hemant Agrawal
2025-11-13 15:11       ` [PATCH v4 1/4] net/dpaa2: fix duplicate calling of dpaa2 dev close Maxime Leroy

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='CAHHRULU5Lm3VDj8dp1tzuwmPSkbz6rKPteK4u4FCxEyXbZg2=w@mail.gmail.com' \
    --to=maxime@leroys.fr \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=hemant.agrawal@nxp.com \
    --cc=jun.yang@nxp.com \
    --cc=stable@dpdk.org \
    --cc=stephen@networkplumber.org \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).