From: Jakub Kicinski <kuba@kernel.org>
To: anthony.l.nguyen@intel.com
Cc: Jakub Kicinski <kuba@kernel.org>,
davem@davemloft.net, pabeni@redhat.com, edumazet@google.com,
andrew+netdev@lunn.ch, netdev@vger.kernel.org,
jtornosm@redhat.com, przemyslaw.kitszel@intel.com,
jacob.e.keller@intel.com, aleksandr.loktionov@intel.com,
sdf@fomichev.me, horms@kernel.org, stable@vger.kernel.org,
rafal.romanowski@intel.com
Subject: Re: [PATCH net 1/4] iavf: return EBUSY if reset in progress or not ready during MAC change
Date: Mon, 24 Aug 2026 12:01:45 -0700 [thread overview]
Message-ID: <20260824190145.2714480-1-kuba@kernel.org> (raw)
In-Reply-To: <20260821204537.2189112-2-anthony.l.nguyen@intel.com>
This is an AI-generated review of your patch. The human sending this
email has considered the AI review valid, or at least plausible.
---
iavf: return EBUSY if reset in progress or not ready during MAC change
This adds an early bail-out to iavf_set_mac() so that a MAC address change
returns -EBUSY when a reset is in progress or when the VF has not yet
reached __IAVF_DOWN. The stated motivation is to avoid waiting inside the
ndo callback while the netdev instance lock is held.
No Link: tags present in the commit header.
A couple of questions below, one about the commit message and one about the
new check itself.
> After commit ad7c7b2172c3 ("net: hold netdev instance lock
> during sysfs operations"), MAC changes are called with the netdev lock
> held, so we should not wait with the lock held during reset or
> initialization.
[Severity: Low]
This paragraph describes a user-visible behaviour change caused by
ad7c7b2172c3, but there is no Fixes: tag on this commit. Was that
intentional?
Worth noting that this commit does not actually remove the wait under the
netdev instance lock: after this patch iavf_set_mac() still calls
ret = wait_event_interruptible_timeout(adapter->vc_waitqueue,
iavf_is_mac_set_handled(netdev, addr->sa_data),
msecs_to_jiffies(2500));
so a Fixes: ad7c7b2172c3 here would arguably be misleading. The later
patch in the same series, "iavf: send MAC change request synchronously",
does carry Fixes: ad7c7b2172c3 and cc: stable, which looks like the right
place for the provenance. Is that the intended split?
> diff --git a/drivers/net/ethernet/intel/iavf/iavf_main.c b/drivers/net/ethernet/intel/iavf/iavf_main.c
> index 29b8403a066b..630388e9d28c 100644
> --- a/drivers/net/ethernet/intel/iavf/iavf_main.c
> +++ b/drivers/net/ethernet/intel/iavf/iavf_main.c
> @@ -1042,6 +1042,9 @@ static int iavf_set_mac(struct net_device *netdev, void *p)
> struct sockaddr *addr = p;
> int ret;
>
> + if (iavf_is_reset_in_progress(adapter) || adapter->state < __IAVF_DOWN)
> + return -EBUSY;
> +
[Severity: Low]
Is this check-then-act sequence racy against the reset scheduling path?
iavf_is_reset_in_progress() does plain reads of adapter->state and
adapter->flags:
static bool iavf_is_reset_in_progress(struct iavf_adapter *adapter)
{
if (adapter->state == __IAVF_RESETTING ||
adapter->flags & (IAVF_FLAG_RESET_PENDING |
IAVF_FLAG_RESET_NEEDED))
return true;
return false;
}
IAVF_FLAG_RESET_NEEDED can be set from a context that does not hold the
netdev instance lock:
dev_watchdog()
netif_freeze_queues(dev);
dev->netdev_ops->ndo_tx_timeout(dev, i); /* timer context */
iavf_tx_timeout()
iavf_schedule_reset(adapter, IAVF_FLAG_RESET_NEEDED)
adapter->flags |= flags; /* non-atomic RMW */
net/sched/sch_generic.c only freezes the TX queues around ndo_tx_timeout(),
so there does not appear to be anything serializing that writer against
iavf_set_mac(). If the TX timeout fires just after the new test, does
iavf_set_mac() go on to the 2.5 s wait_event_interruptible_timeout() with
the netdev instance lock held anyway, i.e. exactly the case the check is
meant to reject?
The window is small and the fallback is the pre-patch behaviour (blocked
for up to 2.5 s, then -EAGAIN), so this looks like a best-effort guard
rather than a new failure mode. Is that the intent, or should the state
and flags reads be done under the same serialization as the reset path
(and with READ_ONCE(), given the concurrent non-atomic |= on
adapter->flags)?
next prev parent reply other threads:[~2026-08-24 19:01 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-21 20:45 [PATCH net 0/4][pull request] Fix i40e/ice/iavf VF bonding after netdev lock changes Tony Nguyen
2026-08-21 20:45 ` [PATCH net 1/4] iavf: return EBUSY if reset in progress or not ready during MAC change Tony Nguyen
2026-08-24 19:01 ` Jakub Kicinski [this message]
2026-08-21 20:45 ` [PATCH net 2/4] i40e: skip unnecessary VF reset when setting trust Tony Nguyen
2026-08-24 19:01 ` Jakub Kicinski
2026-08-21 20:45 ` [PATCH net 3/4] iavf: send MAC change request synchronously Tony Nguyen
2026-08-24 19:01 ` Jakub Kicinski
2026-08-21 20:45 ` [PATCH net 4/4] ice: skip unnecessary VF reset when setting trust Tony Nguyen
2026-08-24 19:01 ` Jakub Kicinski
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=20260824190145.2714480-1-kuba@kernel.org \
--to=kuba@kernel.org \
--cc=aleksandr.loktionov@intel.com \
--cc=andrew+netdev@lunn.ch \
--cc=anthony.l.nguyen@intel.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=jacob.e.keller@intel.com \
--cc=jtornosm@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=przemyslaw.kitszel@intel.com \
--cc=rafal.romanowski@intel.com \
--cc=sdf@fomichev.me \
--cc=stable@vger.kernel.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 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.