net/iavf: vf reset fixes
cover net/iavf: vf reset fixes
The patch [1] aimed to address a race condition in the iavf driver during a reset and also reduced noisy logging during resets. Patch 1 of this series extracts the noisy logging fix into its own commit.
Patch 2 offers an alternative approach to fixing the race condition. Patch 3 fixes a pre-existing refcount imbalance in the shared event handler thread that became visible while investigating the reset path.
[1] https://patches.dpdk.org/project/dpdk/patch/[email protected]/
Ciara Loftus (2):
net/iavf: wait for PF reset start before reinitializing net/iavf: fix event handler refcount leak on HW reset
Talluri Chaitanyababu (1):
net/iavf: downgrade opcode 0 ARQ log to debug
drivers/net/intel/iavf/iavf.h | 1 + drivers/net/intel/iavf/iavf_ethdev.c | 14 +++++++++++++- drivers/net/intel/iavf/iavf_vchnl.c | 11 +++++++++-- 3 files changed, 23 insertions(+), 3 deletions(-)
Signature · 1 line
2.43.0
PATCH 1/3 net/iavf: downgrade opcode 0 ARQ log to debug
From: Talluri Chaitanyababu <[email protected]>
After admin queue reinitialisation, completions from uninitialised ARQ ring descriptor memory may arrive before any real PF response. These carry opcode 0 (VIRTCHNL_OP_UNKNOWN) and trigger a WARNING log on every poll iteration, flooding the log during reset recovery.
Treat opcode 0 as a distinct case and log it at DEBUG level, while retaining WARNING for genuine opcode mismatches.
--- drivers/net/intel/iavf/iavf_vchnl.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/net/intel/iavf/iavf_vchnl.c +9 -2
@@ -299,8 +299,15 @@ iavf_read_msg_from_pf(struct iavf_adapter *adapter, uint16_t buf_len,/* async reply msg on command issued by vf previously */ result =IAVF_MSG_CMD ;if (opcode != vf->pend_cmd) { -PMD_DRV_LOG (WARNING ,"command mismatch, expect %u, get %u" , - vf->pend_cmd, opcode); +if (opcode ==VIRTCHNL_OP_UNKNOWN ) +PMD_DRV_LOG (DEBUG , +"Spurious msg with opcode 0, pending cmd %u" , + vf->pend_cmd); +else +PMD_DRV_LOG (WARNING , +"command mismatch, expect %u, get %u" , + vf->pend_cmd, opcode); + result =IAVF_MSG_ERR ; } }
Signature · 1 line
2.43.0
Re: [PATCH 1/3] net/iavf: downgrade opcode 0 ARQ log to debug
Quoted 7 lines · Ciara Loftus
From: Talluri Chaitanyababu <[email protected]>
After admin queue reinitialisation, completions from uninitialised ARQ ring descriptor memory may arrive before any real PF response. These carry opcode 0 (
VIRTCHNL_OP_UNKNOWN) and trigger a WARNING log on every poll iteration, flooding the log during reset recovery.
Quoted 8 lines
Treat opcode 0 as a distinct case and log it at DEBUG level, while retaining WARNING for genuine opcode mismatches.
Signed-off-by Talluri Chaitanyababu <[email protected]>--- drivers/net/intel/iavf/iavf_vchnl.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
Should this be backported as a bugfix?
RE: [PATCH 1/3] net/iavf: downgrade opcode 0 ARQ log to debug
Quoted 13 lines
Subject: Re: [PATCH 1/3] net/iavf: downgrade opcode 0 ARQ log to debug
Quoted 10 lines · Ciara Loftus
From: Talluri Chaitanyababu <[email protected]>
After admin queue reinitialisation, completions from uninitialised ARQ ring descriptor memory may arrive before any real PF response. These carry opcode 0 (
VIRTCHNL_OP_UNKNOWN) and trigger a WARNING log on every poll iteration, flooding the log during reset recovery.Treat opcode 0 as a distinct case and log it at DEBUG level, while retaining WARNING for genuine opcode mismatches.
Quoted 6 lines
Quoted 5 lines
Signed-off-by Talluri Chaitanyababu <[email protected]>--- drivers/net/intel/iavf/iavf_vchnl.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)Should this be backported as a bugfix?
The issue has been present since the driver was added, but only triggered in practise more recently with the addition of the reset logic.
I think this tag can be added:
Let me know if you need a respin.
Re: [PATCH 1/3] net/iavf: downgrade opcode 0 ARQ log to debug
Quoted 25 lines · Ciara
Quoted 13 lines
Subject: Re: [PATCH 1/3] net/iavf: downgrade opcode 0 ARQ log to debug
Quoted 10 lines · Ciara Loftus
From: Talluri Chaitanyababu <[email protected]>
After admin queue reinitialisation, completions from uninitialised ARQ ring descriptor memory may arrive before any real PF response. These carry opcode 0 (
VIRTCHNL_OP_UNKNOWN) and trigger a WARNING log on every poll iteration, flooding the log during reset recovery.Treat opcode 0 as a distinct case and log it at DEBUG level, while retaining WARNING for genuine opcode mismatches.
Quoted 6 lines
Quoted 5 lines
Signed-off-by Talluri Chaitanyababu <[email protected]>--- drivers/net/intel/iavf/iavf_vchnl.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)Should this be backported as a bugfix?
The issue has been present since the driver was added, but only triggered in practise more recently with the addition of the reset logic.
I think this tag can be added:
Quoted 4 lines
Fixes 2d23ed74c079 ("net/iavf: enable iavf PMD")Let me know if you need a respin.
Sorry, never waited for your reply before applying patch, and has already been pulled to main. Since the issue only recent appears we are probably ok without backport then. If you think it needs it, I suggest sending an extra copy of this patch to stable, so that it can be added to the list there.
/Bruce
PATCH 2/3 net/iavf: wait for PF reset start before reinitializing
In reply to Ciara LoftusCommit 1428895ad417 ("net/iavf: fix disabling of promiscuous modes on close") added a synchronous VIRTCHNL round-trip on the close path before the reset request is sent. This delays the reset just long enough that IAVF_VFGEN_RSTAT still reads VIRTCHNL_VFR_VFACTIVE when the re-init path polls it for reset completion. The driver interprets this as the reset being complete, when in fact it has not yet started, and proceeds to issue VIRTCHNL commands before the PF has disabled the VF mailbox.
Fix by polling IAVF_VF_ARQLEN1.ARQENABLE immediately after the reset request and before shutting down the admin queue, when the close is triggered by a reset. The PF clears this bit as its first reset action, providing an unambiguous signal that the reset is in progress.
--- drivers/net/intel/iavf/iavf.h | 1 + drivers/net/intel/iavf/iavf_ethdev.c | 12 ++++++++++++ 2 files changed, 13 insertions(+)
drivers/net/intel/iavf/iavf.h +1 -0
@@ -291,6 +291,7 @@ struct iavf_info {struct rte_eth_dev *eth_dev;bool in_reset_recovery; +bool reset_pending;uint32_t ptp_caps;rte_spinlock_t phc_time_aq_lock;
drivers/net/intel/iavf/iavf_ethdev.c +12 -0
@@ -106,6 +106,7 @@ static int iavf_dev_start(struct rte_eth_dev *dev);static int iavf_dev_stop (struct rte_eth_dev *dev);static int iavf_dev_close (struct rte_eth_dev *dev);static int iavf_dev_reset (struct rte_eth_dev *dev); +static bool iavf_is_reset_detected (struct iavf_adapter *adapter);static int iavf_dev_info_get (struct rte_eth_dev *dev,struct rte_eth_dev_info *dev_info); static const uint32_t *iavf_dev_supported_ptypes_get(struct rte_eth_dev *dev,
@@ -3196,6 +3197,14 @@ iavf_dev_close(struct rte_eth_dev *dev)iavf_flow_uninit (adapter);iavf_vf_reset (hw); +/* +* If a reset is pending, wait for the PF to disable the VF's admin +* receive queue (its first reset action) before we shut it down +* ourselves. This ensures iavf_check_vf_reset_done() does not see +* a stale VFACTIVE value on the re-init path. +*/ +if (vf->reset_pending) +iavf_is_reset_detected (adapter); vf->aq_intr_enabled = false;iavf_shutdown_adminq (hw);if (vf->vf_res->vf_cap_flags &VIRTCHNL_VF_OFFLOAD_WB_ON_ITR ) {
@@ -3273,6 +3282,7 @@ iavf_dev_reset(struct rte_eth_dev *dev)struct iavf_adapter *adapter =IAVF_DEV_PRIVATE_TO_ADAPTER (dev->data->dev_private);struct iavf_hw *hw =IAVF_DEV_PRIVATE_TO_HW (dev->data->dev_private); +struct iavf_info *vf =IAVF_DEV_PRIVATE_TO_VF (dev->data->dev_private);/* * Check whether the VF reset has been done and inform application, * to avoid calling the virtual channel command, which may cause
@@ -3285,8 +3295,10 @@ iavf_dev_reset(struct rte_eth_dev *dev) }iavf_set_no_poll (adapter, false); + vf->reset_pending = true;PMD_DRV_LOG (DEBUG ,"Start dev_reset ..." ); ret =iavf_dev_uninit (dev); + vf->reset_pending = false;if (ret)return ret;
Signature · 1 line
2.43.0
PATCH 3/3 net/iavf: fix event handler refcount leak on HW reset
In reply to Ciara LoftusCurrently, when handling a hardware reset, the uninit path skips releasing the event handler reference while in_reset_recovery is set, to prevent premature teardown of the event handler thread. However, the subsequent re-init call unconditionally increments the reference count, inflating ndev on every reset cycle. On the final device removal, the count never reaches zero and the event handler thread is never joined.
Fix it by also skipping the event handler reference acquisition during reset recovery, matching the symmetric skip in the uninit path so the count stays stable across each reset cycle.
--- drivers/net/intel/iavf/iavf_ethdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/intel/iavf/iavf_ethdev.c +1 -1
@@ -3031,7 +3031,7 @@ iavf_dev_init(struct rte_eth_dev *eth_dev) adapter->tpid =RTE_ETHER_TYPE_VLAN ;/* VLAN TPID set to 0x8100 by default */ rte_spinlock_init (&adapter->phc_sync_lock); -if (iavf_dev_event_handler_init ()) +if (!vf->in_reset_recovery &&iavf_dev_event_handler_init ()) goto init_vf_err;if (iavf_init_vf (eth_dev) !=0 ) {
Signature · 1 line
2.43.0
Quoted 14 lines · Ciara Loftus
The patch [1] aimed to address a race condition in the iavf driver during a reset and also reduced noisy logging during resets. Patch 1 of this series extracts the noisy logging fix into its own commit.
Patch 2 offers an alternative approach to fixing the race condition. Patch 3 fixes a pre-existing refcount imbalance in the shared event handler thread that became visible while investigating the reset path.[1] https://patches.dpdk.org/project/dpdk/patch/[email protected]/
Ciara Loftus (2):
net/iavf: wait for PF reset start before reinitializing net/iavf: fix event handler refcount leak on HW reset
Quoted 8 lines
Talluri Chaitanyababu (1):
net/iavf: downgrade opcode 0 ARQ log to debugdrivers/net/intel/iavf/iavf.h | 1 + drivers/net/intel/iavf/iavf_ethdev.c | 14 +++++++++++++- drivers/net/intel/iavf/iavf_vchnl.c | 11 +++++++++-- 3 files changed, 23 insertions(+), 3 deletions(-)
Series applied to dpdk-next-net-intel.
Thanks,
/Bruce