From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 78A313AA182; Sat, 30 May 2026 17:37:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780162634; cv=none; b=Y5ALFaET0XBw6BN6NjbUqmO6l6upUSwJ8lCf+nrXZCFOM8AeTsVfBfISY47kFUrKJjn1okqHdTdym43vDjn4Q8l8ulUFqOl3LDXG/wZ8pySuIFk1T5SaUCp6u4EyJHKKwZVMuks5vcLwbQ3ibcDDuqjHflOPExOclNRDIBZt47E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780162634; c=relaxed/simple; bh=u98TIByfKR6Q6dvu8lpPQaFMRwp+Lex6U8JXQvfxatU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Pl42t0FHh8V0NgLjlkF7Y4zV1bUfDlcfxMDkC7Xui4LZGACPRIGHfPo411cO/sCxnhWy+A1yCvnCZXDWERrWM4UAmNFfhRrmvtD7AkZ+myAJF3cwFula+OrGUbe0Hr/76KviGwuERWYbf6bgSJ36B5iiB3qqoi4o4T2mrUphkPs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=nql8+Md5; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="nql8+Md5" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BD05F1F00893; Sat, 30 May 2026 17:37:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1780162633; bh=0kDuYSU9KF6m0bKSoAuDwE058cG00MDNzQwPc7mYoiY=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=nql8+Md51LiHuXJRZupoHC8fGmYfKxHcpg+Zjh7I1Wsv5lyuPkO7h+kcwrGDQLF5Q eqR6tX4H9e+qf220JzmSHpfGt+7iBclUM09aLZqusRHwMEpgYqtegwgNd0ZuLKmxi8 CX77wplM1I/elARilE5cPlOCgo5cT28/GPOqULKA= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Long Li , Michael Kelley , Wei Liu , Sasha Levin Subject: [PATCH 5.15 019/776] PCI: hv: Set default NUMA node to 0 for devices without affinity info Date: Sat, 30 May 2026 17:55:33 +0200 Message-ID: <20260530160240.759842128@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260530160240.228940103@linuxfoundation.org> References: <20260530160240.228940103@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Long Li [ Upstream commit 7b3b1e5a87b2f5e35c52b5386d7c327be869454f ] When hv_pci_assign_numa_node() processes a device that does not have HV_PCI_DEVICE_FLAG_NUMA_AFFINITY set or has an out-of-range virtual_numa_node, the device NUMA node is left unset. On x86_64, the uninitialized default happens to be 0, but on ARM64 it is NUMA_NO_NODE (-1). Tests show that when no NUMA information is available from the Hyper-V host, devices perform best when assigned to node 0. With NUMA_NO_NODE the kernel may spread work across NUMA nodes, which degrades performance on Hyper-V, particularly for high-throughput devices like MANA. Always set the device NUMA node to 0 before the conditional NUMA affinity check, so that devices get a performant default when the host provides no NUMA information, and behavior is consistent on both x86_64 and ARM64. Fixes: 999dd956d838 ("PCI: hv: Add support for protocol 1.3 and support PCI_BUS_RELATIONS2") Signed-off-by: Long Li Reviewed-by: Michael Kelley Signed-off-by: Wei Liu Signed-off-by: Sasha Levin --- drivers/pci/controller/pci-hyperv.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/pci-hyperv.c index ac47a6ee2e93b..7917ed426f6a7 100644 --- a/drivers/pci/controller/pci-hyperv.c +++ b/drivers/pci/controller/pci-hyperv.c @@ -1963,6 +1963,14 @@ static void hv_pci_assign_numa_node(struct hv_pcibus_device *hbus) if (!hv_dev) continue; + /* + * If the Hyper-V host doesn't provide a NUMA node for the + * device, default to node 0. With NUMA_NO_NODE the kernel + * may spread work across NUMA nodes, which degrades + * performance on Hyper-V. + */ + set_dev_node(&dev->dev, 0); + if (hv_dev->desc.flags & HV_PCI_DEVICE_FLAG_NUMA_AFFINITY && hv_dev->desc.virtual_numa_node < num_possible_nodes()) /* -- 2.53.0