From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 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== 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== 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 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 ; Sat, 5 Dec 2026 19:42:38 +0000 (UTC) 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 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4A7F61F0092B; Sat, 5 Dec 2026 19:42:37 +0000 (UTC) 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== Subject: Re: [PATCH net-next v9 07/13] ibmveth: Add the MQ RX buffer submit hypercall 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 Date: Sat, 05 Dec 2026 19:42:36 +0000 Message-ID: <179649975684.3148.8777282288439223886@kernel.org> In-Reply-To: <20261201190216.62407-8-mmc@linux.ibm.com> References: <20261201190216.62407-8-mmc@linux.ibm.com> X-sashiko-severity: Medium Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 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