🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #27487

Re: [PATCH net-next v9 05/13] ibmveth: Register subordinate RX queues

#27487
From: netdev-bot+sashiko
Date: Sat, 05 Dec 2026 19:42
140 lines
13217 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] 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
Technical Details
Message-ID: <179649975501.3148.9601292630063618554@kernel.org>
Path: mbox-mo1.pugleaf.net!news-lon.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.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-378110-linux-kernel-netdev=dewy.ru
References: <20261201190216.62407-6-mmc@linux.ibm.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lon.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.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-378110-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v9 05/13] ibmveth: Register subordinate RX queues
Date: Sat, 05 Dec 2026 19:42:35 +0000
Organization: Usenet Network
Message-ID: <179649975501.3148.9601292630063618554@kernel.org>
References: <20261201190216.62407-6-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="3107184"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:AGvN+xiO2gU8gjXciq3G6KD+A18= sha256:HNyLiWiKvUY3MEQma6OgPpJj8JBBiBiiVEZQsb1b3ro=
	sha1:09MlVlebI6CB77cRaKkA1sxeh0o= sha256:pITts5c0AOIx397dgboHwAYebenKP6nDLr3UOLg+emk=
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 5B983117EA2; Sat,  5 Dec 2026 22:42:57 +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 iNkO-xvERP50;
	Sat,  5 Dec 2026 22:42:50 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-378110-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 28755117E02; Sat,  5 Dec 2026 22:42:40 +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 1E49D3167D; Sat,  5 Dec 2026 19:42:38 +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=1796499758;
	b=hRmIgmvJTABTj+IpegV8y/R5nABMNPQxgRS0/KpoLnEEcCoc3jhFLXMqKZzgk1mKXB9P
	 Jc82GgkAAYRidU3kcJ1+ItaOHzSdZTSRN/XuKuL+/aYtpAGgPQfzlWZXptUJBVVdy0HB+
	 SYUh5xpHDhHjhCp7wh1HUA5ekvo0od/Hm1NBz3x2B1E2+9JpZv/VUsgJIt93EEVe/H6xD
	 IQHGt1LjaKUOMFqxw/sOYIky2oUn2tRXXV6Y9p7+MslncOv7YZG2q35qKF9z2gQBoAq4e
	 4NAp9lH/QXrsxlmQDHSH7Ct0F8ijPntGH2m5tZzCV1o94p8GlpoKqlTz35LitDDhfqQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796499758;
	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=pNez4eAKME26Qc1Myj/xPl1RxBKjBvP2Tsn0z/DDpIM=;
	b=lQjthAnm9d1CwAR4vBWVbtC8v8qtjLhy5PxS3rWUerZKYR5piKbNd8qZpQbnBV1HWFl0
	 op7bQCB4JTzbDvM0eTcaRp3OtSsmV12czWVV3suuOb9Ed49cN5wpNJP5XGOWUrkVqc8XH
	 NC+a14xfod+E8paFlse3HfSFG0mbYFMlpJDMswb53IP3V9eFYPu5khucXhOsF7BUqiBlG
	 RDRuDDQCkcxzrzp/qru+y6WIdUK9uqes5QZbekqxmy3N1N0MkIZfwAJayzfbduH3Dsxil
	 sKsSn3O7FYTzycVgNC8k3eLFNbAJ22rW1Tf9Qo14Y6bIKiSmvUqDRODR4DDGhFNOVEA==
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=H1PI52sc;
	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 EB827606A688;
	Sat,  5 Dec 2026 19:42:37 +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=H1PI52sc
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=1796499757;
	b=2lU1ImtaO5zGyPbUs8177ARycUuk8pHVkwb2wVEeobaptzA29O8NLeXxjK2165UNxITY
	 5kf1iF4rSpbx1EwhJcXnBoo+laeHfoVljtaum7Z0xx0HZ7R+Ooe99DjuKnMmrul5L4Gia
	 Ghn1s6oIqKhU2IXeyNcP1WgP1DMPkn8kNUqtaohaciTL/67lAwMPhz69CxMHjdBP1QHpF
	 K42lnP62xzNav4pw3q/Zkc6jzzCHeXaDtt1VlzF+WdwL/J72fNafgY2J3La1MOf4YBOOk
	 t/8Fy8Bi37h7Z/EMIYLZfV8WdTEzsTGVrDCfrgujk9BlqxfBJgCiHB39CorD/HMj2xg==
X-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==
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=H1PI52sc;
	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 18271606A682
	for <netdev@vger.kernel.org>; Sat,  5 Dec 2026 19:42:36 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7B5CE1F0092B;
	Sat,  5 Dec 2026 19:42:35 +0000 (UTC)
X-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==
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-6-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