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=1796499757; b=2lU1ImtaO5zGyPbUs8177ARycUuk8pHVkwb2wVEeobaptzA29O8NLeXxjK2165UNxITY 5kf1iF4rSpbx1EwhJcXnBoo+laeHfoVljtaum7Z0xx0HZ7R+Ooe99DjuKnMmrul5L4Gia Ghn1s6oIqKhU2IXeyNcP1WgP1DMPkn8kNUqtaohaciTL/67lAwMPhz69CxMHjdBP1QHpF K42lnP62xzNav4pw3q/Zkc6jzzCHeXaDtt1VlzF+WdwL/J72fNafgY2J3La1MOf4YBOOk t/8Fy8Bi37h7Z/EMIYLZfV8WdTEzsTGVrDCfrgujk9BlqxfBJgCiHB39CorD/HMj2xg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796499757; 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=pNez4eAKME26Qc1Myj/xPl1RxBKjBvP2Tsn0z/DDpIM=; b=KhnxqoGTPVISoVtLLCBrASSJzlR6Yn04wooDMFdFt5jwHN9D/F+NEWWaA3ysVbsixjCn aX0q0AaLzgrwA77jt6kKAUSxH3/XaOtgji0g8FxtUyTEFpJpK4a4/Q/rqTrHMt9iN/p7u Uzy25btfs4BMwx5MfLNP+cb0+Ob8h3lZVYv0fXQfkviKhMiYy1SOub1P2DSOnQ8IKuzfi 2D29bRaHxI9jQIrq/wCJcZhRKAPS9xTB91rnZ0GGAujf321UWxM4z70/ISb51f7tPvtFO yJdks4nL/lQjRGxsOvZYvd0Dfw6avACmZwQqoqRWnPxHWphsD+m4F7DgNfzZrNIeAOw== 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=H1PI52sc; 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 18271606A682 for ; Sat, 5 Dec 2026 19:42:36 +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=H1PI52sc Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7B5CE1F0092B; Sat, 5 Dec 2026 19:42:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796499756; bh=pNez4eAKME26Qc1Myj/xPl1RxBKjBvP2Tsn0z/DDpIM=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=H1PI52sc1p4aQOJ9828Fpqy8yKv27LVBRfI1wAj+bqWlXgrFlh548boqu6B35efhz cHE56/XvCKcPfegW29JH4i3KS/FndGIzYK3zRTBbz3W9WsiIm2WYVj9UX7WtW2+2R0 tHWJj0H48GcrKBPfkFzynzPCH64bpqlvnv46U82c+Yk+StTvs0+Yz8oXFdlTMCTLFz UxHx9gYgKI4SkbVH5gkbnE5P+kaZ2dB6KByjLX0flyGot6gh76wlK8Cb67dDK3rzM6 98eQPpiqybkyM3W15MBxTKpxzneA5AajRuzcAtVnHUFlk9/gyBiYlntsjJX0sI40xJ MYuJ3WWzAneRA== Subject: Re: [PATCH net-next v9 05/13] ibmveth: Register subordinate RX queues 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:35 +0000 Message-ID: <179649975501.3148.9601292630063618554@kernel.org> In-Reply-To: <20261201190216.62407-6-mmc@linux.ibm.com> References: <20261201190216.62407-6-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] In MQ mode, ibmveth_free_all_queues() (drivers/net/ethernet/ibm/ibmveth.c) calls ibmveth_leak_rx_memory()… - [Low] ibmveth_leak_rx_memory() in drivers/net/ethernet/ibm/ibmveth.c prints adapter->num_rx_queues, which struct ibmveth_adapter declares… -- ibmveth: Register subordinate RX queues This patch prepares for multi-queue RX. In multi-queue mode it registers RX queues 1..N-1 with H_REG_LOGICAL_LAN_QUEUE after queue 0 and maps each queue's interrupt. It also leaks the RX memory, instead of freeing it, when H_FREE_LOGICAL_LAN fails with anything other than H_PARAMETER. > diff --git a/drivers/net/ethernet/ibm/ibmveth.c b/drivers/net/ethernet/ibm/ibmveth.c > index 236992ded33a9..5783c0ce34a35 100644 > --- a/drivers/net/ethernet/ibm/ibmveth.c > +++ b/drivers/net/ethernet/ibm/ibmveth.c [ ... ] > @@ -1228,12 +1258,49 @@ static long ibmveth_register_logical_lan(struct ibmveth_adapter *adapter, > return rc; > } > > +/** > + * ibmveth_leak_rx_memory - Keep the RX memory PHYP may still own > + * @adapter: ibmveth adapter structure > + * > + * Forgets each queue's ring, buffer list and pool buffers and the filter > + * list without unmapping or freeing them, so the free paths skip them > + * and their TCEs are not reused by later mappings. > + */ > +static void ibmveth_leak_rx_memory(struct ibmveth_adapter *adapter) > +{ > + struct ibmveth_buff_pool *pool; > + int i, j; > + > + netdev_err(adapter->netdev, "leaking RX memory of %d queues\n", > + adapter->num_rx_queues); [Severity: Low] This isn't a bug, but num_rx_queues is declared as unsigned int in struct ibmveth_adapter. Should this be %u instead of %d? > + > + for (i = 0; i < adapter->num_rx_queues; i++) { > + adapter->rx_queue[i].queue_addr = NULL; > + adapter->buffer_list_addr[i] = NULL; > + adapter->buffer_list_dma[i] = 0; > + for (j = 0; j < IBMVETH_NUM_BUFF_POOLS; j++) { > + pool = &adapter->rx_buff_pool[i][j]; > + pool->free_map = NULL; > + pool->dma_addr = NULL; > + pool->skbuff = NULL; > + } > + } > + adapter->filter_list_addr = NULL; > + adapter->filter_list_dma = 0; > +} [ ... ] > @@ -1243,6 +1310,68 @@ static void ibmveth_free_all_queues(struct ibmveth_adapter *adapter) > if (lpar_rc != H_SUCCESS) > netdev_err(adapter->netdev, > "h_free_logical_lan failed: %ld\n", lpar_rc); > + > + if (lpar_rc != H_SUCCESS && lpar_rc != H_PARAMETER && > + adapter->multi_queue) > + ibmveth_leak_rx_memory(adapter); > +} [Severity: Medium] Can this abandoned RX memory ever be reclaimed? ibmveth_leak_rx_memory() clears these fields: - rx_queue[i].queue_addr - buffer_list_addr[i] and buffer_list_dma[i] - each pool's free_map, dma_addr and skbuff arrays - filter_list_addr and filter_list_dma The driver keeps no other record of them. The rings, buffer list pages, filter page and every pool skb therefore stay allocated and DMA mapped until reboot. On the next open(), ibmveth_register_logical_lan() fails against the still-registered LAN, so it frees the LAN and retries: if (rc != H_SUCCESS && try_again) { rc = ibmveth_free_logical_lan(adapter); try_again = 0; goto retry; } If that free succeeds, PHYP no longer owns the old memory. Nothing goes back to unmap and free it. Could these leaks also pile up? ibmveth_close() calls ibmveth_free_all_queues() on every close/open pair. These pairs come from ibmveth_reset(), the MTU change, pool sysfs, set_csum and set_tso paths. The open() error paths (err_unregister and out_unregister_queues) call it too. Each later H_FREE_LOGICAL_LAN failure would abandon another full set of RX memory, and nothing limits the total. Once "ibmveth: Enable multi-queue RX" is applied, that commit's message puts this at about 270 MB for 8 queues. The held TCEs would also shrink the space left for later dma_map_single() calls in replenish and TX LTB setup. The commit message says PHYP fails H_FREE_LOGICAL_LAN only with H_PARAMETER. If so, this path is dead, but the driver cannot check that. multi_queue is not set in this commit, so the path only becomes reachable later in the series. The logic is the same at the end of the series. The commit message says the leak is intended: MQ mode then leaks the RX memory, still mapped, so whatever PHYP still writes lands in memory nothing else uses. Should it also say that this memory is never reclaimed and that repeated close/open cycles can leak more sets? -- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261201190216.62407-1-mmc%40linux.ibm.com