Netdev List
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: przemyslaw.kitszel@intel.com
Cc: netdev@vger.kernel.org, kuba@kernel.org,
	anthony.l.nguyen@intel.com, aleksandr.loktionov@intel.com,
	mschmidt@redhat.com, edumazet@kernel.org, horms@kernel.org,
	pabeni@redhat.com, davem@davemloft.net, jiri@resnulli.us,
	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
Subject: Re: [PATCH net-next v5 07/15] iavf: extend iavf_configure_queues() to support more queues
Date: Thu, 12 Nov 2026 23:07:34 +0000	[thread overview]
Message-ID: <179452485428.2199510.11578630824061191353@kernel.org> (raw)
In-Reply-To: <20261110141534.95614-8-przemyslaw.kitszel@intel.com>

Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 1

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] iavf_suspend() can let the multi-message CONFIG_VSI_QUEUES
  sequence carry on after DISABLE_QUEUES, then dereference a freed Rx…
- [Low] The kernel-doc of iavf_configure_queues()
  (drivers/net/ethernet/intel/iavf/iavf_virtchnl.c) still says "Request…

--

iavf: extend iavf_configure_queues() to support more queues

This patch changes iavf_configure_queues() to send, on each call, only
as many queue pairs as fit into one virtchnl message. It tracks how far
it got in adapter->cfg_qps_sent and keeps IAVF_FLAG_AQ_CONFIGURE_QUEUES
set until every pair has been sent. A PF NACK clears the flag so the
remaining pairs are not sent.

> diff --git a/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c b/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c
> index e6b7e8f82c7c1..356565aa41c8c 100644
> --- a/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c
> +++ b/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c

[ ... ]

> @@ -375,11 +380,12 @@ int iavf_get_vf_ptp_caps(struct iavf_adapter *adapter)
>  void iavf_configure_queues(struct iavf_adapter *adapter)
>  {
>  	struct virtchnl_vsi_queue_config_info *vqci;
> -	int pairs = adapter->num_active_queues;
>  	struct virtchnl_queue_pair_info *vqpi;
> +	int first = adapter->cfg_qps_sent;

[Severity: Low]
This isn't a bug, but the kernel-doc above this function still reads:

 * Request that the PF set up our (previously allocated) queues.

The function now has a different contract:

- Each call sends one chunk, starting at cfg_qps_sent.
- It depends on iavf_process_aq_command() calling it again until
  cfg_qps_sent == num_active_queues.
- The caller has to zero cfg_qps_sent before setting
  IAVF_FLAG_AQ_CONFIGURE_QUEUES. Today only iavf_configure() does that.

Could the kernel-doc be updated to describe this?

>  	u32 i, max_frame;
>  	u8 rx_flags = 0;
>  	size_t len;
> +	int pairs;
>  
>  	max_frame = LIBIE_MAX_RX_FRM_LEN(adapter->rx_rings->pp->p.offset);

[ ... ]

> @@ -425,7 +430,9 @@ void iavf_configure_queues(struct iavf_adapter *adapter)
>  		vqpi++;
>  	}
>  
> -	adapter->aq_required &= ~IAVF_FLAG_AQ_CONFIGURE_QUEUES;
> +	adapter->cfg_qps_sent += pairs;
> +	if (adapter->cfg_qps_sent == adapter->num_active_queues)
> +		adapter->aq_required &= ~IAVF_FLAG_AQ_CONFIGURE_QUEUES;

[Severity: Medium]
IAVF_FLAG_AQ_CONFIGURE_QUEUES now stays set across several watchdog runs.
What happens if iavf_suspend() runs while some chunks are still pending?

iavf_close() masks aq_required down to IAVF_FLAG_AQ_GET_CONFIG before it
calls iavf_down(). iavf_reset_step() masks it down to
IAVF_FLAG_AQ_REQUEST_QUEUES. Both of those drop the leftover flag.

iavf_suspend() calls iavf_down() directly:

iavf_suspend()
  iavf_down()
    adapter->current_op = VIRTCHNL_OP_UNKNOWN;
    ...
    iavf_schedule_aq_request(adapter, IAVF_FLAG_AQ_DISABLE_QUEUES);

On this path neither IAVF_FLAG_AQ_CONFIGURE_QUEUES nor cfg_qps_sent is
cleared, and the state stays __IAVF_RUNNING.

The watchdog sends DISABLE_QUEUES first. The late reply to the cancelled
CONFIG chunk goes through the default branch of
iavf_virtchnl_completion(). That clears current_op while DISABLE is
still outstanding, so the next CONFIG chunk can reach the PF after
DISABLE.

