Received: by 10.213.65.68 with SMTP id h4csp2122393imn; Sun, 8 Apr 2018 20:15:19 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+mW+y1OvMqO8AvSczoZ9jJQaeJGt6hnAaTcZrHXEzrWkifX30zAjL7K31aCt/xoSumszaB X-Received: by 10.99.53.6 with SMTP id c6mr24160209pga.413.1523243719878; Sun, 08 Apr 2018 20:15:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523243719; cv=none; d=google.com; s=arc-20160816; b=Tk9KCMxIZF5rOOZXIfiw7JSD+0cpA6v6qynU4GZ+0gRGgNSouWP8u5ttlsrWr02pCq 4A0tv3/opi21MUKmIvKAITzPNQJGvzAxecwpwIf+OtL2VWlkEcc691rm4AjvVxFayLYu sZbCfbtZB1e8J4CHswlH6KYkRyB5FnBLcC1f2YhXTlq2dR6iSRG4FySHgQwW/V/rcmkk t5LVfZLOAsz3KC096gyPZlHLElI34S5jN1GsNkVigdvA3IqAqgH8if+z0RyYyIJ3i2di XbAFEtCff4cCimhrdS886cXuwUY5l4DcO/k7hPtXYlVpjqsWM8jaKyH3gx8Gb62pf7uw D/qw== 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=GpgwTnZvgcOvoHX0IFI972C02enF+LOy/J5Z5yzE3lM=; b=sQ6uvVln7T/p8876PIJ/Ko1BaeFNvn4ULgomaG2gTMXf+sCeAjZE1owcjcbDtsvNxq Za0qn7zcJ+ZWi2JhiM5rNyNVM75hK9ZGFDxgL1gl84zDJS6ogJyn633JgxDTnnmVV5pq JOHdZyc2Ug+2JF1akpdJJFhfOvlRz72+qbIUU3pDGTjDaGWRLbvt0mk7ydIITL13NvIS rfZUHe1UfeJFhKA+cBhQyJeSNWfxvgkjGRe5rcrGBR4MqUrcGyidD/bmgaZ5Vs8jFcHX 7rF9e/kehpYb752cpUVHnUg+A2VxpbV+sqa7KyNaJL68qFmRb9Iv3nsASOtptFTHKWbn RSig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=OgOuB2t1; 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 m3-v6si193360plb.4.2018.04.08.20.14.43; Sun, 08 Apr 2018 20:15:19 -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=OgOuB2t1; 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 S1754957AbeDIDK1 (ORCPT + 99 others); Sun, 8 Apr 2018 23:10:27 -0400 Received: from mail-by2nam03on0117.outbound.protection.outlook.com ([104.47.42.117]:63840 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932065AbeDIAYb (ORCPT ); Sun, 8 Apr 2018 20:24:31 -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=GpgwTnZvgcOvoHX0IFI972C02enF+LOy/J5Z5yzE3lM=; b=OgOuB2t1SYlQB7LZTgr3eQdP41fhK31/FgOurkgWzgLCJuvl5NPGsEJrBinE+1+ZaROP01j5ZB+WwF3h+Gr+oGGN9G5j61YPRLGDRprH0WI2stgZKY80dsSDiYzdUr9zdu69VDxKsDifBXAKAR4PyhMbv8eSPk9iKwtgKPz4upo= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB0984.namprd21.prod.outlook.com (52.132.133.30) 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:24:28 +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:24:28 +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.14 085/161] powerpc/numa: Use ibm,max-associativity-domains to discover possible nodes Thread-Topic: [PATCH AUTOSEL for 4.14 085/161] powerpc/numa: Use ibm,max-associativity-domains to discover possible nodes Thread-Index: AQHTz5igl1IxkLFmbU2yM4GxpDuNQw== Date: Mon, 9 Apr 2018 00:20:55 +0000 Message-ID: <20180409001936.162706-85-alexander.levin@microsoft.com> References: <20180409001936.162706-1-alexander.levin@microsoft.com> In-Reply-To: <20180409001936.162706-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;DM5PR2101MB0984;7:BQv+JIh04k3apaeKuQ/7dii+ae7q/ZSFL47OSsJsALgOVk0gSbXaqyXSgPg/XBmAFn/0EbDPFPQ6M5s9i6tz69i80LQHzOGKW/g9H9jgbtAdjMrtjDSkHd1f6ln5IuMwcQEAP+IXNP+h3ibn5pJ/eJJSlyK/mofNgN+hEbmlrNPR0NAG4EZffDCFYOpb4ZjdOY8Sy08scnUuyh0mg1RDsLIppnTWQXOO5Qim/X+rhnnQMSWMlMi20ay3DtEvqbb1;20:Gli4zhrwm4CedLbD3ag4jvkTn9DHpb3waaeRR+a6TKy8IVRJCGJaUo1iG8437T8D3moFvUb2cGI0Oc+qv3LpkbObutx+RCkSQ5OohgxjloWAsId0rjz3Aj0vEOoGTBPrS7iDFT+H2cQm8iTzkGZAJ/kKGnHeMEU2oKLfk2PYteY= x-ms-office365-filtering-ht: Tenant X-MS-Office365-Filtering-Correlation-Id: 766029a3-d20d-4d7e-32d4-08d59db0417a x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020);SRVR:DM5PR2101MB0984; x-ms-traffictypediagnostic: DM5PR2101MB0984: 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)(8121501046)(5005006)(93006095)(93001095)(3231221)(944501327)(52105095)(3002001)(10201501046)(6055026)(61426038)(61427038)(6041310)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123564045)(20161123560045)(6072148)(201708071742011);SRVR:DM5PR2101MB0984;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB0984; x-forefront-prvs: 0637FCE711 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(39380400002)(346002)(376002)(366004)(39860400002)(396003)(189003)(199004)(5250100002)(2501003)(110136005)(54906003)(6116002)(6436002)(11346002)(1076002)(486006)(25786009)(105586002)(2900100001)(102836004)(86612001)(3846002)(68736007)(107886003)(316002)(10290500003)(5660300001)(86362001)(2616005)(305945005)(4326008)(446003)(6486002)(22452003)(7736002)(476003)(8676002)(81156014)(81166006)(8936002)(6512007)(10090500001)(186003)(3280700002)(106356001)(76176011)(2906002)(99286004)(26005)(97736004)(59450400001)(14454004)(6666003)(478600001)(53936002)(6506007)(36756003)(72206003)(66066001)(3660700001)(22906009)(142933001)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB0984;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: q3d50e6hQK/ahC7V1Wy4GQcD7SU8y6tac76jf9pNDb2sy4USELrNGsnXmetSqE+Lz04eeqicZnSf1UO53gNRan+Xwh8xG+5+j6BhebghE31soGZALi8vhXnp6MaEkE1SrwURCe/t8vLVCLSYoBYXZTdrh/xpfYFF2iboaJe/HQOU2Bte4oOfe2l7K9YX0Gur//+iWUA/8ZH5dehI54lIUZu41766b4DYQIZm96Iv1ZY9kggf4r39T6rfEXl89vfZAHOYDydZtzLAb3ODqJHdqXdWpm7htYX1qA6dSCt4xy6bSBztQj6fMHbsJ1CdUXbg+dmmL0/NMiYfmlIObVdHjLMjaajmnPGH2ZlJAKbmsX/RvBRgx3xorT9sLERkgGKLk15XSfzFDuAy1/XYPyOV2MCXCjqyPDQYwEXiacwsgLg= 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: 766029a3-d20d-4d7e-32d4-08d59db0417a X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2018 00:20:55.8002 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB0984 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 a81279249bfb..0356c6cceff7 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