From: netdev-bot+sashiko@kernel.org
To: mmc@linux.ibm.com
Cc: netdev@vger.kernel.org, davem@davemloft.net, kuba@kernel.org,
horms@kernel.org, edumazet@kernel.org, pabeni@redhat.com,
andrew+netdev@lunn.ch, nnac123@linux.ibm.com,
maddy@linux.ibm.com, mpe@ellerman.id.au,
linuxppc-dev@lists.ozlabs.org, npiggin@gmail.com,
chleroy@kernel.org, ritesh.list@gmail.com, sshegde@linux.ibm.com,
haren@linux.ibm.com, ricklind@linux.ibm.com,
davemarq@linux.ibm.com, bjking1@linux.ibm.com,
shaik.abdulla1@ibm.com
Subject: Re: [PATCH net-next v8 15/15] ibmveth: Complete set_channels down-path
Date: Thu, 12 Nov 2026 23:57:14 +0000 [thread overview]
Message-ID: <179452783479.2199510.8962832293852344506@kernel.org> (raw)
In-Reply-To: <20261109235556.60604-16-mmc@linux.ibm.com>
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] The down-path of ibmveth_set_channels() can now shrink the
published RX count while close() has kept the LAN memory mapped.
Pre-existing issues:
- [Low] When mq_fallback is set, ibmveth_get_channels() reports max_rx
equal to the live rx_count (e.g. 8).
--
ibmveth: Complete set_channels down-path
This patch completes ethtool -L for ibmveth. While the device is down it
publishes the desired RX and TX counts without allocating anything. While
up it validates tx_count before the RX resize and skips the TX LTB work
when tx_count is unchanged. It also sets max_tx to at least the live
tx_count in both get_channels and set_channels.
> diff --git a/drivers/net/ethernet/ibm/ibmveth.c b/drivers/net/ethernet/ibm/ibmveth.c
> index 510d9d80e2df5..3ced6f5bad2d7 100644
> --- a/drivers/net/ethernet/ibm/ibmveth.c
> +++ b/drivers/net/ethernet/ibm/ibmveth.c
> @@ -3687,15 +3687,32 @@ static void ibmveth_get_channels(struct net_device *netdev,
[ ... ]
> - channels->rx_count = ibmveth_get_num_rx_queues(adapter);
> + /*
> + * Always report the live RX count. ethtool -L is read-modify-
> + * write, so a TX-only request echoes rx_count back at us; an
> + * understated value would be applied as a silent RX shrink.
> + * mq_fallback instead caps max_rx at the live count, which
> + * blocks growth in the core without misreporting what is
> + * currently configured.
> + */
> + channels->rx_count = rx_count;
> if (adapter->multi_queue && !READ_ONCE(adapter->mq_fallback))
> channels->max_rx = IBMVETH_MAX_RX_QUEUES;
> else
> - channels->max_rx = channels->rx_count;
> + channels->max_rx = rx_count;
> }
[Severity: Low]
This is a pre-existing issue and was not introduced by this patch. With
mq_fallback set, ibmveth_get_channels() reports max_rx equal to the live
rx_count, so the ethtool core accepts any rx_count from 1 to rx_count.
ibmveth_resize_rx_channels() then rejects every rx > 1 that differs from
the live count:
if (goal_rx > 1 &&
(!adapter->multi_queue || READ_ONCE(adapter->mq_fallback))) {
...
return -EOPNOTSUPP;
}
With a live count of 8, "ethtool -L ethX rx 4" passes the core range
check and then fails in the driver with -EOPNOTSUPP. Only the no-op
request and rx 1 succeed.
The comment in ibmveth_resize_rx_channels() says this is deliberate, so
that read-modify-write TX-only requests still clear the core. The new
comment says the cap "blocks growth in the core", which is accurate.
However, shrinks to 2..rx_count-1 are refused as well.
Is it intended that users see this gap between the advertised max_rx and
the values the setter accepts?
[ ... ]
> @@ -3771,30 +3783,84 @@ static int ibmveth_set_channels(struct net_device *netdev,
[ ... ]
> + /* If not opened (never opened, close+open failed while IFF_UP
> + * stayed set, or close() kept the LAN memory after a failed
> + * H_FREE_LOGICAL_LAN), publish desired queue counts without
> + * allocating.
> + */
> + if (!adapter->opened) {
> + if (goal_rx > old_rx) {
> + for (i = old_rx; i < goal_rx; i++) {
> + if (adapter->queue_registered[i]) {
> + netdev_err(netdev,
> + "RX queue %d still held by PHYP, free retried on next open\n",
> + i);
> + return -EBUSY;
> + }
> + }
> + }
[ ... ]
> + if (goal_rx != ibmveth_get_num_rx_queues(adapter)) {
> + ibmveth_publish_num_rx_queues(adapter, goal_rx);
> + rc = netif_set_real_num_rx_queues(netdev, goal_rx);
[Severity: Low]
Suppose close() kept the LAN memory mapped after H_FREE_LOGICAL_LAN
failed in multi-queue mode, which is one of the states the new comment
lists. This path can now publish a smaller RX count. The
queue_registered[] -EBUSY check only runs for goal_rx > old_rx. A shrink
such as rx 8 to rx 4 therefore goes through while slots [goal_rx, old_rx)
are still registered and mapped, along with their buffer pools.
ibmveth_free_all_queues(), ibmveth_cleanup_rx_resources() and
ibmveth_free_buffer_pools() only loop up to ibmveth_get_num_rx_queues().
On the next open, the only thing that frees those slots is
ibmveth_free_stranded_rx_queues():
ibmveth_open()
ibmveth_free_all_queues() /* [0, 4) */
ibmveth_free_stranded_rx_queues() /* [4, 8) */
ibmveth_release_lan_resources() /* [0, 4) */
This works at this commit, because the helper scans [num, MAX) on
buffer_list_addr and queue_addr. Its kernel-doc only names one source of
such slots, though:
* A scale-up register or IRQ-setup failure whose H_FREE_LOGICAL_LAN_QUEUE
* also fails leaves that queue out of the live set with its slot still
* registered and its memory still mapped.
Could the kernel-doc of ibmveth_free_stranded_rx_queues() say that a
down-path shrink in ibmveth_set_channels() also depends on it? The commit
message could note this too.
Otherwise, a later change that narrows the helper to its documented
purpose (for example, gating it on slots left by scale-up failures) would
leak the DMA-mapped RX rings, buffer-list pages and buffer pools of slots
shrunk away while down.
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261109235556.60604-1-mmc%40linux.ibm.com
prev parent reply other threads:[~2026-11-12 23:57 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-09 23:55 [PATCH net-next v8 00/15] ibmveth: Add multi-queue RX support Mingming Cao
2026-11-09 23:55 ` [PATCH net-next v8 01/15] ibmveth: Add MQ RX hypercall wrappers and call definitions Mingming Cao
2026-11-10 23:57 ` sashiko-bot
2026-11-09 23:55 ` [PATCH net-next v8 02/15] ibmveth: Prepare MQ RX adapter data structures Mingming Cao
2026-11-09 23:55 ` [PATCH net-next v8 03/15] ibmveth: Refactor RX resource allocation for MQ RX bring-up Mingming Cao
2026-11-09 23:55 ` [PATCH net-next v8 04/15] ibmveth: Refactor buffer pool management for per-queue MQ RX Mingming Cao
2026-11-09 23:55 ` [PATCH net-next v8 05/15] ibmveth: Refactor RX interrupt control for MQ RX queues Mingming Cao
2026-11-12 23:57 ` netdev-bot+sashiko
2026-11-09 23:55 ` [PATCH net-next v8 06/15] ibmveth: Refactor TX resource allocation in open/close paths Mingming Cao
2026-11-12 23:57 ` netdev-bot+sashiko
2026-11-09 23:55 ` [PATCH net-next v8 07/15] ibmveth: Add RX queue register helpers for MQ Mingming Cao
2026-11-12 23:57 ` netdev-bot+sashiko
2026-11-09 23:55 ` [PATCH net-next v8 08/15] ibmveth: Add queue-aware RX buffer submit helper " Mingming Cao
2026-11-12 23:57 ` netdev-bot+sashiko
2026-11-09 23:55 ` [PATCH net-next v8 09/15] ibmveth: Split RX poll into per-slot helpers " Mingming Cao
2026-11-12 23:57 ` netdev-bot+sashiko
2026-11-09 23:55 ` [PATCH net-next v8 10/15] ibmveth: Enable multi-queue RX receive path Mingming Cao
2026-11-12 23:57 ` netdev-bot+sashiko
2026-11-09 23:55 ` [PATCH net-next v8 11/15] ibmveth: Add per-queue RX and TX statistics collection Mingming Cao
2026-11-12 23:57 ` netdev-bot+sashiko
2026-11-09 23:55 ` [PATCH net-next v8 12/15] ibmveth: Report MQ-aware RX counts in ethtool get_channels Mingming Cao
2026-11-09 23:55 ` [PATCH net-next v8 13/15] ibmveth: Expose per-queue buffer pool details via debugfs Mingming Cao
2026-11-09 23:55 ` [PATCH net-next v8 14/15] ibmveth: Implement incremental MQ RX queue resize Mingming Cao
2026-11-12 23:57 ` netdev-bot+sashiko
2026-11-09 23:55 ` [PATCH net-next v8 15/15] ibmveth: Complete set_channels down-path Mingming Cao
2026-11-12 23:57 ` netdev-bot+sashiko [this message]
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=179452783479.2199510.8962832293852344506@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=bjking1@linux.ibm.com \
--cc=chleroy@kernel.org \
--cc=davem@davemloft.net \
--cc=davemarq@linux.ibm.com \
--cc=edumazet@kernel.org \
--cc=haren@linux.ibm.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=maddy@linux.ibm.com \
--cc=mmc@linux.ibm.com \
--cc=mpe@ellerman.id.au \
--cc=netdev@vger.kernel.org \
--cc=nnac123@linux.ibm.com \
--cc=npiggin@gmail.com \
--cc=pabeni@redhat.com \
--cc=ricklind@linux.ibm.com \
--cc=ritesh.list@gmail.com \
--cc=shaik.abdulla1@ibm.com \
--cc=sshegde@linux.ibm.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 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.