From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 73C66C433B4 for ; Thu, 20 May 2021 15:45:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 41A19610A2 for ; Thu, 20 May 2021 15:45:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233864AbhETPqi (ORCPT ); Thu, 20 May 2021 11:46:38 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:40916 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S232094AbhETPqh (ORCPT ); Thu, 20 May 2021 11:46:37 -0400 Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 14KFY6wf043097; Thu, 20 May 2021 11:44: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=VE87o+ez1X2zbgAGSfTkQAA/PcWzqiOPjJeb2kr/iV0=; b=Wxw6QXO20aOVVhF/RML+1LuCAdh5EmSn51ffs8BbNBifGYuVriQ2fSvByOJnswLLiO8f Lx6suJgB8u6vX/jgXCqHVYA+mZ/LN72xuLihwLgn6OJ8ayRgbkdm4Kmx1tSmwNV2c2Xy y6s1H3n3OdP4iyBRqbpOT8S+D6Y/4BoogsPV5FdiqoEpUkGNrRkkyeSOLy3JC50qD0j+ QLeFEF9FbMgbpenhNCfUtNt3H3TVXIodfmW27JgGfeB/M4q05XproeNXBv+sTiQAUjr1 2nzYOHBeLEcIZXOyPeymd0IH/B9P6bcqx8jtLY9kjrbIiThfTp5e/BdYMmp14b28ZUPS 6A== Received: from ppma06ams.nl.ibm.com (66.31.33a9.ip4.static.sl-reverse.com [169.51.49.102]) by mx0b-001b2d01.pphosted.com with ESMTP id 38nsh32pmd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 20 May 2021 11:44:49 -0400 Received: from pps.filterd (ppma06ams.nl.ibm.com [127.0.0.1]) by ppma06ams.nl.ibm.com (8.16.0.43/8.16.0.43) with SMTP id 14KFZijI001035; Thu, 20 May 2021 15:44:48 GMT Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by ppma06ams.nl.ibm.com with ESMTP id 38j5jgtqea-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 20 May 2021 15:44:47 +0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 14KFijWK13566260 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 20 May 2021 15:44:45 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 159E6A406F; Thu, 20 May 2021 15:44:45 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 38E8EA4069; Thu, 20 May 2021 15:44:42 +0000 (GMT) Received: from saptagiri.in.ibm.com (unknown [9.77.198.25]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 20 May 2021 15:44:42 +0000 (GMT) From: Srikar Dronamraju To: Ingo Molnar , Peter Zijlstra Cc: LKML , Mel Gorman , Rik van Riel , Srikar Dronamraju , Thomas Gleixner , Valentin Schneider , Vincent Guittot , Dietmar Eggemann , linuxppc-dev@lists.ozlabs.org, Nathan Lynch , Michael Ellerman , Scott Cheloha , Gautham R Shenoy , Geetika Moolchandani Subject: [PATCH 2/3] powerpc/numa: Populate distance map correctly Date: Thu, 20 May 2021 21:14:26 +0530 Message-Id: <20210520154427.1041031-3-srikar@linux.vnet.ibm.com> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210520154427.1041031-1-srikar@linux.vnet.ibm.com> References: <20210520154427.1041031-1-srikar@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: enfkPCD09PZwGBKcSMUALFhTgECSYycD X-Proofpoint-ORIG-GUID: enfkPCD09PZwGBKcSMUALFhTgECSYycD X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391,18.0.761 definitions=2021-05-20_04:2021-05-20,2021-05-20 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 mlxscore=0 suspectscore=0 mlxlogscore=936 phishscore=0 lowpriorityscore=0 bulkscore=0 impostorscore=0 malwarescore=0 spamscore=0 priorityscore=1501 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105200104 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org As per PAPR that defines the OS to hypervisor interface on POWER, there is no way to calculate the node_distance between 2 nodes, when either of the nodes are offline. However scheduler needs the distance map to be populated at boot time. On POWER, this information is provided within the distance_ref_points_depth array, which needs to be parsed to extract the potential node distances. To handle this scenario, lets overload arch_populate_distance_map(), to provide all the distances that are possible in the current platform. Cc: LKML Cc: linuxppc-dev@lists.ozlabs.org Cc: Nathan Lynch Cc: Michael Ellerman Cc: Ingo Molnar Cc: Peter Zijlstra Cc: Valentin Schneider Cc: Scott Cheloha Cc: Gautham R Shenoy Cc: Dietmar Eggemann Cc: Mel Gorman Cc: Vincent Guittot Cc: Rik van Riel Cc: Geetika Moolchandani Reported-by: Geetika Moolchandani Signed-off-by: Srikar Dronamraju --- arch/powerpc/include/asm/topology.h | 3 +++ arch/powerpc/mm/numa.c | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/arch/powerpc/include/asm/topology.h b/arch/powerpc/include/asm/topology.h index e4db64c0e184..d7605d833b8d 100644 --- a/arch/powerpc/include/asm/topology.h +++ b/arch/powerpc/include/asm/topology.h @@ -22,6 +22,9 @@ struct drmem_lmb; cpu_all_mask : \ node_to_cpumask_map[node]) +#define arch_populate_distance_map arch_populate_distance_map +extern int arch_populate_distance_map(unsigned long *distance_map); + struct pci_bus; #ifdef CONFIG_PCI extern int pcibus_to_node(struct pci_bus *bus); diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c index f2bf98bdcea2..9a225b29814a 100644 --- a/arch/powerpc/mm/numa.c +++ b/arch/powerpc/mm/numa.c @@ -221,6 +221,25 @@ static void initialize_distance_lookup_table(int nid, } } +int arch_populate_distance_map(unsigned long *distance_map) +{ + int i; + int distance = LOCAL_DISTANCE; + + bitmap_set(distance_map, distance, 1); + + if (!form1_affinity) { + bitmap_set(distance_map, REMOTE_DISTANCE, 1); + return 0; + } + + for (i = 0; i < distance_ref_points_depth; i++) { + distance *= 2; + bitmap_set(distance_map, distance, 1); + } + return 0; +} + /* * Returns nid in the range [0..nr_node_ids], or -1 if no useful NUMA * info is found. -- 2.27.0 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2F3ACC433ED for ; Thu, 20 May 2021 15:46:33 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5DB7960249 for ; Thu, 20 May 2021 15:46:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5DB7960249 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.vnet.ibm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4FmDcR0cZ9z3c6y for ; Fri, 21 May 2021 01:46:31 +1000 (AEST) Authentication-Results: lists.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=Wxw6QXO2; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=linux.vnet.ibm.com (client-ip=148.163.158.5; helo=mx0a-001b2d01.pphosted.com; envelope-from=srikar@linux.vnet.ibm.com; receiver=) 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=Wxw6QXO2; 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 4FmDZw10s0z301p for ; Fri, 21 May 2021 01:45:11 +1000 (AEST) Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 14KFY6wf043097; Thu, 20 May 2021 11:44: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=VE87o+ez1X2zbgAGSfTkQAA/PcWzqiOPjJeb2kr/iV0=; b=Wxw6QXO20aOVVhF/RML+1LuCAdh5EmSn51ffs8BbNBifGYuVriQ2fSvByOJnswLLiO8f Lx6suJgB8u6vX/jgXCqHVYA+mZ/LN72xuLihwLgn6OJ8ayRgbkdm4Kmx1tSmwNV2c2Xy y6s1H3n3OdP4iyBRqbpOT8S+D6Y/4BoogsPV5FdiqoEpUkGNrRkkyeSOLy3JC50qD0j+ QLeFEF9FbMgbpenhNCfUtNt3H3TVXIodfmW27JgGfeB/M4q05XproeNXBv+sTiQAUjr1 2nzYOHBeLEcIZXOyPeymd0IH/B9P6bcqx8jtLY9kjrbIiThfTp5e/BdYMmp14b28ZUPS 6A== Received: from ppma06ams.nl.ibm.com (66.31.33a9.ip4.static.sl-reverse.com [169.51.49.102]) by mx0b-001b2d01.pphosted.com with ESMTP id 38nsh32pmd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 20 May 2021 11:44:49 -0400 Received: from pps.filterd (ppma06ams.nl.ibm.com [127.0.0.1]) by ppma06ams.nl.ibm.com (8.16.0.43/8.16.0.43) with SMTP id 14KFZijI001035; Thu, 20 May 2021 15:44:48 GMT Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by ppma06ams.nl.ibm.com with ESMTP id 38j5jgtqea-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 20 May 2021 15:44:47 +0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 14KFijWK13566260 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 20 May 2021 15:44:45 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 159E6A406F; Thu, 20 May 2021 15:44:45 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 38E8EA4069; Thu, 20 May 2021 15:44:42 +0000 (GMT) Received: from saptagiri.in.ibm.com (unknown [9.77.198.25]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 20 May 2021 15:44:42 +0000 (GMT) From: Srikar Dronamraju To: Ingo Molnar , Peter Zijlstra Subject: [PATCH 2/3] powerpc/numa: Populate distance map correctly Date: Thu, 20 May 2021 21:14:26 +0530 Message-Id: <20210520154427.1041031-3-srikar@linux.vnet.ibm.com> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210520154427.1041031-1-srikar@linux.vnet.ibm.com> References: <20210520154427.1041031-1-srikar@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: enfkPCD09PZwGBKcSMUALFhTgECSYycD X-Proofpoint-ORIG-GUID: enfkPCD09PZwGBKcSMUALFhTgECSYycD X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.761 definitions=2021-05-20_04:2021-05-20, 2021-05-20 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 mlxscore=0 suspectscore=0 mlxlogscore=936 phishscore=0 lowpriorityscore=0 bulkscore=0 impostorscore=0 malwarescore=0 spamscore=0 priorityscore=1501 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105200104 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 , Gautham R Shenoy , Vincent Guittot , Srikar Dronamraju , Rik van Riel , linuxppc-dev@lists.ozlabs.org, Scott Cheloha , Geetika Moolchandani , LKML , Dietmar Eggemann , Thomas Gleixner , Mel Gorman , Valentin Schneider Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" As per PAPR that defines the OS to hypervisor interface on POWER, there is no way to calculate the node_distance between 2 nodes, when either of the nodes are offline. However scheduler needs the distance map to be populated at boot time. On POWER, this information is provided within the distance_ref_points_depth array, which needs to be parsed to extract the potential node distances. To handle this scenario, lets overload arch_populate_distance_map(), to provide all the distances that are possible in the current platform. Cc: LKML Cc: linuxppc-dev@lists.ozlabs.org Cc: Nathan Lynch Cc: Michael Ellerman Cc: Ingo Molnar Cc: Peter Zijlstra Cc: Valentin Schneider Cc: Scott Cheloha Cc: Gautham R Shenoy Cc: Dietmar Eggemann Cc: Mel Gorman Cc: Vincent Guittot Cc: Rik van Riel Cc: Geetika Moolchandani Reported-by: Geetika Moolchandani Signed-off-by: Srikar Dronamraju --- arch/powerpc/include/asm/topology.h | 3 +++ arch/powerpc/mm/numa.c | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/arch/powerpc/include/asm/topology.h b/arch/powerpc/include/asm/topology.h index e4db64c0e184..d7605d833b8d 100644 --- a/arch/powerpc/include/asm/topology.h +++ b/arch/powerpc/include/asm/topology.h @@ -22,6 +22,9 @@ struct drmem_lmb; cpu_all_mask : \ node_to_cpumask_map[node]) +#define arch_populate_distance_map arch_populate_distance_map +extern int arch_populate_distance_map(unsigned long *distance_map); + struct pci_bus; #ifdef CONFIG_PCI extern int pcibus_to_node(struct pci_bus *bus); diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c index f2bf98bdcea2..9a225b29814a 100644 --- a/arch/powerpc/mm/numa.c +++ b/arch/powerpc/mm/numa.c @@ -221,6 +221,25 @@ static void initialize_distance_lookup_table(int nid, } } +int arch_populate_distance_map(unsigned long *distance_map) +{ + int i; + int distance = LOCAL_DISTANCE; + + bitmap_set(distance_map, distance, 1); + + if (!form1_affinity) { + bitmap_set(distance_map, REMOTE_DISTANCE, 1); + return 0; + } + + for (i = 0; i < distance_ref_points_depth; i++) { + distance *= 2; + bitmap_set(distance_map, distance, 1); + } + return 0; +} + /* * Returns nid in the range [0..nr_node_ids], or -1 if no useful NUMA * info is found. -- 2.27.0