Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp94233pxu; Thu, 3 Dec 2020 20:54:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJxwyYB4x6E40Mby6nCSaFo+ULKZxllorUKWdiw58cxUhs6kchIuY9pQy4OpADjKy7WdZaGq X-Received: by 2002:a05:6402:1c9b:: with SMTP id cy27mr5818840edb.253.1607057651770; Thu, 03 Dec 2020 20:54:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607057651; cv=none; d=google.com; s=arc-20160816; b=VRkJzeXqYNn+tZuFDdk8R0Z+MJ+ly21WPuTh8Nh5wt6eFpjrjqjw0KOAkw3L2LwN4A hvuO8bRddiqVXNTyPsksucOZMUuKfPuu+jnkH0VY6PyjLMeZ7qd2U/qHuojTl7MKu8bn pFqx+yY1wEdh9exUuoeMxiXbDBu+81efy4kTR6SrpsHDIJuGL7T8PDPBDrs1PWonBBqS 8sLw+BjswNvbXESVO2cO5clrGKH5C12iM4J8weVCDByl5cEr+jRhhSZUS/AMvh6mz2YN 4E331TE21GuAeJkNsbKUuRx0LGHcBbI0EdV66tiMO8cODRacd9AZNJiMS1XxHZsfNqi0 tUIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=DVPyRZisQebFdRzsZYkMxjFlCMHhb8Pssm/fUvp1D+0=; b=kaQWXZK6IJv8zCuPbqTIWkNOe7QF7iOqm8CboyzccLESxWEDzGixpLCUktBHJvmDEZ jV47SBj6L3+crBnaXPuDaV1YSgndvBDrIpvatJpcC0tDxEleYPi83BQYcq1HAttvH35g pznMJ4r6Td9ioc7VC+4Ws7uHgdfmr6gyJB6/18I3JZ/bHYRvLvtsKUTUwGYNMuUtrj9y EbEdCxwr/3U7Mv9BG/gtfPxsfEvMXIw3Zml8AnBNZEZ4/BP5GVnBhUMOfJyXfqEV4toG EYPqWrluI070YJY49Qy3uhz4YML7fqOwnz9zlaX3NIqo0+BouUn9KhtV13ibgV+jr//O dzkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=suNmWu0W; 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=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dp16si690716ejc.635.2020.12.03.20.53.49; Thu, 03 Dec 2020 20:54:11 -0800 (PST) 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=@ibm.com header.s=pp1 header.b=suNmWu0W; 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=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727449AbgLDEus (ORCPT + 99 others); Thu, 3 Dec 2020 23:50:48 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:56134 "EHLO mx0b-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725989AbgLDEus (ORCPT ); Thu, 3 Dec 2020 23:50:48 -0500 Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 0B44cWwT050445; Thu, 3 Dec 2020 23:49:09 -0500 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; s=pp1; bh=DVPyRZisQebFdRzsZYkMxjFlCMHhb8Pssm/fUvp1D+0=; b=suNmWu0WlI8OG1Kq00UjIMIo7novl7WCFy7rMXFSvWEQtoXm1WLvglXxLYG3xixYe6eu ZSp+alx1C8itJlzhsRomnAwFNl5Liti0kn1eolh3jQE20YJEOfOTd6KBSrexrQU5s727 OvrNsPWSC9V8AsL4dNQKw3BasazxhOdj2KR6Q1HgkolmSdBOvSiDOVo/l0VxfMMcxarv oobmuO1hVnOIggCxE+3wlQtBxjRJUARcC64qvC2FYOw2UcOX9y+d3ZCIynWGti/mEi80 h/pE3XAduGqKNwG5YL1T+GCg2i5wTOHtriZorP4aAOjLzt6nCNShwvFF58sD7BAJcF+D 6w== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 357d37sx8f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 03 Dec 2020 23:49:08 -0500 Received: from m0098417.ppops.net (m0098417.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 0B44jI1m071360; Thu, 3 Dec 2020 23:49:08 -0500 Received: from ppma03wdc.us.ibm.com (ba.79.3fa9.ip4.static.sl-reverse.com [169.63.121.186]) by mx0a-001b2d01.pphosted.com with ESMTP id 357d37sx88-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 03 Dec 2020 23:49:08 -0500 Received: from pps.filterd (ppma03wdc.us.ibm.com [127.0.0.1]) by ppma03wdc.us.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 0B44lSHO002170; Fri, 4 Dec 2020 04:49:07 GMT Received: from b03cxnp08026.gho.boulder.ibm.com (b03cxnp08026.gho.boulder.ibm.com [9.17.130.18]) by ppma03wdc.us.ibm.com with ESMTP id 356q6qs5w4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 04 Dec 2020 04:49:07 +0000 Received: from b03ledav005.gho.boulder.ibm.com (b03ledav005.gho.boulder.ibm.com [9.17.130.236]) by b03cxnp08026.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 0B44n6ox20578640 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 4 Dec 2020 04:49:06 GMT Received: from b03ledav005.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B91D8BE04F; Fri, 4 Dec 2020 04:49:06 +0000 (GMT) Received: from b03ledav005.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5AFAFBE054; Fri, 4 Dec 2020 04:49:06 +0000 (GMT) Received: from sofia.ibm.com (unknown [9.199.56.248]) by b03ledav005.gho.boulder.ibm.com (Postfix) with ESMTP; Fri, 4 Dec 2020 04:49:06 +0000 (GMT) Received: by sofia.ibm.com (Postfix, from userid 1000) id B69542E4200; Fri, 4 Dec 2020 10:19:01 +0530 (IST) From: "Gautham R. Shenoy" To: Srikar Dronamraju , Anton Blanchard , Vaidyanathan Srinivasan , Michael Ellerman , Michael Neuling , Nicholas Piggin , Nathan Lynch , Peter Zijlstra , Valentin Schneider Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, "Gautham R. Shenoy" Subject: [PATCH 3/3] powerpc/cacheinfo: Print correct cache-sibling map/list for L2 cache Date: Fri, 4 Dec 2020 10:18:47 +0530 Message-Id: <1607057327-29822-4-git-send-email-ego@linux.vnet.ibm.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1607057327-29822-1-git-send-email-ego@linux.vnet.ibm.com> References: <1607057327-29822-1-git-send-email-ego@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.312,18.0.737 definitions=2020-12-04_01:2020-12-04,2020-12-04 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 priorityscore=1501 mlxscore=0 spamscore=0 adultscore=0 bulkscore=0 lowpriorityscore=0 phishscore=0 mlxlogscore=999 clxscore=1011 malwarescore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2012040024 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: "Gautham R. Shenoy" On POWER platforms where only some groups of threads within a core share the L2-cache (indicated by the ibm,thread-groups device-tree property), we currently print the incorrect shared_cpu_map/list for L2-cache in the sysfs. This patch reports the correct shared_cpu_map/list on such platforms. Example: On a platform with "ibm,thread-groups" set to 00000001 00000002 00000004 00000000 00000002 00000004 00000006 00000001 00000003 00000005 00000007 00000002 00000002 00000004 00000000 00000002 00000004 00000006 00000001 00000003 00000005 00000007 This indicates that threads {0,2,4,6} in the core share the L2-cache and threads {1,3,5,7} in the core share the L2 cache. However, without the patch, the shared_cpu_map/list for L2 for CPUs 0, 1 is reported in the sysfs as follows: /sys/devices/system/cpu/cpu0/cache/index2/shared_cpu_list:0-7 /sys/devices/system/cpu/cpu0/cache/index2/shared_cpu_map:000000,000000ff /sys/devices/system/cpu/cpu1/cache/index2/shared_cpu_list:0-7 /sys/devices/system/cpu/cpu1/cache/index2/shared_cpu_map:000000,000000ff With the patch, the shared_cpu_map/list for L2 cache for CPUs 0, 1 is correctly reported as follows: /sys/devices/system/cpu/cpu0/cache/index2/shared_cpu_list:0,2,4,6 /sys/devices/system/cpu/cpu0/cache/index2/shared_cpu_map:000000,00000055 /sys/devices/system/cpu/cpu1/cache/index2/shared_cpu_list:1,3,5,7 /sys/devices/system/cpu/cpu1/cache/index2/shared_cpu_map:000000,000000aa Signed-off-by: Gautham R. Shenoy --- arch/powerpc/kernel/cacheinfo.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/arch/powerpc/kernel/cacheinfo.c b/arch/powerpc/kernel/cacheinfo.c index 65ab9fc..1cc8f37 100644 --- a/arch/powerpc/kernel/cacheinfo.c +++ b/arch/powerpc/kernel/cacheinfo.c @@ -651,15 +651,22 @@ static unsigned int index_dir_to_cpu(struct cache_index_dir *index) return dev->id; } +extern bool thread_group_shares_l2; /* * On big-core systems, each core has two groups of CPUs each of which * has its own L1-cache. The thread-siblings which share l1-cache with * @cpu can be obtained via cpu_smallcore_mask(). + * + * On some big-core systems, the L2 cache is shared only between some + * groups of siblings. This is already parsed and encoded in + * cpu_l2_cache_mask(). */ static const struct cpumask *get_big_core_shared_cpu_map(int cpu, struct cache *cache) { if (cache->level == 1) return cpu_smallcore_mask(cpu); + if (cache->level == 2 && thread_group_shares_l2) + return cpu_l2_cache_mask(cpu); return &cache->shared_cpu_map; } -- 1.9.4