From patchwork Mon Aug 17 10:32:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aneesh Kumar K V X-Patchwork-Id: 1346114 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BVVtY1ctfz9sRK for ; Mon, 17 Aug 2020 20:40:21 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=linux.ibm.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=q63M/Uyy; dkim-atps=neutral Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4BVVtY0nl3zDqS5 for ; Mon, 17 Aug 2020 20:40:21 +1000 (AEST) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=linux.ibm.com (client-ip=148.163.156.1; helo=mx0a-001b2d01.pphosted.com; envelope-from=aneesh.kumar@linux.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=q63M/Uyy; dkim-atps=neutral Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4BVVjt3tSvzDqVJ for ; Mon, 17 Aug 2020 20:32:50 +1000 (AEST) Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 07HAWAkf086089; Mon, 17 Aug 2020 06:32:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding; s=pp1; bh=lMmYr+jJk6Ae8vkDqA/gs80vyALVZfbh/3BbAjpq+AU=; b=q63M/UyyQBx7dbSqZMLNDNlK3ioFFAD9Yh/aTBXdhuvZQE9+eSTZXWmmbRmlpa6ccmuU i4ScwdBTyHMLrBGn/hMl32LUjaV/FnlGgInSahw1UM5KvOZJFI1TvvzHlFibC8f0jEIX kubP5FVxRKtBv7/QWmawP60tDjjiqQ2IB80I1nRN7uhEb6ldQdFrFKLV0EBROXGoSIxO +vPfcpRerKQ0bSNUL/NPARu9Apo4lO2D3KGaa9XuOwy1tKNGV3rWOwFOgGi3Bbsgsy3q f3eCT+sL7cA1ohNju7hb+IDua7Db2wHrNkO+fH9oAt1NOST9Ro20MIB25WvKMbKKgIGp tw== Received: from ppma01wdc.us.ibm.com (fd.55.37a9.ip4.static.sl-reverse.com [169.55.85.253]) by mx0a-001b2d01.pphosted.com with ESMTP id 32y85ycs0r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 17 Aug 2020 06:32:45 -0400 Received: from pps.filterd (ppma01wdc.us.ibm.com [127.0.0.1]) by ppma01wdc.us.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 07HAUedl026906; Mon, 17 Aug 2020 10:32:44 GMT Received: from b01cxnp23034.gho.pok.ibm.com (b01cxnp23034.gho.pok.ibm.com [9.57.198.29]) by ppma01wdc.us.ibm.com with ESMTP id 32x7b8g2ye-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 17 Aug 2020 10:32:44 +0000 Received: from b01ledav004.gho.pok.ibm.com (b01ledav004.gho.pok.ibm.com [9.57.199.109]) by b01cxnp23034.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 07HAWiEZ53084614 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 17 Aug 2020 10:32:44 GMT Received: from b01ledav004.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 00DAE112062; Mon, 17 Aug 2020 10:32:44 +0000 (GMT) Received: from b01ledav004.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D8B97112067; Mon, 17 Aug 2020 10:32:41 +0000 (GMT) Received: from skywalker.ibmuc.com (unknown [9.102.2.56]) by b01ledav004.gho.pok.ibm.com (Postfix) with ESMTP; Mon, 17 Aug 2020 10:32:41 +0000 (GMT) From: "Aneesh Kumar K.V" To: linuxppc-dev@lists.ozlabs.org, mpe@ellerman.id.au Subject: [PATCH v2 1/3] powerpc/numa: Introduce logical numa id Date: Mon, 17 Aug 2020 16:02:36 +0530 Message-Id: <20200817103238.158133-1-aneesh.kumar@linux.ibm.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-08-17_02:2020-08-17, 2020-08-17 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 bulkscore=0 phishscore=0 adultscore=0 spamscore=0 priorityscore=1501 mlxscore=0 suspectscore=2 lowpriorityscore=0 impostorscore=0 mlxlogscore=999 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2008170075 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nathan Lynch , "Aneesh Kumar K.V" , Srikar Dronamraju Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" We use ibm,associativity and ibm,associativity-lookup-arrays to derive the numa node numbers. These device tree properties are firmware indicated grouping of resources based on their hierarchy in the platform. These numbers (group id) are not sequential and hypervisor/firmware can follow different numbering schemes. For ex: on powernv platforms, we group them in the below order. * - CCM node ID * - HW card ID * - HW module ID * - Chip ID * - Core ID Based on ibm,associativity-reference-points we use one of the above group ids as Linux NUMA node id. (On PowerNV platform Chip ID is used). This results in Linux reporting non-linear NUMA node id and which also results in Linux reporting empty node 0 NUMA nodes. This can be resolved by mapping the firmware provided group id to a logical Linux NUMA id. In this patch, we do this only for pseries platforms considering the firmware group id is a virtualized entity and users would not have drawn any conclusion based on the Linux Numa Node id. On PowerNV platform since we have historically mapped Chip ID as Linux NUMA node id, we keep the existing Linux NUMA node id numbering. Before Fix: # numactl -H available: 2 nodes (0-1) node 0 cpus: node 0 size: 0 MB node 0 free: 0 MB node 1 cpus: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 node 1 size: 50912 MB node 1 free: 45248 MB node distances: node 0 1 0: 10 40 1: 40 10 after fix # numactl -H available: 1 nodes (0) node 0 cpus: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 node 0 size: 50912 MB node 0 free: 49724 MB node distances: node 0 0: 10 Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/include/asm/topology.h | 5 ++ arch/powerpc/mm/numa.c | 74 ++++++++++++++++++++++++----- 2 files changed, 68 insertions(+), 11 deletions(-) diff --git a/arch/powerpc/include/asm/topology.h b/arch/powerpc/include/asm/topology.h index f0b6300e7dd3..7c18883cee9c 100644 --- a/arch/powerpc/include/asm/topology.h +++ b/arch/powerpc/include/asm/topology.h @@ -118,5 +118,10 @@ int get_physical_package_id(int cpu); #endif #endif +struct affinity_domain { + int id; +}; + +int affinity_domain_to_nid(struct affinity_domain *domain); #endif /* __KERNEL__ */ #endif /* _ASM_POWERPC_TOPOLOGY_H */ diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c index 1f61fa2148b5..d29f60e15777 100644 --- a/arch/powerpc/mm/numa.c +++ b/arch/powerpc/mm/numa.c @@ -221,26 +221,76 @@ static void initialize_distance_lookup_table(int nid, } } + +static int domain_id_map[MAX_NUMNODES] = {[0 ... MAX_NUMNODES - 1] = -1 }; + +static int __affinity_domain_to_nid(int domain_id, int max_nid) +{ + int i; + + for (i = 0; i < max_nid; i++) { + if (domain_id_map[i] == domain_id) + return i; + } + return NUMA_NO_NODE; +} + +int affinity_domain_to_nid(struct affinity_domain *domain) +{ + int nid, domain_id; + static int last_nid = 0; + static DEFINE_SPINLOCK(node_id_lock); + + domain_id = domain->id; + /* + * For PowerNV we don't change the node id. This helps to avoid + * confusion w.r.t the expected node ids. On pseries, node numbers + * are virtualized. Hence do logical node id for pseries. + */ + if (!firmware_has_feature(FW_FEATURE_LPAR)) + return domain_id; + + if (domain_id == -1) + return NUMA_NO_NODE; + + nid = __affinity_domain_to_nid(domain_id, last_nid); + if (nid == NUMA_NO_NODE) { + spin_lock(&node_id_lock); + /* recheck with lock held */ + nid = __affinity_domain_to_nid(domain_id, last_nid); + if (nid == NUMA_NO_NODE && last_nid < MAX_NUMNODES) { + nid = last_nid++; + domain_id_map[nid] = domain_id; + } + spin_unlock(&node_id_lock); + } + + return nid; +} + /* * Returns nid in the range [0..nr_node_ids], or -1 if no useful NUMA * info is found. */ static int associativity_to_nid(const __be32 *associativity) { + struct affinity_domain domain = { .id = -1 }; int nid = NUMA_NO_NODE; if (!numa_enabled) goto out; if (of_read_number(associativity, 1) >= min_common_depth) - nid = of_read_number(&associativity[min_common_depth], 1); + domain.id = of_read_number(&associativity[min_common_depth], 1); /* POWER4 LPAR uses 0xffff as invalid node */ - if (nid == 0xffff || nid >= nr_node_ids) - nid = NUMA_NO_NODE; + if (domain.id == 0xffff) + domain.id = -1; + + nid = affinity_domain_to_nid(&domain); if (nid > 0 && - of_read_number(associativity, 1) >= distance_ref_points_depth) { + of_read_number(associativity, 1) >= distance_ref_points_depth) { /* * Skip the length field and send start of associativity array */ @@ -432,25 +482,27 @@ static int of_get_assoc_arrays(struct assoc_arrays *aa) */ static int of_drconf_to_nid_single(struct drmem_lmb *lmb) { + struct affinity_domain domain; struct assoc_arrays aa = { .arrays = NULL }; - int default_nid = NUMA_NO_NODE; - int nid = default_nid; + int nid = NUMA_NO_NODE; int rc, index; if ((min_common_depth < 0) || !numa_enabled) - return default_nid; + return NUMA_NO_NODE; rc = of_get_assoc_arrays(&aa); if (rc) - return default_nid; + return NUMA_NO_NODE; if (min_common_depth <= aa.array_sz && !(lmb->flags & DRCONF_MEM_AI_INVALID) && lmb->aa_index < aa.n_arrays) { index = lmb->aa_index * aa.array_sz + min_common_depth - 1; - nid = of_read_number(&aa.arrays[index], 1); + domain.id = of_read_number(&aa.arrays[index], 1); - if (nid == 0xffff || nid >= nr_node_ids) - nid = default_nid; + if (domain.id == 0xffff) + domain.id = -1; + + nid = affinity_domain_to_nid(&domain); if (nid > 0) { index = lmb->aa_index * aa.array_sz; From patchwork Mon Aug 17 10:32:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aneesh Kumar K V X-Patchwork-Id: 1346115 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BVVx40JWtz9sRK for ; Mon, 17 Aug 2020 20:42:32 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=linux.ibm.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=FFsySRf/; dkim-atps=neutral Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4BVVx35WM6zDqW4 for ; Mon, 17 Aug 2020 20:42:31 +1000 (AEST) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=linux.ibm.com (client-ip=148.163.156.1; helo=mx0a-001b2d01.pphosted.com; envelope-from=aneesh.kumar@linux.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=FFsySRf/; dkim-atps=neutral Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4BVVjw34lzzDqS8 for ; Mon, 17 Aug 2020 20:32:52 +1000 (AEST) Received: from pps.filterd (m0187473.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 07HAVUNk135908; Mon, 17 Aug 2020 06:32:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=xQ3YxdlTSHxNf254ZP3K7vl63iPMjc6SqqedXfUv9t0=; b=FFsySRf/cIiURDIY6999135o3vcd6Mn0KM1ILV9NL9h8sArHmgGpS9N/k67iyLFlGwpE BBOOSts1BQREGK98e3oBRz1Pw3dqOaSD6EtuFvHai5CzVXLIc4oUZlvxiqykfWomSWmW Ep0YNyoEy6pyQqW/7+2cbSjaEQZHP3IWi/Fr4BinZsAQ3OQlJCh0CFuUWYiCJ6AbOk1H aefHjnWb9sJ/hmtSt/JfhTBu0G0IEUlgFZdloANVVAeJw0sw7nmDIawWVSsgrSufhHhR U9khysDVEv2DeUx9O/63R227BifC7jwebyHE306jbMerXgHf4whq5ngYDtXkLeOgabnF gg== Received: from ppma03dal.us.ibm.com (b.bd.3ea9.ip4.static.sl-reverse.com [169.62.189.11]) by mx0a-001b2d01.pphosted.com with ESMTP id 32y5s7e33c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 17 Aug 2020 06:32:48 -0400 Received: from pps.filterd (ppma03dal.us.ibm.com [127.0.0.1]) by ppma03dal.us.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 07HATKo3025861; Mon, 17 Aug 2020 10:32:47 GMT Received: from b01cxnp22034.gho.pok.ibm.com (b01cxnp22034.gho.pok.ibm.com [9.57.198.24]) by ppma03dal.us.ibm.com with ESMTP id 32xgqnrc92-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 17 Aug 2020 10:32:47 +0000 Received: from b01ledav004.gho.pok.ibm.com (b01ledav004.gho.pok.ibm.com [9.57.199.109]) by b01cxnp22034.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 07HAWk4J53608718 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 17 Aug 2020 10:32:46 GMT Received: from b01ledav004.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A3ED1112061; Mon, 17 Aug 2020 10:32:46 +0000 (GMT) Received: from b01ledav004.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7D419112064; Mon, 17 Aug 2020 10:32:44 +0000 (GMT) Received: from skywalker.ibmuc.com (unknown [9.102.2.56]) by b01ledav004.gho.pok.ibm.com (Postfix) with ESMTP; Mon, 17 Aug 2020 10:32:44 +0000 (GMT) From: "Aneesh Kumar K.V" To: linuxppc-dev@lists.ozlabs.org, mpe@ellerman.id.au Subject: [PATCH v2 2/3] powerpc/powernv/cpufreq: Don't assume chip id is same as Linux node id Date: Mon, 17 Aug 2020 16:02:37 +0530 Message-Id: <20200817103238.158133-2-aneesh.kumar@linux.ibm.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200817103238.158133-1-aneesh.kumar@linux.ibm.com> References: <20200817103238.158133-1-aneesh.kumar@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-08-17_02:2020-08-17, 2020-08-17 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 adultscore=0 clxscore=1015 bulkscore=0 priorityscore=1501 mlxlogscore=999 suspectscore=0 malwarescore=0 lowpriorityscore=0 mlxscore=0 impostorscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2008170075 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nathan Lynch , "Aneesh Kumar K.V" , Srikar Dronamraju , "Gautham R . Shenoy" Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" On PowerNV platforms we always have 1:1 mapping between chip ID and firmware group id. Use the helper to convert firmware group id to node id instead of directly using chip ID as Linux node id. NOTE: This doesn't have any functional change. On PowerNV platforms we continue to have 1:1 mapping between firmware group id and Linux node id. Reviewed-by: Gautham R. Shenoy Signed-off-by: Aneesh Kumar K.V --- drivers/cpufreq/powernv-cpufreq.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/cpufreq/powernv-cpufreq.c b/drivers/cpufreq/powernv-cpufreq.c index a9af15e994cc..d7e6eb8aaba1 100644 --- a/drivers/cpufreq/powernv-cpufreq.c +++ b/drivers/cpufreq/powernv-cpufreq.c @@ -27,6 +27,7 @@ #include #include /* Required for cpu_sibling_mask() in UP configs */ #include +#include #include #define POWERNV_MAX_PSTATES_ORDER 8 @@ -1070,8 +1071,16 @@ static int init_chip_info(void) } for (i = 0; i < nr_chips; i++) { + struct affinity_domain domain; + unsigned int nid; + chips[i].id = chip[i]; - cpumask_copy(&chips[i].mask, cpumask_of_node(chip[i])); + /* + * On powervn platforms affinity domain id is same as chipd id. + */ + domain.id = chip[i]; + nid = affinity_domain_to_nid(&domain); + cpumask_copy(&chips[i].mask, cpumask_of_node(nid)); INIT_WORK(&chips[i].throttle, powernv_cpufreq_work_fn); for_each_cpu(cpu, &chips[i].mask) per_cpu(chip_info, cpu) = &chips[i]; From patchwork Mon Aug 17 10:32:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aneesh Kumar K V X-Patchwork-Id: 1346117 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BVVzN0Htsz9sRK for ; Mon, 17 Aug 2020 20:44:32 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=linux.ibm.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=CR7Rhsbh; dkim-atps=neutral Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4BVVzM2t0bzDqS4 for ; Mon, 17 Aug 2020 20:44:31 +1000 (AEST) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=linux.ibm.com (client-ip=148.163.158.5; helo=mx0a-001b2d01.pphosted.com; envelope-from=aneesh.kumar@linux.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=CR7Rhsbh; dkim-atps=neutral Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4BVVjz4Yv9zDqS5 for ; Mon, 17 Aug 2020 20:32:55 +1000 (AEST) Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 07HAVGcF186986; Mon, 17 Aug 2020 06:32:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=4cBjSeC8Nw/iBbV1hcfE6a7JEzSQU+I68TBlKq7hc+U=; b=CR7RhsbhxPxU3GPRloR9FwD42Ka2I/AXPyKAyXFmm9q13pbjCTySEMguupceuum7Vbof FmRKm3mlB1z9+aNH+e8IL2WAIUNeYNSDsgnSVLWh+Hq1v72tT0GZ99q3WUZ2e88Gx2uB r0FwrBDxVHbu4gd+rtRaAy5QoUpTHGrunlrXJlZ9BNMOE/797e5/9rms3gHVpNrX1OKr S3nAstOfdTBmZDQNC+Abe0zUWwMdfuf/3X/Grur9D8jufHZZN1Ij476lOzZQU55vXMNL reqT92vv9zx887T20W/7o7ApTR5OqFLMl3RW8iQMQeS5zerZqhvcdlMHhBo5cUxMUs9M YQ== Received: from ppma05wdc.us.ibm.com (1b.90.2fa9.ip4.static.sl-reverse.com [169.47.144.27]) by mx0b-001b2d01.pphosted.com with ESMTP id 32y7ngwa2a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 17 Aug 2020 06:32:50 -0400 Received: from pps.filterd (ppma05wdc.us.ibm.com [127.0.0.1]) by ppma05wdc.us.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 07HAUSg7008815; Mon, 17 Aug 2020 10:32:49 GMT Received: from b01cxnp22036.gho.pok.ibm.com (b01cxnp22036.gho.pok.ibm.com [9.57.198.26]) by ppma05wdc.us.ibm.com with ESMTP id 32x7b8r2u4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 17 Aug 2020 10:32:49 +0000 Received: from b01ledav004.gho.pok.ibm.com (b01ledav004.gho.pok.ibm.com [9.57.199.109]) by b01cxnp22036.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 07HAWmGo11600776 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 17 Aug 2020 10:32:49 GMT Received: from b01ledav004.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E01D1112067; Mon, 17 Aug 2020 10:32:48 +0000 (GMT) Received: from b01ledav004.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2C3A6112064; Mon, 17 Aug 2020 10:32:47 +0000 (GMT) Received: from skywalker.ibmuc.com (unknown [9.102.2.56]) by b01ledav004.gho.pok.ibm.com (Postfix) with ESMTP; Mon, 17 Aug 2020 10:32:46 +0000 (GMT) From: "Aneesh Kumar K.V" To: linuxppc-dev@lists.ozlabs.org, mpe@ellerman.id.au Subject: [PATCH v2 3/3] powerpc/numa: Move POWER4 restriction to the helper Date: Mon, 17 Aug 2020 16:02:38 +0530 Message-Id: <20200817103238.158133-3-aneesh.kumar@linux.ibm.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200817103238.158133-1-aneesh.kumar@linux.ibm.com> References: <20200817103238.158133-1-aneesh.kumar@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-08-17_02:2020-08-17, 2020-08-17 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 malwarescore=0 mlxscore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 adultscore=0 priorityscore=1501 impostorscore=0 mlxlogscore=912 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2008170075 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nathan Lynch , "Aneesh Kumar K.V" , Srikar Dronamraju Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" Even though the comment says POWER4 usage, I guess it applies to all platforms since there is no PVR check there. This patch moves the check to the helper. Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/mm/numa.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c index d29f60e15777..7319084345e1 100644 --- a/arch/powerpc/mm/numa.c +++ b/arch/powerpc/mm/numa.c @@ -250,7 +250,8 @@ int affinity_domain_to_nid(struct affinity_domain *domain) if (!firmware_has_feature(FW_FEATURE_LPAR)) return domain_id; - if (domain_id == -1) + /* POWER4 LPAR uses 0xffff as invalid node */ + if (domain_id == -1 || domain_id == 0xffff) return NUMA_NO_NODE; nid = __affinity_domain_to_nid(domain_id, last_nid); @@ -283,10 +284,6 @@ static int associativity_to_nid(const __be32 *associativity) if (of_read_number(associativity, 1) >= min_common_depth) domain.id = of_read_number(&associativity[min_common_depth], 1); - /* POWER4 LPAR uses 0xffff as invalid node */ - if (domain.id == 0xffff) - domain.id = -1; - nid = affinity_domain_to_nid(&domain); if (nid > 0 && @@ -499,9 +496,6 @@ static int of_drconf_to_nid_single(struct drmem_lmb *lmb) index = lmb->aa_index * aa.array_sz + min_common_depth - 1; domain.id = of_read_number(&aa.arrays[index], 1); - if (domain.id == 0xffff) - domain.id = -1; - nid = affinity_domain_to_nid(&domain); if (nid > 0) {