Received: by 2002:a05:7208:3003:b0:81:def:69cd with SMTP id f3csp4115761rba; Tue, 2 Apr 2024 08:04:12 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVlQbnEc197OtMTproJZuLqwtZMX7Lf/yfkfaENDMcDuFwfjTXSBRNxgfsJzHJXfvmR+EDDvV2QnBoQuoOnVQB/LdWR3rpK5rCMaS2PtA== X-Google-Smtp-Source: AGHT+IH30E00FhcyEKEAkL9EZv7umCNmaM4YWMhK6mLLFQ11fOeZRZIi3ztpOJrpeFNqvsr3zvmq X-Received: by 2002:a50:9318:0:b0:568:aa14:37a9 with SMTP id m24-20020a509318000000b00568aa1437a9mr1342209eda.24.1712070252520; Tue, 02 Apr 2024 08:04:12 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712070252; cv=pass; d=google.com; s=arc-20160816; b=YB/D68MVl2rBgg4F8ySDWofwMCmORJaDFLYHmQoKlf7C8+5jPNvyh3MWuMXooJN9Ry fhj3Z9LQlnFwWLZd1gkMrleICK9PHw1I2ub4L7Ro1us197cC6fh8ZvFo3oPxzm71XaLm AEJJij5xoGV/uIj6KQ2YokKFct+ySn8aEDH3J15dCYN6bcZ508e0P3ZmnGiV8zTVKVG/ KTOLRKHvmmUlU8BNA6PHFUp2gN88ffEGYwwePmVG1OdhqwDqYA6TuXZ595ogmQIcT8b5 2QkSZF5n4ZX+NoIrgx5cx4TaU/BjiFCWQk2RZbjeaKEKoqikfMAhNJTWmlsIq9KnmzSr aSUQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-id:precedence:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :dkim-filter; bh=4LDBkzPb2RKVpqmA4ytrM1NP9pKwE8D6bhLFAbKn0cs=; fh=n4h09EWmgcgwUsm1J3EKhpD0kxed3TAfv9Bq4l7xUng=; b=MqL3PWkmdYxGpQ7q+EUrBRPgmiVAmExph1QL38jNBuSQlYs6iTja9TpD2EsVS60jq2 LGoS4d476qavZsdf+fS7pucCD55zS+gPdcQ8CyXWL+KMHf92qYjmw0c1/Lgrei4WgBnh w6mEYl0brP7ZfoqwgvPJBnPUke1Z+8VcIsv425UAgNwPjz6blhnZb6cqH3hQ5HKiPLaF aIZkdiSLde1Wc0mCPSeV0zGwxdHFRJbfzOXhl0fRi2WZXHelG7U40GjncMOSt4YX3qEI OH3sQBfBM7uteY27iTQwNu/ImhYVJ5X5CBPGgum5s9TSVtW/pcnhenntH4Om4U1a24g5 RY9w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=m7loHZSH; arc=pass (i=1 spf=pass spfdomain=linux.microsoft.com dkim=pass dkdomain=linux.microsoft.com dmarc=pass fromdomain=linux.microsoft.com); spf=pass (google.com: domain of linux-kernel+bounces-128181-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-128181-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id z13-20020a056402274d00b0056884c7dca7si5818897edd.203.2024.04.02.08.04.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Apr 2024 08:04:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-128181-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=m7loHZSH; arc=pass (i=1 spf=pass spfdomain=linux.microsoft.com dkim=pass dkdomain=linux.microsoft.com dmarc=pass fromdomain=linux.microsoft.com); spf=pass (google.com: domain of linux-kernel+bounces-128181-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-128181-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 6C5911F266C8 for ; Tue, 2 Apr 2024 14:45:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3505113C67C; Tue, 2 Apr 2024 14:40:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.b="m7loHZSH" Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B98E913A252; Tue, 2 Apr 2024 14:40:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=13.77.154.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712068836; cv=none; b=gdRqykrTz+ITRu1j/KkfMPuuS1FWoZ8z6xSH71Q35UOY3CSpoDXx3LaGOrZfv3qfsGW25m2cxijKtyS3ZKxvRV7TA9IbCayLnignO5M/S+ncxwUxNNLIOnw7At1cXDLvzD3tZ7sfvAWCiuCtMABqxUpC366KcC+kHsLLeuJYEac= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712068836; c=relaxed/simple; bh=Jsd3zd17n/TDUkNXvdKZWgOsivzIMCoQWiDVfCJsJDE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=PJn0p+YbnY9u65wiIjlEjIGorBerVDDjEzim4CRMwCDkZpLuD0mOagOFxBpYv+ZVlKdNCJ0rMMFIjjbMNmZ2YHZMTkgJ3mmF10aGSoGwuf/yUW6CK+W/72fK05GCjGYkJm07t/drxaSsBXuD6bEhtTPXMt1k0UBreyK1bXbHPQw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.microsoft.com; spf=pass smtp.mailfrom=linux.microsoft.com; dkim=pass (1024-bit key) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.b=m7loHZSH; arc=none smtp.client-ip=13.77.154.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.microsoft.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.microsoft.com Received: from linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net (linux.microsoft.com [13.77.154.182]) by linux.microsoft.com (Postfix) with ESMTPSA id 4D8F420E8BE0; Tue, 2 Apr 2024 07:40:34 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 4D8F420E8BE0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1712068834; bh=4LDBkzPb2RKVpqmA4ytrM1NP9pKwE8D6bhLFAbKn0cs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m7loHZSHvBjrkymqt3U0h6AmgggT1Xh3eRQqI3Vitz/jefURPPVRjFFO2O6F0Td/t fAH1XMAqrBWkV8rshpvZwlsxZG1Zn0gfslUnG9xjH+eND3m8SAwhwNDYgFqWXEe43l 2o2MVk1YwtGgHGpQ2MtWfXzR3PK/i631M7R1BCkU= From: Saurabh Sengar To: kys@microsoft.com, haiyangz@microsoft.com, wei.liu@kernel.org, decui@microsoft.com, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, peterz@infradead.org, sboyd@kernel.org, linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org Cc: ssengar@microsoft.com Subject: [PATCH v2 3/4] x86/of: Map NUMA node to CPUs as per DeviceTree Date: Tue, 2 Apr 2024 07:40:29 -0700 Message-Id: <1712068830-4513-4-git-send-email-ssengar@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1712068830-4513-1-git-send-email-ssengar@linux.microsoft.com> References: <1712068830-4513-1-git-send-email-ssengar@linux.microsoft.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Currently for DeviceTree bootup, x86 code does the default mapping of CPUs to NUMA, which is wrong. This can cause incorrect mapping and WARN on a SMT enabled systems like below: CPU #1's smt-sibling CPU #0 is not on the same node! [node: 1 != 0]. Ignoring dependency. WARNING: CPU: 1 PID: 0 at topology_sane.isra.0+0x5c/0x6d match_smt+0xf6/0xfc set_cpu_sibling_map.cold+0x24f/0x512 start_secondary+0x5c/0x110 Add the set_apicid_to_node() function in dtb_cpu_setup() for allowing the NUMA to CPU mapping for DeviceTree platforms. Signed-off-by: Saurabh Sengar --- arch/x86/kernel/devicetree.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/x86/kernel/devicetree.c b/arch/x86/kernel/devicetree.c index 0d3a50e8395d..b93ce8a39ff7 100644 --- a/arch/x86/kernel/devicetree.c +++ b/arch/x86/kernel/devicetree.c @@ -24,6 +24,7 @@ #include #include #include +#include #include __initdata u64 initial_dtb; @@ -137,6 +138,7 @@ static void __init dtb_cpu_setup(void) continue; } topology_register_apic(apic_id, CPU_ACPIID_INVALID, true); + set_apicid_to_node(apic_id, of_node_to_nid(dn)); } } -- 2.34.1