Article View: linux.kernel.netdev
Article #7726[RFC 05/11] eth: libwx: restore the device's NUMA node after ring allocation
From: Jakub Kicinski
Date: Tue, 27 Oct 2026 02:25
Date: Tue, 27 Oct 2026 02:25
51 lines
9571 bytes
9571 bytes
wx_setup_{rx,tx}_resources() temporarily switch the device to the node
of the ring's q_vector to allocate the descriptor ring there. The
original node is only restored if the allocation fails. When it
succeeds the device is left on the node of the last ring allocated,
or on NUMA_NO_NODE for rings without a q_vector. Everything allocated
for the device afterwards, and anything else consulting the device's
node, sees the wrong node.
Restore the node right after the allocation, regardless of the result.
Fixes: 850b971110b2 ("net: libwx: Allocate Rx and Tx resources")
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
drivers/net/ethernet/wangxun/libwx/wx_lib.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/wangxun/libwx/wx_lib.c b/drivers/net/ethernet/wangxun/libwx/wx_lib.c
index dcbf5811046e..dc31e3bc15aa 100644
--- a/drivers/net/ethernet/wangxun/libwx/wx_lib.c
+++ b/drivers/net/ethernet/wangxun/libwx/wx_lib.c
@@ -2910,11 +2910,10 @@ static int wx_setup_rx_resources(struct wx_ring *rx_ring)
set_dev_node(dev, numa_node);
rx_ring->desc = dma_alloc_coherent(dev, rx_ring->size,
&rx_ring->dma, GFP_KERNEL);
- if (!rx_ring->desc) {
- set_dev_node(dev, orig_node);
+ set_dev_node(dev, orig_node);
+ if (!rx_ring->desc)
rx_ring->desc = dma_alloc_coherent(dev, rx_ring->size,
&rx_ring->dma, GFP_KERNEL);
- }
if (!rx_ring->desc)
goto err;
@@ -3019,11 +3018,10 @@ static int wx_setup_tx_resources(struct wx_ring *tx_ring)
set_dev_node(dev, numa_node);
tx_ring->desc = dma_alloc_coherent(dev, tx_ring->size,
&tx_ring->dma, GFP_KERNEL);
- if (!tx_ring->desc) {
- set_dev_node(dev, orig_node);
+ set_dev_node(dev, orig_node);
+ if (!tx_ring->desc)
tx_ring->desc = dma_alloc_coherent(dev, tx_ring->size,
&tx_ring->dma, GFP_KERNEL);
- }
if (!tx_ring->desc)
goto err;
--
2.56.0
Technical Details
Message-ID:
<20261027022528.633359-6-kuba@kernel.org>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-352187-linux-kernel-netdev=dewy.ruReferences:
<20261027022528.633359-1-kuba@kernel.org>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-352187-linux-kernel-netdev=dewy.ru From: kuba@kernel.org (Jakub Kicinski) Newsgroups: linux.kernel.netdev Subject: [RFC 05/11] eth: libwx: restore the device's NUMA node after ring allocation Date: Mon, 26 Oct 2026 19:25:22 -0700 Organization: Usenet Network Message-ID: <20261027022528.633359-6-kuba@kernel.org> References: <20261027022528.633359-1-kuba@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="1448548"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:XZLV4BWHzH/ot1pl43LygIH0a7Y= sha256:htpQCsB4FiKsGvseaUlsFIG/GXlpp9nStgLOyNsEzaw= sha1:wEGdoS8/ZfFZdC1mjUeA3Lu4zCc= sha256:RmFC+nG/2LSuG6aKL64XopBKdt2veKlQEiu/274aRMM= 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 13B68125BD8; Tue, 27 Oct 2026 05:28:59 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.739 X-Spam-Status: No, score=-3.739 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.339, 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] 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 U8_AYetK27nv; Tue, 27 Oct 2026 05:28:55 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-352187-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 900E0125AD8; Tue, 27 Oct 2026 05:28:46 +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 150302C01B; Tue, 27 Oct 2026 02:26:11 +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=1793067970; b=c21LAgLUk+/kUwzNc/5N9r+bmQL8Ef4NYoPhrZsiWrNvtueRS8vKXaiFL1DRbrywwTuN 4eA9x+lEbseORuRJaa090PlPvYvDPdg9W+rXR23y/0t1OVcexOyXBTwRugjoN1oM8M/aG CqyT7IE438qgufO7igfrwn9vBFD5okHFDpMM66fI3nnAMNcf1w47A6mxPS0TY5QY0171H v5X5HOmtGWfc6p5YZt6GOCuhC/8RJbr8IQ+mcSWFwNim617nhv3pE2ov+mO7ONRAX9/EC rkBrHnnBdre0NuDFq/1uaItNPmSmUaY7b9q9vycQL7ZfBUuGQB3biA7doQteSJq67Vw== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793067970; h=X-Original-To:Received:Received:DKIM-Signature:From:To:Cc:Subject: Date:Message-ID:X-Mailer:In-Reply-To:References:X-Mailing-List: List-Id:List-Post:List-Help:List-Subscribe:List-Unsubscribe: List-Owner:Precedence:MIME-Version:Content-Transfer-Encoding; bh=FRi7a53vSaUstI4lBZCZ5kGYojGuHTb3PT4gnA7kik0=; b=D1d/hRoMpycHGHf0WavKCI3FtGTm/OMl6KdkQ+BamNdFQKQ/ECVuFwJoAQyWm5BP1UO9 Sz8OjCRbV0F7YaUdreA8eg3FIq42sY6yDhpoR4dX3dQ4+UkK7HO9XKQPFFXc1C1b56NuN z2vLsnuIDSah9kkqO9TZ12wOQUvhGJgOSIPbJMIz0aEMRJBtKwLZ9NjWnvkw2IfaI+qki R7NN4oR8PNXg4/i2gCVi/hX8hmd7qUibDV8zXNJ5CFIi49YraZoXnPydN+FUKWdM+V47o SdZA4zJMjkb2vFJVzOfMSPTH2GSYgztQmFqyEYftF9pLPYc0zuEORp9kDKd+y+G2t3A== 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=CB+oOqUf; 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 C3DF3606A333; Tue, 27 Oct 2026 02:26:10 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=CB+oOqUf 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=1793067970; b=zO868NlXv4Hng1F+Vl+O+RkDtpEpkv2RBLa5FWA6UCVieeLViUntQSi7YisOk0N89PpW UHfwZIqp/ay9tCuFuHK0qhZR6TqFs97dCVGyHkpxTWkSFDmRVjAY4p4ps0bN2ymPm6nZl tsf+/DJ+dg+wWzx3wJ8tuVz5yOGvecC96lwwBSJ62jRulomYTDuWpWflXMNQ77n3ycZcJ 0Caig1/SqNZGUsvXWkczrP+OLoLXAw04g1YrBT3xRRa5G7Wl8X7zhFoTNvv5b2Hmv59U7 ZWB5a3Dn4o5W1Q7Wg5h4kbikg8wKXjRWRqBi1mQOs8dr3igFRVG41o8O7jSHTrvjSPA== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793067970; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:MIME-Version:Content-Transfer-Encoding; bh=FRi7a53vSaUstI4lBZCZ5kGYojGuHTb3PT4gnA7kik0=; b=kdY0nYcrA+cTCT/c7bDJdoKOSdEZrDjEk6hnrd/BK8WGClmOJNMILt0xDd7lSdhtYfao 3dPPsTG0/e52iaBMiqNGnCOYVX41hPW02ZLyTKQfPZPIgIueQA5RvUpqxUJbwK6NSFLC6 TPdc9QBbpec3KVkn4wq0ObC/+VHAP3a1c5QuQCMhsFH1GOpPyoFiA5z3JVshMpUuty06+ PhC6KptWcd7kk4QqR3uCFE00tXP+3JK8BkkeOnyHVVu8fK2j8fPwgKYYlmKozQEvKGNb9 KAlmYQLdtX+tnQyhSnm89vCjxeDoB+erpMaGJwaaKqqRVjKdlFSOcX0An/AZ3fGbwzw== 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=CB+oOqUf; 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 AB277606A33D; Tue, 27 Oct 2026 02:26:09 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 276361F01828; Tue, 27 Oct 2026 02:26:09 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1793067969; bh=FRi7a53vSaUstI4lBZCZ5kGYojGuHTb3PT4gnA7kik0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=CB+oOqUfQcdBlBk/zZOKUmENcRO35PO9xw+/Y2uoeigvEtSLJyC5gvDWvHOAQCSgU iezxiTQHc9ykZnb/Gd0pqaFKdN4kNk30rzR3syTqI8UdbSoTXcgecIl7GfGImy0zSh 57hgNVEzGVLFjPiO69UiaT5DF8GX++Y3dFIW4OKmZTjeZNDMI60lNVrwcD0/t3nmsu T67fyAGG+itp5sYU7yS4/SOpkzCkjmWcs1LnjuTbIDCxjOT0uYD/URYVNqvsfGwOfi kSv5PY1dk63MJS1RO4PMyf8E1SXz4ID8Pdg+3AkJLT3zMAOpMAxjARBjPMphwMg3gA TVJ0zN0I7+Rcg== X-Cc: tglx@kernel.org, dave.hansen@linux.intel.com, x86@kernel.org, joro@8bytes.org, will@kernel.org, leon@kernel.org, mbloch@nvidia.com, iommu@lists.linux.dev, netdev@vger.kernel.org, Jakub Kicinski <kuba@kernel.org> X-Mailer: git-send-email 2.56.0 X-In-Reply-To: <20261027022528.633359-1-kuba@kernel.org> 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