From: netdev-bot+sashiko@kernel.org
To: mmc@linux.ibm.com
Cc: netdev@vger.kernel.org, maddy@linux.ibm.com, mpe@ellerman.id.au,
npiggin@gmail.com, chleroy@kernel.org, ritesh.list@gmail.com,
sshegde@linux.ibm.com, nnac123@linux.ibm.com,
andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org,
kuba@kernel.org, pabeni@redhat.com,
linuxppc-dev@lists.ozlabs.org, horms@kernel.org,
davemarq@linux.ibm.com, haren@linux.ibm.com,
ricklind@linux.ibm.com, bjking1@linux.ibm.com,
shaik.abdulla1@ibm.com, willemb@google.com
Subject: Re: [PATCH net-next v9 07/13] ibmveth: Add the MQ RX buffer submit hypercall
Date: Sat, 05 Dec 2026 19:42:36 +0000 [thread overview]
Message-ID: <179649975684.3148.8777282288439223886@kernel.org> (raw)
In-Reply-To: <20261201190216.62407-8-mmc@linux.ibm.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] ibmveth: race on mq_hfunc and work in ibmveth_reset() and
ibmveth_close()
- [Low] (Baseline: not confirmed.) The concern says the 12-buffer MQ
capability in the commit message cannot be reached, because probe sets…
--
ibmveth: Add the MQ RX buffer submit hypercall
This adds ibmveth_add_logical_lan_buffers(). It chooses between the
legacy RX buffer hcalls and the new H_ADD_LOGICAL_LAN_BUFFERS_QUEUE
hcall, which packs two addresses per argument for up to 12 buffers per
call. It also adds reset handling for an unexpected H_FUNCTION from the
MQ hcall, and splits IBMVETH_MAX_RX_PER_HCALL (now 12) from the legacy
limit IBMVETH_MAX_RX_REGULAR (8).
> diff --git a/drivers/net/ethernet/ibm/ibmveth.c b/drivers/net/ethernet/ibm/ibmveth.c
> index 1a9499438930f..cafbed3d15125 100644
> --- a/drivers/net/ethernet/ibm/ibmveth.c
> +++ b/drivers/net/ethernet/ibm/ibmveth.c
[ ... ]
> + if (adapter->multi_queue) {
> + unsigned long buffersznum = (buff_size << 32) | filled;
> + unsigned long ioba[IBMVETH_MAX_RX_PER_HCALL / 2] = {0};
> + unsigned long handle = adapter->queue_handle[queue_index];
> + int i;
> +
> + /* Even descriptors go in the high 32 bits of an ioba word,
> + * odd ones in the low 32 bits.
> + */
> + for (i = 0; i < filled && i < IBMVETH_MAX_RX_PER_HCALL; i++) {
[ ... ]
> @@ -2846,7 +2937,7 @@ static int ibmveth_probe(struct vio_dev *dev, const struct vio_device_id *id)
>
> if (ret == H_SUCCESS &&
> (ret_attr & IBMVETH_ILLAN_RX_MULTI_BUFF_SUPPORT)) {
> - adapter->rx_buffers_per_hcall = IBMVETH_MAX_RX_PER_HCALL;
> + adapter->rx_buffers_per_hcall = IBMVETH_MAX_RX_REGULAR;
[Severity: Low]
Can the 12-buffer path in ibmveth_add_logical_lan_buffers() be reached
with this change?
The commit message says:
It packs two buffer addresses per argument, so one call carries up
to 12 buffers instead of 8.
ibmveth_probe() now sets rx_buffers_per_hcall to either
IBMVETH_MAX_RX_REGULAR (8) or 1. ibmveth_replenish_buffer_pool() limits
filled to that value:
batch = adapter->rx_buffers_per_hcall;
...
for (filled = 0; filled < min(remaining, batch); filled++) {
So the MQ hcall never gets more than 8 descriptors here, even after
multi_queue is set.
The commit message does say nothing sets multi_queue yet. The later
patch "ibmveth: Enable multi-queue RX" sets rx_buffers_per_hcall to
IBMVETH_MAX_RX_PER_HCALL when multi_queue is set, which makes the
12-buffer path reachable.
That later change is still inside the
IBMVETH_ILLAN_RX_MULTI_BUFF_SUPPORT branch, though. Without that
attribute, the MQ hcall posts one buffer per call. That still works,
but each call carries only one buffer. Is tying MQ batching to the
legacy multi-buffer attribute intended?
> netdev_dbg(netdev,
> "RX Multi-buffer hcall supported by FW, batch set to %u\n",
> adapter->rx_buffers_per_hcall);
[ ... ]
> @@ -1578,8 +1658,19 @@ static void ibmveth_reset(struct work_struct *w)
> rtnl_lock();
>
> if (netif_running(netdev)) {
> + bool hfunc = READ_ONCE(adapter->mq_hfunc);
> + bool give_up = hfunc && adapter->mq_hfunc_reopened;
> +
> dev_close(netdev);
> - dev_open(netdev, NULL);
> + /* Firmware that returns MQ H_FUNCTION again after a reopen
> + * would do so on every reopen; leave the device down rather
> + * than close and reopen forever.
> + */
> + if (give_up)
> + netdev_err(netdev,
> + "MQ buffer add H_FUNCTION again after reset, leaving device down\n");
> + else if (!dev_open(netdev, NULL))
> + adapter->mq_hfunc_reopened = hfunc;
> }
>
> rtnl_unlock();
[Severity: Medium]
Can the give-up logic in ibmveth_reset() be defeated when more than
one replenish attempt sees H_FUNCTION?
ibmveth_replenish_task() keeps walking the remaining active pools
after ibmveth_replenish_buffer_pool() has set mq_hfunc and called
schedule_work() for one of them. The next pool hits H_FUNCTION too and
calls schedule_work() again. Once multi_queue is enabled later in the
series, every RX queue's poll can do the same.
The workqueue clears the pending bit before ibmveth_reset() runs.
Suppose one of those later schedule_work() calls lands while
ibmveth_reset() is waiting for rtnl_lock(), or is in napi_disable()
via dev_close() -> ibmveth_close() -> ibmveth_cleanup_rx_interrupts().
Then adapter->work is queued again. Nothing in ibmveth_close() cancels
it, so a second ibmveth_reset() runs as soon as the first one drops
rtnl.
The flag handling doesn't cope with that.
First, an H_FUNCTION can be lost. ibmveth_reset() samples mq_hfunc
before dev_close(), while NAPI is still running. ibmveth_close() then
clears mq_hfunc and mq_hfunc_reopened once NAPI is stopped. So an
H_FUNCTION recorded between the sample and the return from
napi_disable() is lost.
Second, the stale reset clears the give-up state. In the second
reset, the reopened device's first poll may not have reached the MQ
hcall yet (threaded NAPI, deferred softirq). In that case hfunc reads
false and give_up is false. The device is closed and reopened again,
and mq_hfunc_reopened is set back to false. The next H_FUNCTION then
starts the cycle over. The device can keep bouncing instead of being
left down after one retry.
So the outcome of the reset depends on how NAPI polls and work
execution interleave, not on one serialised decision. This is the
flag-as-synchronization pattern that tends to break.
Would something along these lines work?
- Stop the pool loop in ibmveth_replenish_task() once mq_hfunc is
set.
- Schedule the reset only on the false-to-true transition of
mq_hfunc.
- Make the give-up decision in ibmveth_reset() after dev_close() has
quiesced NAPI, so no poll can still be writing mq_hfunc.
How should the flags be cleared? Clearing them unconditionally in
ibmveth_close() also wipes the state the reset path depends on.
Should only the reset path, or a user-initiated close, clear them?
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261201190216.62407-1-mmc%40linux.ibm.com
next prev parent reply other threads:[~2026-12-05 19:42 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-01 19:02 [PATCH net-next v9 00/13] ibmveth: Add multi-queue RX support Mingming Cao
2026-12-01 19:02 ` [PATCH net-next v9 01/13] ibmveth: Keep a buffer pool enabled after its allocation fails Mingming Cao
2026-12-01 19:02 ` [PATCH net-next v9 02/13] ibmveth: Keep TX statistics per queue Mingming Cao
2026-12-01 19:02 ` [PATCH net-next v9 03/13] powerpc/pseries: Add hcall numbers for multi-queue virtual ethernet Mingming Cao
2026-12-01 19:02 ` [PATCH net-next v9 04/13] ibmveth: Add RX queue handles Mingming Cao
2026-12-01 19:02 ` [PATCH net-next v9 05/13] ibmveth: Register subordinate RX queues Mingming Cao
2026-12-05 19:42 ` netdev-bot+sashiko
2026-12-01 19:02 ` [PATCH net-next v9 06/13] ibmveth: Add subordinate RX queue interrupt control Mingming Cao
2026-12-01 19:02 ` [PATCH net-next v9 07/13] ibmveth: Add the MQ RX buffer submit hypercall Mingming Cao
2026-12-05 19:42 ` netdev-bot+sashiko [this message]
2026-12-01 19:02 ` [PATCH net-next v9 08/13] ibmveth: Start every RX queue on open and resume Mingming Cao
2026-12-01 19:02 ` [PATCH net-next v9 09/13] ibmveth: Keep RX statistics per queue Mingming Cao
2026-12-01 19:02 ` [PATCH net-next v9 10/13] ibmveth: Keep rx_no_buffer across ifdown/up Mingming Cao
2026-12-05 19:42 ` netdev-bot+sashiko
2026-12-01 19:02 ` [PATCH net-next v9 11/13] ibmveth: Report per-queue statistics through netdev_stat_ops Mingming Cao
2026-12-01 19:02 ` [PATCH net-next v9 12/13] ibmveth: Enable multi-queue RX Mingming Cao
2026-12-01 19:02 ` [PATCH net-next v9 13/13] ibmveth: Allow changing the RX queue count Mingming Cao
2026-12-05 19:42 ` netdev-bot+sashiko
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=179649975684.3148.8777282288439223886@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 \
--cc=willemb@google.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