Article View: linux.kernel.netdev
Article #27091Re: [PATCH net] gve: Move XPS configurations to preserve user settings
From: netdev-bot+sashiko
Date: Fri, 04 Dec 2026 19:04
Date: Fri, 04 Dec 2026 19:04
239 lines
17240 bytes
17240 bytes
Thank you for your contribution! Sashiko AI review found 4 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 3 · 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] The commit message presents the XPS change as a refactor: it
stores each notify block's IRQ affinity and reuses it for XPS "rather…
- [Medium] In gve_adjust_queues() (gve_main.c:1959-1999), if
gve_adjust_config() fails after gve_queues_start() has already written…
- [Medium] gve_setup_notify_blocks() saves the requested CPU in
block->affinity_mask = cpumask_of(cur_cpu) (gve_main.c:627).
- [Low] gve: gve_alloc_notify_blocks() omits XPS cleanup when clamping TX
queues
--
gve: Move XPS configurations to preserve user settings
This commit stops gve from re-applying default XPS mappings each time the
queues are started, so a soft reset keeps user XPS settings. Default XPS
is now set only at probe time and when the TX queue count changes. It also
saves each notify block's IRQ affinity mask and reuses it as the default
XPS mask.
> Store the CPU affinity mask assigned to each notify block in
> gve_setup_notify_blocks() and reuse it when configuring XPS rather than
> duplicating the CPU affinity calculation logic.
[Severity: Medium]
Is this only a de-duplication? The formula removed from
gve_tx_add_to_block() does not look at the NUMA node:
unsigned int active_cpus = min_t(int, priv->num_ntfy_blks / 2,
num_online_cpus());
...
netif_set_xps_queue(priv->dev, get_cpu_mask(ntfy_idx % active_cpus),
queue_idx);
The IRQ affinity in gve_setup_notify_blocks() works differently. It walks
gve_get_node_mask(), which returns cpumask_of_node(priv->numa_node), or
cpu_all_mask for NUMA_NO_NODE. It wraps at nr_cpu_ids or
tx_cfg.max_queues.
The two have differed since commit d991666b7b699a ("gve: make IRQ
handlers and page allocation NUMA aware").
Take a multi-node guest where the gVNIC's node does not start at CPU 0,
for example node 1 = CPUs 48-95. The default TX queues now map to CPUs on
that node. CPUs on other nodes lose their default XPS entries and fall
back to skb_tx_hash().
Could the commit message mention this change in default TX steering?
This patch is also tagged Cc: stable. Trees older than d991666b7b699a do
not have gve_get_node_mask() or cur_cpu here, so would a backport need a
different approach?
> diff --git a/drivers/net/ethernet/google/gve/gve_main.c b/drivers/net/ethernet/google/gve/gve_main.c
> index 35cf0f06a0f27..074ccbbf449c8 100644
> --- a/drivers/net/ethernet/google/gve/gve_main.c
> +++ b/drivers/net/ethernet/google/gve/gve_main.c
> @@ -624,8 +624,8 @@ static int gve_setup_notify_blocks(struct gve_priv *priv)
> }
> block->irq = priv->msix_vectors[msix_idx].vector;
> block->irq_requested = true;
> - irq_set_affinity_and_hint(block->irq,
> - cpumask_of(cur_cpu));
> + block->affinity_mask = cpumask_of(cur_cpu);
> + irq_set_affinity_and_hint(block->irq, block->affinity_mask);
[Severity: Medium]
Can block->affinity_mask name an offline CPU here?
When priv->numa_node is NUMA_NO_NODE, gve_get_node_mask() returns
cpu_all_mask. cur_cpu then wraps only on this condition:
if (cur_cpu >= nr_cpu_ids || (i + 1) == priv->tx_cfg.max_queues)
tx_cfg.max_queues comes from the MSI-X vector count, not the CPU count.
Suppose nr_cpu_ids is larger than the online count (hot-pluggable vCPU
slots) and there are more TX queues than online CPUs. Some blocks then
get a CPU that is possible but offline.
In that case irq_set_affinity_and_hint() fails with -EINVAL. The return
value is ignored, but the mask is still saved.
Later, gve_set_xps_mapping() passes this mask to netif_set_xps_queue().
__netif_set_xps_queue() only adds entries for CPUs in mask &
cpu_online_mask, so those queues get no XPS entry at all.
The removed formula, ntfy_idx % min(num_ntfy_blks / 2, num_online_cpus()),
stayed within the online CPU count and was re-applied on every open.
XPS is now set only at probe and on queue count changes. Does anything
correct the mapping once that CPU comes online, or on the next open or
reset?
>
> cur_cpu = cpumask_next(cur_cpu, node_mask);
> /* Wrap once CPUs in the node have been exhausted, or when
[ ... ]
> @@ -1942,6 +1963,7 @@ int gve_adjust_queues(struct gve_priv *priv,
> {
> struct gve_tx_alloc_rings_cfg tx_alloc_cfg = {0};
> struct gve_rx_alloc_rings_cfg rx_alloc_cfg = {0};
> + u16 old_num_tx = priv->tx_cfg.num_queues;
> int err;
>
> gve_get_curr_alloc_cfgs(priv, &tx_alloc_cfg, &rx_alloc_cfg);
> @@ -1954,7 +1976,10 @@ int gve_adjust_queues(struct gve_priv *priv,
>
> if (netif_running(priv->dev)) {
> err = gve_adjust_config(priv, &tx_alloc_cfg, &rx_alloc_cfg);
> - return err;
> + if (err)
> + return err;
[Severity: Medium]
What happens to the XPS mappings for newly added TX queues if
gve_adjust_config() fails after gve_queues_start() has already committed
the new config?
gve_queues_start() writes the new config first and only then runs steps
that can fail:
priv->tx_cfg = *tx_alloc_cfg->qcfg;
...
err = netif_set_real_num_rx_queues(dev, priv->rx_cfg.num_queues);
if (err)
goto stop_rings;
err = gve_reg_xdp_info(priv, dev);
if (err)
goto stop_rings;
...
err = gve_register_qpls(priv);
if (err)
goto reset;
On the reset path, gve_reset() can also return the error from
gve_recover().
For example, grow from 4 to 8 TX queues while the interface is running:
- priv->tx_cfg.num_queues becomes 8.
- A later step fails.
- This early return skips config_xps.
Queues 4..7 then never get a default XPS mapping.
Before this patch, the next gve_open() or reset rebuilt XPS through
gve_tx_add_to_block(), but that call is now removed.
A later gve_adjust_queues() reads old_num_tx from the already-updated
priv->tx_cfg.num_queues (8). So this loop in gve_set_xps_mapping() does
not cover queues 4..7 either:
for (i = old_num_tx; i < new_num_tx; i++) {
Would these queues stay unmapped until the queue count is shrunk and
grown again? Shrinking looks fine, since netif_set_real_num_tx_queues()
resets XPS for the removed queues itself.
> +
> + goto config_xps;
> }
[ ... ]
> @@ -1965,6 +1990,11 @@ int gve_adjust_queues(struct gve_priv *priv,
> priv->tx_cfg = new_tx_config;
> priv->rx_cfg = new_rx_config;
>
> +config_xps:
> + /* Update default XPS mappings for added or removed TX queues
> + * while preserving custom XPS mappings of existing TX queues.
> + */
> + gve_set_xps_mapping(priv, old_num_tx, priv->tx_cfg.num_queues);
> return 0;
> }
>
[Severity: Low]
Does gve_alloc_notify_blocks() need to clear XPS for the queues it
drops when it clamps the TX queue count?
With this patch, gve_adjust_queues() installs default XPS entries for
new TX queues even while the interface is down. At that point
dev->real_num_tx_queues has not been raised yet.
__netif_set_xps_queue() only checks the index against
dev->num_tx_queues, so those entries go straight into
dev->xps_maps[XPS_CPUS].
Consider this sequence with max_tx_queues of 8:
- The interface is opened with 4 TX queues, so real_num_tx_queues is
4. It is then brought down.
- ethtool -L raises TX to 8 while down. gve_set_xps_mapping(priv, 4, 8)
maps queues 4..7.
- Before the next open, a reset (gve_handle_reset()) or gve_resume()
runs gve_setup_device() -> gve_alloc_notify_blocks(). If
pci_enable_msix_range() returns fewer vectors, this clamps the count:
if (priv->tx_cfg.num_queues > priv->tx_cfg.max_queues)
priv->tx_cfg.num_queues = priv->tx_cfg.max_queues;
Nothing clears the XPS entries for the queues dropped here.
- On the next gve_open(), gve_queues_start() calls
netif_set_real_num_tx_queues() with the clamped count. That only calls
netif_reset_xps_queues_gt() when txq < dev->real_num_tx_queues, which
is false because real_num_tx_queues is still 4.
The stale queue indices then stay in the CPU maps. They cannot be seen
or cleared through sysfs, because tx-N kobjects only exist below
real_num_tx_queues.
__get_xps_queue_idx() rejects these indices, so there is no
out-of-bounds transmit. But on any CPU whose map also holds an active
queue, some flows hash onto the stale index and fall back to
skb_tx_hash(). That happens when cur_cpu wrapped in
gve_setup_notify_blocks(), or when a user mask overlaps a dropped
queue's CPU.
The preconditions are unusual. Still, should gve_alloc_notify_blocks()
call gve_set_xps_mapping() for the queues it drops? Or would it be
simpler to defer the offline XPS setup until the queues are actually
started?
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261203182305.3688004-1-joshwash%40google.com
Technical Details
Message-ID:
<179641106575.3146.8858224123043442972@kernel.org>Path:
mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377575-linux-kernel-netdev=dewy.ruReferences:
<20261203182305.3688004-1-joshwash@google.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377575-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net] gve: Move XPS configurations to preserve user settings Date: Fri, 04 Dec 2026 19:04:25 +0000 Organization: Usenet Network Message-ID: <179641106575.3146.8858224123043442972@kernel.org> References: <20261203182305.3688004-1-joshwash@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="2838749"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:M9qb4dnF/e6sGDwWBMHqWrFYKks= sha256:4ZR6I+4i2H1x+P0hmDYfabGpPQ+nqPJkxG3DioAGszU= sha1:Qg4pcgWL/+j75xDry2EPCWA5hjU= sha256:NF+dfnk9MUpZ25NJ6trCpzihlu1K84+QHCCW4tvmJvc= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 4FA18117CAF; Fri, 4 Dec 2026 22:04:43 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.541 X-Spam-Status: No, score=-3.541 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.142, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id BorDPJPy2O9i; Fri, 4 Dec 2026 22:04:39 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-377575-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 5AE37117CA8; Fri, 4 Dec 2026 22:04:31 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id A31A23D754; Fri, 4 Dec 2026 19:04:29 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796411068; b=bPUZy4tF9gY3yJOy58oJfgOcWSAtUNRX8fswOyEb1fRmmWMar9qPS/ahV5kNeqASWylu KH2qphUg0L3CpU0sEv43oqRI1w+FtADuA8muc+DewQHIh1YZgjRx8DDBVnypitXkUw7Oh 3fM2wic5vt2Fm4sANshF4ie6w8Ct+cTS2v7e1uyeTIKNgKA/Nojsj7pEt+r7w4b3i89xS rPF/KSZrkaeJMPC+9oEr5k2bkIDw+Gt3aVj3ljJa+6JAyJ7IyYbxs6GtXUwL4Ly7iV6rB hfVhY8IJK2eoJFedaTpIqhq3i42nLhMzC5LNWk350eJK803qFXZ7V6LUDehEpDo7U7Q== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796411068; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=S1U3SLkL8varxw3Qyq4yQWqRwvsninRdPv3WZ+hEHkQ=; b=BzSvwU4nS7FYvhOohaPo/E2MCBJXWWgQaPINgCPOg16Ycj/iPrKjA28PZZ8ExgEdN5/S +32g6uIXCY2TlUWT3sNhkBuCvqRKM1PAcd49p8mKCfR+kg/oIrUJSNaymukphxj4bJ0ej KQBmgSpFlkZ50crChl8BnhVJsb83Posnd6dE/kirGmNCJ83IkT4SM0ajxjwvoS9JIvhC7 DCzuZl7KWjEF/GOHV1nlmvFxsN2y8wmQHQ/0Y/5h3zn+Iua+arsXIi7GvVIMHN+wCrj6r Z+NM0eHQ6aUuoqKZGGF+CjsvvzJnqEO4spDz+SyJRYmaaF9IbakYLZDVclkphD9vKlw== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=YDTMnzft; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 72A78606A336; Fri, 4 Dec 2026 19:04:28 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=YDTMnzft X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796411067; b=ri5YLrYf69hWPlAHpnAfODHALd0hmstlSwdpWeyaH2tmzJC+OeoL+cZ7trHCjzwibOfy 4S21L7+5fBOc1+EJ0UYMi/efi5AYTa4TueYZZEBbK0KPE6M5k4NHc1eeowjTKlPIgF0wa TUuetUQpShfYlnANGxDPtk6uTGaDXrv8s9SIgAocC6G3PsuEOe5ICWFm72JM78gI4jf4H JPqq09yDqvcTPIhkbWhCnidTJp3XDKD8RE4DC+c0/2dho3Mwq1BLfDyVVXFBaDOWBKBhc 9dvXEYTEJHN1xWFKoxOYfyVeNRqYiDtSy6qshQs518LiqqUvdp15migxc9XBtS93QAg== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796411067; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=S1U3SLkL8varxw3Qyq4yQWqRwvsninRdPv3WZ+hEHkQ=; b=4yjHaOf+VhzMRfN/p3S7ZMuVnmhgOM4WOi3p+L1SIe2lnMP6uu5bcv2Q4TXVWD4etlZ4 KRY9VgXpvW6hamcbkXqFQCbYfrJ9LgxBvJL4cqQEHXSLQ/VA20DWtZ2licvDVbSEHN3cb F15AEn6mm7AsYui4S/JBlE+LkE7o892WwWw7r8ahpGEggLdGED82Nfk5V+RTTVDeHUTUr vOcP86+20K0sSYgsT/KTdsW9eZiqPxnHRPPzZnCzZgIG4wndd0cQIUoPgIbI5wWX6Zraj se6vahRb4a7YCv/97ur+oWYott5xUYm43Br430Xv6z4L6AE36tSmdZyd/voB3y0nzUA== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=YDTMnzft; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 900FF606A32C; Fri, 4 Dec 2026 19:04:27 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 366C61F00936; Fri, 4 Dec 2026 19:04:26 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796411067; bh=S1U3SLkL8varxw3Qyq4yQWqRwvsninRdPv3WZ+hEHkQ=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=YDTMnzft6S0J6w0YCtsaLN3RaScRR1aAHXC/JBFpAI69kRw8VLZzR18dTauf6Lj8L O3uU9fl7Gg4jVerD3hOo6ngbTjfZxIfqAUZE3VTZwtqswxb9nS+dyqQcyV0+GQ4bb9 QjRweDio07G2QYltezbP6OXaAs3AqQMzeRNXJuY43pXnZ2UdMG0m9D7h1BFzUP1yJ2 QePGKfORvaDPqkYMZ7Jn1FjfJcU9100XJJZrNf79IoGeeo/nmpemAYiDHVOxHK08JU Yjk88VeKQ1HE3JCZ/hANsTc/Z0xut80ibgV9f5IqgSFD+14otLtSdq/6KJEg3CoaWr SqdkCxWJsLQlQ== X-Cc: netdev@vger.kernel.org, hramamurthy@google.com, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, jordanrhee@google.com, willemb@google.com, przemyslaw.kitszel@intel.com, maolson@google.com, nktgrg@google.com, amaan.cheval@gmail.com, awogbemila@google.com, csully@google.com, eugenehlee@google.com, stable@vger.kernel.org X-In-Reply-To: <20261203182305.3688004-1-joshwash@google.com> X-sashiko-severity: Medium X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list