Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1527410pxb; Thu, 16 Sep 2021 09:16:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzYXVgfZE1+qj+ygOCrpArhIXe+KqUuhkBNFvI9GhhgBi64hx+yaQgSgWlr58WJer0xwAqt X-Received: by 2002:a5d:6d8a:: with SMTP id l10mr7039693wrs.121.1631808966322; Thu, 16 Sep 2021 09:16:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631808966; cv=none; d=google.com; s=arc-20160816; b=ikpJN/sKky3e/If7lTh0LuTUZejWzY3ir3mRCVyyAJkoL48Q3ADUSNd4e2n2LCJw2D Hw+d/JsdoEoQB8+hn1Dyid5Z1p5FkWRcyNtN8zOVoLz7dLycTcsk83Q4MVcpnjKcidMq 5VjOD0OrE/i/17GezGGqd4mNMTR1n6U8G9tkQoLx/zQToGzpgQQzLjMRCHhJv6H0uKqk QUqG7TJa602ARE7BTTS/HGtGYNteFn9QKT/+qJFeiPtgegkgdNnZHFfHGIxefhdiFd1n TiRALRKBihJsPk4p/M2hK4Wl8aUyyX7nbE9+fx/yM4JFZYcchJWTN9u98+85ENNir3Rr 0S7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=GG/nGJ5B7rdHwDIZSu4FIlkPEv7sYqOIbTExLtAlChA=; b=aupm5BmHNKinzTmCB/uFTTdF95mk5vr9wMAXYYenEzjHCGnvQH52o3CXMZ32oiI8nS HgdSqcqi5q51RatIq4JR8YGbgpPsxvcOBfG6DxiyMO2+cRD44sdtXd/cpd8udPztiR0G c5Ooaq8CubMjS09cE4RWA+uq5gDfA+mtY3F+cx64WP6kEX7Cly/0vynKKwW+u/phopMi xdVsSAyKe8uaQeiJKe9ZdahoBfNekmBZVPvfvG7U+RxLnJHBkoIPlM2Ns9gQWBgYL+Gi 7LcoyDkcb87uiOFr4D48ON9y+mzQ9FTg5bP55Nt6hCkL0BQ8il7uY493r1hk+lPBqcw+ QvaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=C0KErD8b; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d5si3676465ejm.652.2021.09.16.09.15.40; Thu, 16 Sep 2021 09:16:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=C0KErD8b; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232633AbhIPQNt (ORCPT + 99 others); Thu, 16 Sep 2021 12:13:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:48608 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234948AbhIPQIV (ORCPT ); Thu, 16 Sep 2021 12:08:21 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id C89FD61251; Thu, 16 Sep 2021 16:06:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631808418; bh=+Ykzp3S/c4i5bfjmtv1I9kQLib6/o3VBcPl3qIbBJKM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C0KErD8b6y3FoJ+Zk/WLsPGSAR/X+J/vfIYYIz5Qbe1Aq7t37qYygalqJBRAVIgjb gryp712/XNULnvBtz/EC+1wFsNSUzh3WI4ph55ZRSGyLM/OOeXg3NFEvNJdV2lX8ND fCUGIRPY6QKNuo3nbxUKdnjiG1i0ZGliGHK9QWoQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Laurent Dufour , Srikar Dronamraju , Michael Ellerman , Sasha Levin Subject: [PATCH 5.10 084/306] powerpc/numa: Consider the max NUMA node for migratable LPAR Date: Thu, 16 Sep 2021 17:57:09 +0200 Message-Id: <20210916155756.910811589@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210916155753.903069397@linuxfoundation.org> References: <20210916155753.903069397@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Laurent Dufour [ Upstream commit 9c7248bb8de31f51c693bfa6a6ea53b1c07e0fa8 ] When a LPAR is migratable, we should consider the maximum possible NUMA node instead of the number of NUMA nodes from the actual system. The DT property 'ibm,current-associativity-domains' defines the maximum number of nodes the LPAR can see when running on that box. But if the LPAR is being migrated on another box, it may see up to the nodes defined by 'ibm,max-associativity-domains'. So if a LPAR is migratable, that value should be used. Unfortunately, there is no easy way to know if an LPAR is migratable or not. The hypervisor exports the property 'ibm,migratable-partition' in the case it set to migrate partition, but that would not mean that the current partition is migratable. Without this patch, when a LPAR is started on a 2 node box and then migrated to a 3 node box, the hypervisor may spread the LPAR's CPUs on the 3rd node. In that case if a CPU from that 3rd node is added to the LPAR, it will be wrongly assigned to the node because the kernel has been set to use up to 2 nodes (the configuration of the departure node). With this patch applies, the CPU is correctly added to the 3rd node. Fixes: f9f130ff2ec9 ("powerpc/numa: Detect support for coregroup") Signed-off-by: Laurent Dufour Reviewed-by: Srikar Dronamraju Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20210511073136.17795-1-ldufour@linux.ibm.com Signed-off-by: Sasha Levin --- arch/powerpc/mm/numa.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c index f2bf98bdcea2..094a1076fd1f 100644 --- a/arch/powerpc/mm/numa.c +++ b/arch/powerpc/mm/numa.c @@ -893,7 +893,7 @@ static void __init setup_node_data(int nid, u64 start_pfn, u64 end_pfn) static void __init find_possible_nodes(void) { struct device_node *rtas; - const __be32 *domains; + const __be32 *domains = NULL; int prop_length, max_nodes; u32 i; @@ -909,9 +909,14 @@ static void __init find_possible_nodes(void) * it doesn't exist, then fallback on ibm,max-associativity-domains. * Current denotes what the platform can support compared to max * which denotes what the Hypervisor can support. + * + * If the LPAR is migratable, new nodes might be activated after a LPM, + * so we should consider the max number in that case. */ - domains = of_get_property(rtas, "ibm,current-associativity-domains", - &prop_length); + if (!of_get_property(of_root, "ibm,migratable-partition", NULL)) + domains = of_get_property(rtas, + "ibm,current-associativity-domains", + &prop_length); if (!domains) { domains = of_get_property(rtas, "ibm,max-associativity-domains", &prop_length); @@ -920,6 +925,8 @@ static void __init find_possible_nodes(void) } max_nodes = of_read_number(&domains[min_common_depth], 1); + pr_info("Partition configured for %d NUMA nodes.\n", max_nodes); + for (i = 0; i < max_nodes; i++) { if (!node_possible(i)) node_set(i, node_possible_map); -- 2.30.2