Received: by 10.213.65.68 with SMTP id h4csp2148107imn; Sun, 8 Apr 2018 20:58:14 -0700 (PDT) X-Google-Smtp-Source: AIpwx48pUyXur5PJwrRQFX0v1QPFNjxr8GDYwEngfaW3A7I1LXqgS0kgV5TFuSvegjznvsfoMACp X-Received: by 10.98.9.147 with SMTP id 19mr21412774pfj.125.1523246294269; Sun, 08 Apr 2018 20:58:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523246294; cv=none; d=google.com; s=arc-20160816; b=Q7H2qG0w/Otm2jNvsnXSmODxctB7MePofZghZQPMM9RuneG2HzeAwbgZSTil+VghjT Gi4Au7w5Y3Wx78uVIcfYfp5xiCddD5eqQ48pXV9Otz/qGrsxV1gVjjrSG2VAlF8LsJHB uoPkAhurOE5AqpVD4qmrPwImOxWlDZNIZqQLdcD1XClI9uAhX1TTVDJDjcYygguGvV76 /YSya/Wliqx0FGZUDWFFqR0+rszZs9kTNIWtx8c6g9vpP2LL5BEl6TRuKZagpXu5uWkH cDtIceftkoRfI+zLeB3UwG1Z3p0YtYwTDd0akmLD00iqN8rx9//gGf1Oax0qPmJSV+5N VZbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=wuIj+Md4cRu65ZQWeRlw2my8J+ZpPelUPCsjxPGfA6s=; b=t31yiu3TRTGaeNBVCCIjPkREU3Sn1+wpCjHwuVf3UIou2QvwR3z9pReCJj/W7EQFAI jFtVwU7b+vF6plrmOkJFjge9YoAJDsozpkiD72Y8SauSW0SHDVAXNYalnfBYKgvRtwXa 84uYmUGl2E192GZOWgxjZqw4pEHBWG8RH2My61ApDkKfyYCE2RXPloRohtrZYRMM17la RJdy/QIEorSW+VjTE1FwxNxOW76/WkN1H5x9tNMqZEtTqEeiAzw/ZkU1ZdwujnuW+uVg kMni6emGgi8WyPfZ7rpaIxjGnIYlY6J1dwG6NCFqmc8ZWYSOvnm99Hu4pQa+tYoosnaW Dfyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=ozkTilfB; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r25si6539990pfh.2.2018.04.08.20.57.37; Sun, 08 Apr 2018 20:58:14 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=ozkTilfB; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754164AbeDIDwa (ORCPT + 99 others); Sun, 8 Apr 2018 23:52:30 -0400 Received: from mail-by2nam03on0122.outbound.protection.outlook.com ([104.47.42.122]:11088 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753997AbeDIATZ (ORCPT ); Sun, 8 Apr 2018 20:19:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=wuIj+Md4cRu65ZQWeRlw2my8J+ZpPelUPCsjxPGfA6s=; b=ozkTilfB0rsw/ad6W/Ic0UQenwYOi6S9ykIQ7erbzPZi2ZkbtJVp2MVsSdLuTMah6fuzcqfhoyjhlCAiIwvFrH3mtorSqvebkf96pXf88yc3PiAiTiVkEj0WbnyQInAcwRFqFPAGP7F9ANZmCzCllCTNgQFfBWWUHF9Jes7y5pk= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB1063.namprd21.prod.outlook.com (52.132.128.39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.696.0; Mon, 9 Apr 2018 00:19:20 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059%2]) with mapi id 15.20.0696.003; Mon, 9 Apr 2018 00:19:20 +0000 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Michael Bringmann , Michael Ellerman , Sasha Levin Subject: [PATCH AUTOSEL for 4.15 101/189] powerpc/numa: Use ibm,max-associativity-domains to discover possible nodes Thread-Topic: [PATCH AUTOSEL for 4.15 101/189] powerpc/numa: Use ibm,max-associativity-domains to discover possible nodes Thread-Index: AQHTz5g73aKtQWQCLE+tOw18oGdCkw== Date: Mon, 9 Apr 2018 00:18:05 +0000 Message-ID: <20180409001637.162453-101-alexander.levin@microsoft.com> References: <20180409001637.162453-1-alexander.levin@microsoft.com> In-Reply-To: <20180409001637.162453-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DM5PR2101MB1063;7:pIT7JD+vdTTPasOco4ERvk2X9AoozfDWmnG2D4J1Ule2BuYQsoCVoidz5l1/ntTwh21AOBYX3UjL7ry4iD3060EWirUv6qv8WWWY+TGzWmdGder8oVTCXFhq1T/OSKvGtYZ4OAgR318sGNs5jvjxgoGrLRHvb7QLfISYHDRKpNgUECwcCGPTwzEVtsf2qd9U5Al3dSP3DRDUA36WVJAgkn1orRmaWlO6LZr4EgXb8WG2lmxBG9jxG4IulaXFfOBz;20:6lQlr6HFDPvnH8SYYzu6VgsYNXp3TR71XG1suf6xht3bY1/g5ZD//s+W5VdXQ0X3szoWCAZCkWCo5t1plXdHz3FxrIBU4UgAuHXsvJO8f2LD06def6loL5CfQgZBIRyKcwdhqojqRQrAENxDT4ITN2ND+dGBLs1vJvBoBPejaiA= x-ms-office365-filtering-ht: Tenant X-MS-Office365-Filtering-Correlation-Id: fe7818ef-287b-4c3d-b8f8-08d59daf8a3a x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020);SRVR:DM5PR2101MB1063; x-ms-traffictypediagnostic: DM5PR2101MB1063: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171)(209352067349851)(104084551191319); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(61425038)(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(3231221)(944501327)(52105095)(3002001)(10201501046)(6055026)(61426038)(61427038)(6041310)(20161123558120)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(6072148)(201708071742011);SRVR:DM5PR2101MB1063;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB1063; x-forefront-prvs: 0637FCE711 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(346002)(39380400002)(39860400002)(376002)(396003)(366004)(189003)(199004)(2900100001)(6436002)(7736002)(10090500001)(102836004)(3660700001)(6506007)(76176011)(305945005)(4326008)(5250100002)(97736004)(26005)(25786009)(6512007)(2906002)(81166006)(106356001)(107886003)(68736007)(14454004)(86612001)(66066001)(10290500003)(59450400001)(6666003)(5660300001)(81156014)(478600001)(476003)(486006)(6486002)(72206003)(3280700002)(99286004)(105586002)(36756003)(1076002)(2616005)(11346002)(53936002)(446003)(8676002)(186003)(3846002)(54906003)(6116002)(2501003)(8936002)(316002)(110136005)(86362001)(22452003)(22906009)(142933001)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB1063;H:DM5PR2101MB1032.namprd21.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: 7mNeWIf88az962yzbgxcZZodIAzZ2KG5Xy1IQ1Pi6DeUwTGrLpI5s9ZEFvclZXUphCxhqlzT0WlyP8sBcMJBb8wt8CRLOJOdFAOAc0kipWuU7x9HG2fVM7TEGWreh1CtTIudDMh5ri9s/tAILaNx6D5JwbqaaryDq5OD0McKAiNP2eckaSCUeDRsJ9gAZVZJ7raTqkA4k18ZodCv9Bm8FGH9tGLjQyJvwdYgrrWS+wL+xH+OAWkS5cnufA6iTl4rM4nvSwFhnHumCf9UoYj+KiC4TJ3GDCgTHm+ZF0niVM7f3h0HPVz0ZMRavlER4qyir7qJquq+KxCOunkCK+0Z96l7edSIe2bh3xkisMP3IsDAayEgIhywcuovAtGZxX6Bw6kM0j+CDGZBm8/XZMhrbjJ3RbIp2n9wMBH4ch/rZAU= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: fe7818ef-287b-4c3d-b8f8-08d59daf8a3a X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2018 00:18:06.0065 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB1063 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Michael Bringmann [ Upstream commit a346137e9142b039fd13af2e59696e3d40c487ef ] On powerpc systems which allow 'hot-add' of CPU or memory resources, it may occur that the new resources are to be inserted into nodes that were not used for these resources at bootup. In the kernel, any node that is used must be defined and initialized. These empty nodes may occur when, * Dedicated vs. shared resources. Shared resources require information such as the VPHN hcall for CPU assignment to nodes. Associativity decisions made based on dedicated resource rules, such as associativity properties in the device tree, may vary from decisions made using the values returned by the VPHN hcall. * memoryless nodes at boot. Nodes need to be defined as 'possible' at boot for operation with other code modules. Previously, the powerpc code would limit the set of possible nodes to those which have memory assigned at boot, and were thus online. Subsequent add/remove of CPUs or memory would only work with this subset of possible nodes. * memoryless nodes with CPUs at boot. Due to the previous restriction on nodes, nodes that had CPUs but no memory were being collapsed into other nodes that did have memory at boot. In practice this meant that the node assignment presented by the runtime kernel differed from the affinity and associativity attributes presented by the device tree or VPHN hcalls. Nodes that might be known to the pHyp were not 'possible' in the runtime kernel because they did not have memory at boot. This patch ensures that sufficient nodes are defined to support configuration requirements after boot, as well as at boot. This patch set fixes a couple of problems. * Nodes known to powerpc to be memoryless at boot, but to have CPUs in them are allowed to be 'possible' and 'online'. Memory allocations for those nodes are taken from another node that does have memory until and if memory is hot-added to the node. * Nodes which have no resources assigned at boot, but which may still be referenced subsequently by affinity or associativity attributes, are kept in the list of 'possible' nodes for powerpc. Hot-add of memory or CPUs to the system can reference these nodes and bring them online instead of redirecting to one of the set of nodes that were known to have memory at boot. This patch extracts the value of the lowest domain level (number of allocable resources) from the device tree property "ibm,max-associativity-domains" to use as the maximum number of nodes to setup as possibly available in the system. This new setting will override the instruction: nodes_and(node_possible_map, node_possible_map, node_online_map); presently seen in the function arch/powerpc/mm/numa.c:initmem_init(). If the "ibm,max-associativity-domains" property is not present at boot, no operation will be performed to define or enable additional nodes, or enable the above 'nodes_and()'. Signed-off-by: Michael Bringmann Reviewed-by: Nathan Fontenot Signed-off-by: Michael Ellerman Signed-off-by: Sasha Levin --- arch/powerpc/mm/numa.c | 37 ++++++++++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c index 09be66fcea68..87323354b247 100644 --- a/arch/powerpc/mm/numa.c +++ b/arch/powerpc/mm/numa.c @@ -887,6 +887,34 @@ static void __init setup_node_data(int nid, u64 start_= pfn, u64 end_pfn) NODE_DATA(nid)->node_spanned_pages =3D spanned_pages; } =20 +static void __init find_possible_nodes(void) +{ + struct device_node *rtas; + u32 numnodes, i; + + if (min_common_depth <=3D 0) + return; + + rtas =3D of_find_node_by_path("/rtas"); + if (!rtas) + return; + + if (of_property_read_u32_index(rtas, + "ibm,max-associativity-domains", + min_common_depth, &numnodes)) + goto out; + + for (i =3D 0; i < numnodes; i++) { + if (!node_possible(i)) { + setup_node_data(i, 0, 0); + node_set(i, node_possible_map); + } + } + +out: + of_node_put(rtas); +} + void __init initmem_init(void) { int nid, cpu; @@ -900,12 +928,15 @@ void __init initmem_init(void) memblock_dump_all(); =20 /* - * Reduce the possible NUMA nodes to the online NUMA nodes, - * since we do not support node hotplug. This ensures that we - * lower the maximum NUMA node ID to what is actually present. + * Modify the set of possible NUMA nodes to reflect information + * available about the set of online nodes, and the set of nodes + * that we expect to make use of for this platform's affinity + * calculations. */ nodes_and(node_possible_map, node_possible_map, node_online_map); =20 + find_possible_nodes(); + for_each_online_node(nid) { unsigned long start_pfn, end_pfn; =20 --=20 2.15.1