On the PF side, ice_vc_cfg_qs_msg() programs the Tx/Rx queue contexts
from each message independently. It uses ring DMA addresses that iavf
frees with dma_free_coherent() when the DISABLE reply arrives.

Once that reply has run iavf_free_all_rx_resources(), rx_ring->pp is
NULL. If the flag is still set, the next watchdog run calls
iavf_configure_queues(), which dereferences pp before any check:

	max_frame = LIBIE_MAX_RX_FRM_LEN(adapter->rx_rings->pp->p.offset);

Could this leave the PF holding queue contexts that point at freed DMA
memory, and then oops on the NULL rx_rings->pp?

This needs more than 62 queue pairs, which becomes possible later in the
series with IAVF_MAX_REQ_QUEUES = 256. Before this patch the flag was
cleared when the single message went out, so the window only lasted
until the first watchdog send.

Should iavf_down() or iavf_suspend() clear IAVF_FLAG_AQ_CONFIGURE_QUEUES
and cfg_qps_sent?

>  	iavf_send_pf_msg(adapter, VIRTCHNL_OP_CONFIG_VSI_QUEUES,
>  			 (u8 *)vqci, len);
>  	kfree(vqci);

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261110141534.95614-1-przemyslaw.kitszel%40intel.com

  reply	other threads:[~2026-11-12 23:07 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-10 14:07 [PATCH net-next v5 00/15] devlink, mlx5, iavf, ice: XLVF for iavf Przemek Kitszel
2026-11-10 14:07 ` [PATCH net-next v5 01/15] devlink, mlx5: add init/fini ops for shared devlink Przemek Kitszel
2026-11-10 14:47   ` Jiri Pirko
2026-11-10 14:07 ` [PATCH net-next v5 02/15] ice: use shared devlink to store ice_adapters instead of custom xarray Przemek Kitszel
2026-11-10 14:07 ` [PATCH net-next v5 03/15] ice: add VF queue ena/dis helper functions Przemek Kitszel
2026-11-10 14:07 ` [PATCH net-next v5 04/15] ice: add helpers for Global RSS LUT alloc, free, vsi_update Przemek Kitszel
2026-11-12 23:07   ` netdev-bot+sashiko
2026-11-10 14:07 ` [PATCH net-next v5 05/15] ice: rename ICE_MAX_RSS_QS_PER_VF to ICE_MAX_QS_PER_VF_VCV1 Przemek Kitszel
2026-11-10 14:07 ` [PATCH net-next v5 06/15] ice: bump to 256qs for VF Przemek Kitszel
2026-11-12 23:07   ` netdev-bot+sashiko
2026-11-10 14:07 ` [PATCH net-next v5 07/15] iavf: extend iavf_configure_queues() to support more queues Przemek Kitszel
2026-11-12 23:07   ` netdev-bot+sashiko [this message]
2026-11-10 14:07 ` [PATCH net-next v5 08/15] iavf: temporary rename of IAVF_MAX_REQ_QUEUES to IAVF_MAX_REQ_QUEUES_VCV1 Przemek Kitszel
2026-11-10 14:07 ` [PATCH net-next v5 09/15] iavf: increase max number of queues to 256 Przemek Kitszel
2026-11-12 23:07   ` netdev-bot+sashiko
2026-11-10 14:07 ` [PATCH net-next v5 10/15] iavf: use new opcodes to request more than 16 queues Przemek Kitszel
2026-11-12 12:57   ` Petr Oros
2026-11-12 23:07   ` netdev-bot+sashiko
2026-11-10 14:07 ` [PATCH net-next v5 11/15] ice: introduce handling of virtchnl LARGE VF opcodes Przemek Kitszel
2026-11-12 23:07   ` netdev-bot+sashiko
2026-11-10 14:07 ` [PATCH net-next v5 12/15] devlink: give user option to allocate resources Przemek Kitszel
2026-11-10 14:07 ` [PATCH net-next v5 13/15] ice: represent RSS LUTs as devlink resources Przemek Kitszel
2026-11-12 23:07   ` netdev-bot+sashiko
2026-11-10 14:07 ` [PATCH net-next v5 14/15] devlink: add devlink_alloc_drv() Przemek Kitszel
2026-11-10 14:48   ` Jiri Pirko
2026-11-12 23:07   ` netdev-bot+sashiko
2026-11-10 14:07 ` [PATCH net-next v5 15/15] ice: support up to 256 VF queues Przemek Kitszel
2026-11-12 23:07   ` netdev-bot+sashiko
2026-11-12 12:57 ` [PATCH net-next v5 00/15] devlink, mlx5, iavf, ice: XLVF for iavf Petr Oros

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=179452485428.2199510.11578630824061191353@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=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