Article View: linux.kernel.netdev
Article #27486Re: [PATCH net-next v9 07/13] ibmveth: Add the MQ RX buffer submit hypercall
From: netdev-bot+sashiko
Date: Sat, 05 Dec 2026 19:42
Date: Sat, 05 Dec 2026 19:42
167 lines
14713 bytes
14713 bytes
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
Technical Details
Message-ID:
<179649975684.3148.8777282288439223886@kernel.org>Path:
mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-mo.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-378111-linux-kernel-netdev=dewy.ruReferences:
<20261201190216.62407-8-mmc@linux.ibm.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-mo.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-378111-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev 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 Organization: Usenet Network Message-ID: <179649975684.3148.8777282288439223886@kernel.org> References: <20261201190216.62407-8-mmc@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="3107131"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:DbXMIEI1t9xL9ESbCf6fMIYoBoo= sha256:ySFJkzv5UtrkjlMrjnr/adjZG+ZO3BD70izqMaX7D3w= sha1:vMPzTh6/5nn2uv3PtjvbplWn0bw= sha256:YxtgWA21UUO1XvzykyQfz++yWZzenLSNdzoxggkp0OQ= 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 5F671117E9D; Sat, 5 Dec 2026 22:42:54 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.539 X-Spam-Status: No, score=-3.539 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.14, 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 h9su7cpJXvTO; Sat, 5 Dec 2026 22:42:51 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-378111-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 EF1ED117E9C; Sat, 5 Dec 2026 22:42:42 +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 E5D803166C; Sat, 5 Dec 2026 19:42:39 +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=1796499759; b=bkzyJ+quSHf2ra2tAwS6ry9rGw/NIPNKYjfmehsrwf+V0geaTTTCb04JD1E+/XjJQI4B RxcY3Ukc0dBnzna10lV0v6RMdW6QC9L1DG9Qa02TMAVz0+iy6bb3w/M1AsgAgsHmH/B8+ RApP+PCUErgrPGJcPyIIsDZrqTesvFuOLaq4IaPMpv6Q3OSii7U3M3WzkzLEf27GM88XZ gb0S4vOoeqk9wQQV99fkwnWmj6tSmK8ivf2QCNDpVKA8x29WRcRe9S0xUZoeAySn6KHo7 mDYjKfP8Kn2ZtfGKxNRVkB1CQDwrD1LD59oy9mXpH4ByMnYxKWTG/XU25wg2zfHYSGA== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796499759; 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=EJ4uzkx04/Voq8P8nmQ51JDPjSIzBLt3tD9l/MI45V0=; b=HOL6qLwDJIgpw8VgZIf2f4RMh/Zkbn7VUEET09gQfCoMH+YqJJwoeFWtjBWijnLCdWz+ i6pU/gZqujKTJ0gqoHJMaqqPmJBNRilTm3Q/7kO17SwoJKZoTCfivmK1ej+o4s90ixx8C sGcV2+ot92Fqu4SQXni4HkdGoFQ5YnieYkreX/U6rlWdd7H00nnFrdH/XafpXa/9/b2wE gdi8zM6Q1NUG/2nWuqYAs8NqOEvcD0c4gRRoVwJ7EtaJ76lwsWmYqAANdSRrHWnkdRlUw NbTGRKa/ECWkfutBWX/wYuvkCCqx1mtPETJ+8UORPzI55bpoUaVhDN0suQCKtjMG+LQ== 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=obwlr01I; 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 BCDCB606A683; Sat, 5 Dec 2026 19:42:39 +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=obwlr01I 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=1796499758; b=o6UKUmCYpJX51y6iXjgT6oTmgTwQ3NL5WaKISTfQiML3q4WgAQZ0NAtKH5t2jPqs1nm5 QsRegZ36kEr2mHpJSDC0cbmok9SYCGg+zUWtDgZoGva/jpjBrD1uQfll6YCzOuqNBnP/H bQBo9nHU7wElMPJewmm/6+SPl+8WgOZ0DSWi+Pl3eUWh0Q25OuqPh3hYhlGPNOBfZg1IN N1zDCvXdTa78abVEXzxcS3QvwIg8prVVfQZQIcADzw/VwzuciYhrZ7CF4l3ad9DaDhuz3 UmPGi5koNGRONfM+ZuI5ftz+oTxbz+1/i0+cfOiPolXCY3oTJzVpr17DfvFWhjhQ6RA== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796499758; 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=EJ4uzkx04/Voq8P8nmQ51JDPjSIzBLt3tD9l/MI45V0=; b=yK5GQzuA29vasl4mM8fssBlFWCxVAjM1vnK2Gm1uLJOQiWU1Tq0qs0dSmhkH30GxXEUg 9erXKDftNoFauUx1hUJBlzHJYhHugH8E3MqC/kwvw47+1tOe4wW0Dvt+MgkteJL0d8GOT ZV/WKJWdKrdowa2Dt+NQFaumRRNdJYEMVarKcpScsRSrp3KDCpCSNHj9NQK7Tz1XEe9aE bNgwEuLr1uYRraEtS31MT13bNrEntoLI+lolFSGrxc1V37OYo/BHXZZfWvrSH7gJMKLXu DBRleBzRflEAcbqMU7hQ1HTeFdr3d2XkYV+dulfEfJ8qiSJwg8vxsKeGIxrrdu73qrw== 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=obwlr01I; 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 DAE46606A33C for <netdev@vger.kernel.org>; Sat, 5 Dec 2026 19:42:38 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4A7F61F0092B; Sat, 5 Dec 2026 19:42:37 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796499758; bh=EJ4uzkx04/Voq8P8nmQ51JDPjSIzBLt3tD9l/MI45V0=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=obwlr01I9/NIiL86MseTvdFAVt/Cmxi2EAoaNJRgB+b5tMco8EnpN8dkwJYvzmdvn NeY25XIHKSH8Vs9gw3DX6dYIFFzrr9hA926JiZ7p7og809wcEJV1TNWOTnDBpjTe+B Ud2B7NuXqebSOCcOkEVBycXCbhtc7c7xL4o6vrkKQIZScDfu4Iun3rG6hiUO69YyH9 +CqioTw4zvHx83d8hHdz4L+v+g3TU+hO9K0SoRwSgv7pIYKQ9FsADowDFTLJ2uLVlt gSkCKKmBOGQ27x44Qs5G9avslZ5XKWfmZjZoKH9Loahk9c3oYUdXv0e8E3/JY7dlTL 702tsbk4dVltw== X-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 X-In-Reply-To: <20261201190216.62407-8-mmc@linux.ibm.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