Linux-HyperV List
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Long Li" <longli@microsoft.com>
Cc: linux-hyperv@vger.kernel.org
Subject: Re: [PATCH net-next v2 03/13] net: mana: swap queue sets in mana_set_ringparam
Date: Fri, 14 Aug 2026 05:05:17 +0000	[thread overview]
Message-ID: <20260814050517.CAF901F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260813050418.2906468-4-longli@microsoft.com>

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

New issues:
- [High] Hardware Resource Exhaustion (MSI-X vectors) / Functional Regression
- [High] Ad-hoc Synchronization with Flags

Pre-existing issues:
- [High] State Loss (RSS Indirection Table)
--

--- Patch [3]: [PATCH net-next v2 03/13] net: mana: swap queue sets in mana_set_ringparam ---
commit e63909b90b30b5041af0319613913c9654a4cc80
Author: Long Li <longli@microsoft.com>

net: mana: swap queue sets in mana_set_ringparam

Convert the ring size path to pre-allocate and swap, for the same reasons
as the channel count path. An allocation failure returns the error with
the running configuration untouched, and the vport is never released.

> diff --git a/drivers/net/ethernet/microsoft/mana/mana_ethtool.c b/drivers/net/ethernet/microsoft/mana/mana_ethtool.c
> index b12291555eaeb..40e9886c87a81 100644
> --- a/drivers/net/ethernet/microsoft/mana/mana_ethtool.c
> +++ b/drivers/net/ethernet/microsoft/mana/mana_ethtool.c
[ ... ]
> @@ -791,32 +790,61 @@ static int mana_set_ringparam(struct net_device *ndev,
[ ... ]
> +	/* Block RDMA from acquiring the vport for the duration. The vport
> +	 * itself is never released, so vport_use_count stays > 0.
> +	 */
> +	mutex_lock(&apc->vport_mutex);
> +	if (apc->channel_changing) {
> +		mutex_unlock(&apc->vport_mutex);
> +		return -EBUSY;
>  	}
> +	apc->channel_changing = true;
> +	mutex_unlock(&apc->vport_mutex);

[Severity: High]
Does this code use apc->channel_changing as an ad-hoc lock?

Since this flag is set on entry and cleared on exit to prevent concurrent
RDMA vport access, could we use a proper synchronization primitive here instead
of a boolean flag?

>  
> -	apc->tx_queue_size = new_tx;
> -	apc->rx_queue_size = new_rx;
> +	scratch = mana_qset_scratch_alloc(apc);
> +	if (!scratch) {
> +		err = -ENOMEM;
> +		goto clear_flag;
> +	}
>  
> -	err = mana_attach(ndev);
> +	err = mana_alloc_qset(scratch, apc->num_queues, new_rx, new_tx,
> +			      apc->priv_flags, &newq);

[Severity: High]
By pre-allocating a complete new queue set alongside the existing one, does
this require twice as many MSI-X vectors simultaneously?

If the system is already fully utilizing its vectors, could mana_create_eq()
fail to acquire vectors from the MSI-X pool, causing the ring parameter
changes to reliably fail with -ENOSPC?

[Severity: High]
This is a pre-existing issue, but does this code cause a loss of the custom RSS
indirection table?

During mana_alloc_qset(), mana_rss_table_init() is called, which unconditionally
overwrites the indirection table with default round-robin values. If a user
has configured a custom RSS indirection table, will those settings be
irrevocably destroyed here?

[ ... ]
> +clear_flag:
> +	mutex_lock(&apc->vport_mutex);
> +	apc->channel_changing = false;
> +	mutex_unlock(&apc->vport_mutex);
>  	return err;
>  }

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260813050418.2906468-1-longli@microsoft.com?part=3

  reply	other threads:[~2026-08-14  5:05 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-13  5:04 [PATCH net-next v2 00/13] net: mana: reconfigure by replacing the queue set Long Li
2026-08-13  5:04 ` [PATCH net-next v2 01/13] net: mana: add queue-set allocation and teardown helpers Long Li
2026-08-14  5:05   ` sashiko-bot
2026-08-13  5:04 ` [PATCH net-next v2 02/13] net: mana: swap queue sets in mana_set_channels Long Li
2026-08-14  5:05   ` sashiko-bot
2026-08-13  5:04 ` [PATCH net-next v2 03/13] net: mana: swap queue sets in mana_set_ringparam Long Li
2026-08-14  5:05   ` sashiko-bot [this message]
2026-08-13  5:04 ` [PATCH net-next v2 04/13] net: mana: swap queue sets in mana_set_priv_flags Long Li
2026-08-14  5:05   ` sashiko-bot
2026-08-13  5:04 ` [PATCH net-next v2 05/13] net: mana: swap queue sets in mana_change_mtu Long Li
2026-08-14  5:05   ` sashiko-bot
2026-08-13  5:04 ` [PATCH net-next v2 06/13] net: mana: swap queue sets in mana_xdp_set Long Li
2026-08-13  5:04 ` [PATCH net-next v2 07/13] net: mana: do not bail out of mana_detach on dealloc failure Long Li
2026-08-14  5:05   ` sashiko-bot
2026-08-13  5:04 ` [PATCH net-next v2 08/13] net: mana: keep per-queue statistics in the port context Long Li
2026-08-14  5:05   ` sashiko-bot
2026-08-13  5:04 ` [PATCH net-next v2 09/13] net: mana: share the EQ pool across a queue-set swap Long Li
2026-08-13  5:04 ` [PATCH net-next v2 10/13] net: mana: release EQs left idle by a channel-count reduction Long Li
2026-08-13  5:04 ` [PATCH net-next v2 11/13] net: mana: keep a user-configured RSS table across a queue rebuild Long Li
2026-08-14  5:05   ` sashiko-bot
2026-08-13  5:04 ` [PATCH net-next v2 12/13] net: mana: keep the surviving queues when the channel count is reduced Long Li
2026-08-13  5:04 ` [PATCH net-next v2 13/13] net: mana: keep the existing queues when the channel count is raised Long Li
  -- strict thread matches above, loose matches on Subject: below --
2026-08-11  6:34 [PATCH net-next v2 00/13] net: mana: reconfigure by replacing the queue set Long Li
2026-08-11  6:35 ` [PATCH net-next v2 03/13] net: mana: swap queue sets in mana_set_ringparam Long Li

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=20260814050517.CAF901F00A3A@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=longli@microsoft.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /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