From: netdev-bot+sashiko@kernel.org
To: przemyslaw.kitszel@intel.com
Cc: netdev@vger.kernel.org, kuba@kernel.org, jiri@resnulli.us,
anthony.l.nguyen@intel.com, aleksandr.loktionov@intel.com,
mschmidt@redhat.com, edumazet@kernel.org, horms@kernel.org,
pabeni@redhat.com, davem@davemloft.net, corbet@lwn.net,
skhan@linuxfoundation.org, rdunlap@infradead.org,
andrew+netdev@lunn.ch, saeedm@nvidia.com, tariqt@nvidia.com,
leon@kernel.org, mbloch@nvidia.com, jacob.e.keller@intel.com,
jedrzej.jagielski@intel.com, anzaki@gmail.com,
brett.creeley@amd.com, ohartoov@nvidia.com, poros@redhat.com,
donald.hunter@gmail.com
Subject: Re: [PATCH net-next v7 01/15] iavf: keep RSS config across resets
Date: Tue, 24 Nov 2026 21:57:24 +0000 [thread overview]
Message-ID: <179555744418.3135.2924449587168522535@kernel.org> (raw)
In-Reply-To: <20261121230123.316391-2-przemyslaw.kitszel@intel.com>
Thank you for your contribution! Sashiko AI review found 6 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 4 · Low: 2
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] The aq_wait_count fix is incomplete.
- [Medium] When the RSS buffer reallocation in
iavf_parse_vf_resource_msg() fails, the RSS buffers and…
- [Medium] While init retries with the netdev registered, adapter->vf_res
is zeroed.
- [Medium] iavf: premature ethtool_rxfh_indir_lost() broadcasts zeroed
LUT on reinit
- [Low] This commit fixes several pre-existing bugs without a Fixes: tag,
and bundles them with a new feature, so the fixes cannot be backported…
- [Low] The new iavf_init_rss() call in the size-change branch of
iavf_parse_vf_resource_msg() (iavf_main.c:2600) skips the RSS_AQ…
--
iavf: keep RSS config across resets
This commit keeps the user-set RSS key and LUT across VF resets. When the
PF reports a different key or LUT size, it reallocates both and folds the
LUT, and it reinits the queues when the PF cuts the queue count. It also
fixes the RSS buffer leak on reinit after iavf_disable_vf(), keeps vf_res
allocated on a failed resources message, checks what
iavf_parse_vf_resource_msg() returns, and resets aq_wait_count.
> Most of these issues are old and affect every PF, but are rarely hit.
> The rest of this series makes them common: the VF is reset on each
> change of its RSS LUT via devlink, and on init, after iavf asks the PF
> for more queues and waits for them in __IAVF_INIT_FAILED. Hence fix
> them first.
[Severity: Low]
This isn't a bug, but could the standalone fixes be split into their own
patches, each with a Fixes: tag? As far as I can tell, this commit fixes
several old bugs:
- the rss_key/rss_lut leak when iavf_init_config_adapter() allocates them
again on reinit after iavf_disable_vf()
- the NULL adapter->vf_res left by the err_alloc path of
iavf_init_get_resources() while the netdev stays registered; ethtool ops
dereference it through RSS_PF(), ADV_RSS_SUPPORT() and
LARGE_NUM_QPAIRS_SUPPORT()
- aq_wait_count never being reset
- the ignored return value of iavf_parse_vf_resource_msg() in
iavf_virtchnl_completion()
They are bundled with the new RSS preservation feature
(IAVF_FLAG_RSS_LUT_LOST, the LUT resize, the reset on a queue cut) and
have no Fixes: tags. Stable kernels would not pick up the leak and NULL
dereference fixes this way.
> diff --git a/drivers/net/ethernet/intel/iavf/iavf_main.c b/drivers/net/ethernet/intel/iavf/iavf_main.c
> index 4de3ea8525b3f..c7b12de63c2f5 100644
> --- a/drivers/net/ethernet/intel/iavf/iavf_main.c
> +++ b/drivers/net/ethernet/intel/iavf/iavf_main.c
[ ... ]
> @@ -2494,11 +2562,45 @@ int iavf_parse_vf_resource_msg(struct iavf_adapter *adapter)
> vsi->netdev = adapter->netdev;
> vsi->qs_handle = adapter->vsi_res->qset_handle;
> if (adapter->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_RSS_PF) {
> - adapter->rss_key_size = adapter->vf_res->rss_key_size;
> - adapter->rss_lut_size = adapter->vf_res->rss_lut_size;
> + key_size = adapter->vf_res->rss_key_size;
> + lut_size = adapter->vf_res->rss_lut_size;
> + } else {
> + key_size = IAVF_HKEY_ARRAY_SIZE;
> + lut_size = IAVF_HLUT_ARRAY_SIZE;
> + }
> +
> + if ((adapter->rss_key && adapter->rss_key_size != key_size) ||
> + (adapter->rss_lut && adapter->rss_lut_size != lut_size)) {
> + u8 *rss_key, *rss_lut;
> +
> + rss_key = kzalloc(key_size, GFP_KERNEL);
> + rss_lut = kzalloc(lut_size, GFP_KERNEL);
> + if (!rss_lut || !rss_key ||
> + iavf_rss_lut_resize(adapter, rss_lut, lut_size)) {
> + kfree(rss_key);
> + kfree(rss_lut);
> + /* old buffers and sizes are kept, retry via reset */
> + iavf_schedule_reset(adapter, IAVF_FLAG_RESET_NEEDED);
> + return -ENOMEM;
> + }
[Severity: Medium]
Can this failure path leave the RSS sizes out of step with the
capabilities in adapter->vf_res?
When this runs, iavf_virtchnl_completion() has already copied the new
reply into adapter->vf_res. RSS_PF(), RSS_AQ() and RSS_REG() therefore
follow the new vf_cap_flags, but rss_key_size and rss_lut_size keep their
old PF-reported values.
Suppose the old negotiation had RSS_PF with a LUT larger than 64 bytes
(512 or 2048, which ice gives VFs later in this series) and the new reply
drops RSS_PF. Until reset_task runs, an ethtool -X would go:
iavf_set_rxfh()
iavf_config_rss()
iavf_config_rss_reg()
which does:
dw = (u32 *)adapter->rss_lut;
for (i = 0; i < adapter->rss_lut_size / 4; i++)
wr32(hw, IAVF_VFQF_HLUT(i), dw[i]);
IAVF_VFQF_HLUT() only has indexes 0..IAVF_VFQF_HLUT_MAX_INDEX (15).
Would the 128 or 512 writes land past 0xD03C, in other VF BAR registers?
With RSS_AQ, iavf_config_rss_aq() casts rss_key to a fixed-size
struct iavf_aqc_get_set_rss_key_data. Could that read past the end of the
old key buffer if the old key was shorter?
This needs a small GFP_KERNEL allocation to fail, so it is unlikely to
trigger.
> +
> + if (adapter->rss_key_size == key_size)
> + memcpy(rss_key, adapter->rss_key, key_size);
> + else
> + netdev_rss_key_fill(rss_key, key_size);
> +
[ ... ]
> + adapter->rss_lut_size = lut_size;
> + /* no queues yet on init, iavf_init_config_adapter() sets RSS */
> + if (adapter->state != __IAVF_INIT_GET_RESOURCES)
> + iavf_init_rss(adapter);
[Severity: Medium]
Can this notification go out before the new LUT has any content?
On reinit after iavf_disable_vf() the netdev stays registered, and the
RSS buffers are now kept. So iavf_parse_vf_resource_msg() can run from
iavf_init_get_resources() with adapter->state set to
__IAVF_INIT_GET_RESOURCES and an old rss_lut_size. Suppose the PF
reports a different LUT size and ethtool_rxfh_indir_can_resize()
returns false. Then iavf_rss_lut_resize() leaves the kzalloc()ed
rss_lut all zeros and calls iavf_rss_lut_lost(), which queues
finish_config right away.
iavf_parse_vf_resource_msg() then installs the zeroed buffer as
adapter->rss_lut. It skips iavf_init_rss() because there are no queues
yet. The LUT is only filled later, by iavf_init_config_adapter(), and
that is several watchdog steps away: __IAVF_INIT_EXTENDED_CAPS comes
first, and the watchdog runs as delayed work.
iavf_finish_config() only needs rtnl and the netdev lock, so it can run
in that window. It clears IAVF_FLAG_RSS_LUT_LOST and calls
ethtool_rxfh_indir_lost(). As far as I can tell, that sends an RSS
notification which reads the table back through iavf_get_rxfh(). If so,
userspace is told that every entry of the new table points at queue 0.
When iavf_init_config_adapter() later programs the default spread,
nothing sends a second notification, so the reported table stays
wrong.
Outside init this does not happen, because iavf_init_rss() fills the
new buffer right after the swap, in the same call.
Would it be enough to only set IAVF_FLAG_RSS_LUT_LOST while in
__IAVF_INIT_GET_RESOURCES? The iavf_schedule_finish_config() call at
the end of iavf_init_config_adapter() could then report the loss once
the default LUT is in place.
[Severity: Low]
Should this call handle RSS_AQ the way the other callers do? Both
iavf_init_config_adapter() and iavf_reset_step() defer it:
if (RSS_AQ(adapter)) {
adapter->aq_required |= IAVF_FLAG_AQ_CONFIGURE_RSS;
} else {
err = iavf_init_rss(adapter);
if (err)
goto reset_err;
}
Outside init, this code runs from the VIRTCHNL_OP_GET_VF_RESOURCES case
of iavf_virtchnl_completion(), where current_op is still
VIRTCHNL_OP_GET_VF_RESOURCES.
The commit message names a PF that stops offering RSS_PF as one of the
cases this patch handles. If such a PF grants RSS_AQ instead,
iavf_init_rss()->iavf_config_rss()->iavf_config_rss_aq() will always hit:
if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) {
/* bail because we already have a command pending */
dev_err(&adapter->pdev->dev, "Cannot configure RSS, command %d pending\n",
adapter->current_op);
return -EBUSY;
}
The -EBUSY is ignored here, while iavf_reset_step() treats an
iavf_init_rss() error as reset_err.
The deferred IAVF_FLAG_AQ_CONFIGURE_RSS handler in
iavf_process_aq_command() only clears the flag, so the end result matches
the other call sites. What this call adds is an error log that always
fires and a failure that is silently dropped.
[ ... ]
> @@ -2563,8 +2665,8 @@ static void iavf_init_get_resources(struct iavf_adapter *adapter)
> return;
>
> err_alloc:
> - kfree(adapter->vf_res);
> - adapter->vf_res = NULL;
> + /* keep it allocated, ethtool ops may run on reinit */
> + memset(adapter->vf_res, 0, IAVF_VIRTCHNL_VF_RESOURCE_SIZE);
[Severity: Medium]
With vf_res zeroed while the netdev is registered, RSS_PF() and RSS_AQ()
both return false. iavf_set_rxfh() has no adapter->state check, so can it
end up writing the RSS registers directly?
iavf_set_rxfh()
iavf_config_rss()
iavf_config_rss_reg()
iavf_config_rss_reg() writes rss_key_size/4 dwords to IAVF_VFQF_HKEY(i)
and rss_lut_size/4 dwords to IAVF_VFQF_HLUT(i). The RSS buffers and sizes
are now kept across reinit, so these are the PF-negotiated sizes from the
last successful init.
The HLUT register file has 16 entries (IAVF_VFQF_HLUT_MAX_INDEX is 15).
Later in this series ice gives VFs 512 or 2048 entry LUTs under RSS_PF.
Would that mean 128 or 512 writes, reaching 0xD7FC?
Even when the sizes are in range, this writes RSS registers directly on a
VF whose RSS is managed by the PF, and ethtool is told it succeeded.
iavf_disable_vf() already zeroed vf_res like this before this patch. This
change adds a second such window and keeps the large sizes alive across
both.
> err:
> iavf_change_state(adapter, __IAVF_INIT_FAILED);
> }
[ ... ]
> @@ -2967,6 +3073,7 @@ static int iavf_watchdog_step(struct iavf_adapter *adapter)
> */
> iavf_change_state(adapter, __IAVF_STARTUP);
> adapter->flags &= ~IAVF_FLAG_PF_COMMS_FAILED;
> + adapter->aq_wait_count = 0;
> }
[Severity: Medium]
Does this fully fix what the commit message describes?
"It was never reset, so once it reached IAVF_AQ_MAX_ERR, the first wait
for a PF reply sent init back to __IAVF_COMM_FAILED."
The new reset only runs in the __IAVF_COMM_FAILED recovery branch, which
is after the limit has already been hit. The only other place that
touches the counter is the __IAVF_INIT_FAILED case:
if (++adapter->aq_wait_count > IAVF_AQ_MAX_ERR) {
Nothing resets it when init makes progress or completes. Nothing resets
it when iavf_reset_step() restarts init either:
if (adapter->state <= __IAVF_INIT_FAILED) {
iavf_shutdown_adminq(hw);
iavf_change_state(adapter, __IAVF_STARTUP);
iavf_startup(adapter);
...
So the counter still adds up every __IAVF_INIT_FAILED visit, not just
consecutive failures, and several ordinary waits end up there:
- each extended caps RECV step polls the ARQ without blocking, shortly
after its SEND
- GET_RESOURCES and VERSION_CHECK polls that run before the PF reply
arrives
- later in this series, init also waits there for the reset that grants
the queue request
Once the total passes IAVF_AQ_MAX_ERR (20), won't init still set
IAVF_FLAG_PF_COMMS_FAILED, shut down the admin queue and restart from
__IAVF_STARTUP, even though the PF answered every request?
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261121230123.316391-1-przemyslaw.kitszel%40intel.com
next prev parent reply other threads:[~2026-11-24 21:57 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-21 22:55 [PATCH net-next v7 00/15] devlink, mlx5, iavf, ice: XLVF for iavf Przemek Kitszel
2026-11-21 22:55 ` [PATCH net-next v7 01/15] iavf: keep RSS config across resets Przemek Kitszel
2026-11-24 21:57 ` netdev-bot+sashiko [this message]
2026-11-21 22:55 ` [PATCH net-next v7 02/15] ice: prepare RSS LUT config for runtime LUT changes Przemek Kitszel
2026-11-24 21:57 ` netdev-bot+sashiko
2026-11-21 22:55 ` [PATCH net-next v7 03/15] ice: add VF queue ena/dis helper functions Przemek Kitszel
2026-11-21 22:55 ` [PATCH net-next v7 04/15] ice: add helpers for Global RSS LUT alloc, free, vsi_update Przemek Kitszel
2026-11-24 21:57 ` netdev-bot+sashiko
2026-11-21 22:55 ` [PATCH net-next v7 05/15] ice: rename ICE_MAX_RSS_QS_PER_VF to ICE_MAX_QS_PER_VF_VCV1 Przemek Kitszel
2026-11-21 22:55 ` [PATCH net-next v7 06/15] ice: bump to 256qs for VF Przemek Kitszel
2026-11-24 21:57 ` netdev-bot+sashiko
2026-11-21 22:55 ` [PATCH net-next v7 07/15] iavf: extend iavf_configure_queues() to support more queues Przemek Kitszel
2026-11-21 22:55 ` [PATCH net-next v7 08/15] iavf: temporary rename of IAVF_MAX_REQ_QUEUES to IAVF_MAX_REQ_QUEUES_VCV1 Przemek Kitszel
2026-11-21 22:55 ` [PATCH net-next v7 09/15] iavf: increase max number of queues to 256 Przemek Kitszel
2026-11-24 21:57 ` netdev-bot+sashiko
2026-11-21 22:55 ` [PATCH net-next v7 10/15] iavf: use new opcodes to request more than 16 queues Przemek Kitszel
2026-11-24 21:57 ` netdev-bot+sashiko
2026-11-21 22:55 ` [PATCH net-next v7 11/15] ice: introduce handling of virtchnl LARGE VF opcodes Przemek Kitszel
2026-11-24 21:57 ` netdev-bot+sashiko
2026-11-21 22:55 ` [PATCH net-next v7 12/15] devlink: add cmode to resources Przemek Kitszel
2026-11-24 21:57 ` netdev-bot+sashiko
2026-11-21 22:55 ` [PATCH net-next v7 13/15] ice: represent RSS LUTs as devlink resources Przemek Kitszel
2026-11-24 21:57 ` netdev-bot+sashiko
2026-11-21 22:55 ` [PATCH net-next v7 14/15] devlink: add devlink_alloc_drv() Przemek Kitszel
2026-11-21 22:55 ` [PATCH net-next v7 15/15] ice: support up to 256 VF queues Przemek Kitszel
2026-11-24 21:57 ` netdev-bot+sashiko
2026-11-23 8:53 ` [PATCH net-next v7 00/15] devlink, mlx5, iavf, ice: XLVF for iavf Matthieu Baerts
2026-11-23 15:03 ` Przemek Kitszel
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=179555744418.3135.2924449587168522535@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=aleksandr.loktionov@intel.com \
--cc=andrew+netdev@lunn.ch \
--cc=anthony.l.nguyen@intel.com \
--cc=anzaki@gmail.com \
--cc=brett.creeley@amd.com \
--cc=corbet@lwn.net \
--cc=davem@davemloft.net \
--cc=donald.hunter@gmail.com \
--cc=edumazet@kernel.org \
--cc=horms@kernel.org \
--cc=jacob.e.keller@intel.com \
--cc=jedrzej.jagielski@intel.com \
--cc=jiri@resnulli.us \
--cc=kuba@kernel.org \
--cc=leon@kernel.org \
--cc=mbloch@nvidia.com \
--cc=mschmidt@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=ohartoov@nvidia.com \
--cc=pabeni@redhat.com \
--cc=poros@redhat.com \
--cc=przemyslaw.kitszel@intel.com \
--cc=rdunlap@infradead.org \
--cc=saeedm@nvidia.com \
--cc=skhan@linuxfoundation.org \
--cc=tariqt@nvidia.com \
/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