[PATCH v2 3/3] net/iavf: fix watchdog clearing reset state during recovery
Bruce Richardson
bruce.richardson at intel.com
Wed Nov 4 19:00:22 CET 2026
On Wed, Nov 04, 2026 at 09:55:09AM +0000, Ciara Loftus wrote:
> Since the watchdog is kept armed across a PF reset, it can clear
> vf_reset while the reset event is still queued or being handled, as
> VFGEN_RSTAT toggles while the PF resets the VF. iavf_dev_close() then
> skips re-enabling PCI bus mastering, which the VF reset cleared, so
> VIRTCHNL_OP_VERSION never reaches the PF, iavf_dev_init() fails and the
> port is left returning -EIO. Each toggle also posts a further reset
> event, causing redundant recovery cycles.
>
> Count reset events from before vf_reset is set until they have been
> handled, and do not let the watchdog clear vf_reset while any are
> outstanding.
>
> Fixes: a0e296420a70 ("net/iavf: keep watchdog armed for the whole reset window")
> Cc: stable at dpdk.org
>
> Suggested-by: Declan Doherty <declan.doherty at intel.com>
> Signed-off-by: Ciara Loftus <ciara.loftus at intel.com>
> ---
> drivers/net/intel/iavf/iavf.h | 4 ++-
> drivers/net/intel/iavf/iavf_ethdev.c | 16 +++++++---
> drivers/net/intel/iavf/iavf_vchnl.c | 48 ++++++++++++++++++++--------
> 3 files changed, 48 insertions(+), 20 deletions(-)
>
While the AI review in CI shows no issues, my own AI review flags that
there is potentially a problem due to vf_reset not being declared atomic.
/Bruce
---
The producer and watchdog can run concurrently: the PF reset path handles
messages in the interrupt callback (iavf_ethdev.c:2847), while the watchdog
runs separately.
A concrete interleaving is:
1. The event path increments reset_events_pending, executes the release
fence, then writes vf_reset = true (iavf_vchnl.c:349).
2. The watchdog reads vf_reset as true, checks that hardware reset is no
longer in progress, then loads reset_events_pending (iavf_ethdev.c:338).
3. That acquire load is allowed to observe the old zero value: it
synchronizes with the increment only if it reads from that increment. The
plain vf_reset read does not provide the atomic synchronization, because
the field is still declared as bool (iavf.h:264). The watchdog can
therefore clear vf_reset while the reset event remains pending, which is
exactly the state this commit aims to prevent. The release/acquire fences
don’t fix this: they do not make the plain flag accesses atomic or
guarantee that observing the flag publishes the counter.
The fix should make vf_reset atomic and use atomic release stores/acquire
loads consistently at its concurrent access sites.
More information about the stable
mailing list