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=-5.5 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no 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 C37C2C433E0 for ; Wed, 22 Jul 2020 07:40:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9CF6E20709 for ; Wed, 22 Jul 2020 07:40:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730199AbgGVHkC (ORCPT ); Wed, 22 Jul 2020 03:40:02 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:32278 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726821AbgGVHkB (ORCPT ); Wed, 22 Jul 2020 03:40:01 -0400 Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 06M73tmX005571; Wed, 22 Jul 2020 03:39:47 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 32e1vth411-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 22 Jul 2020 03:39:47 -0400 Received: from m0098410.ppops.net (m0098410.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 06M7SC2g084592; Wed, 22 Jul 2020 03:39:47 -0400 Received: from ppma04fra.de.ibm.com (6a.4a.5195.ip4.static.sl-reverse.com [149.81.74.106]) by mx0a-001b2d01.pphosted.com with ESMTP id 32e1vth3yh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 22 Jul 2020 03:39:47 -0400 Received: from pps.filterd (ppma04fra.de.ibm.com [127.0.0.1]) by ppma04fra.de.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 06M7YtMe010650; Wed, 22 Jul 2020 07:39:44 GMT Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by ppma04fra.de.ibm.com with ESMTP id 32dbmn13k8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 22 Jul 2020 07:39:44 +0000 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 06M7deNl43712668 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 22 Jul 2020 07:39:40 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 22C80AE053; Wed, 22 Jul 2020 07:39:40 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B65E0AE04D; Wed, 22 Jul 2020 07:39:37 +0000 (GMT) Received: from linux.vnet.ibm.com (unknown [9.126.150.29]) by d06av26.portsmouth.uk.ibm.com (Postfix) with SMTP; Wed, 22 Jul 2020 07:39:37 +0000 (GMT) Date: Wed, 22 Jul 2020 13:09:36 +0530 From: Srikar Dronamraju To: Gautham R Shenoy Cc: Michael Ellerman , linuxppc-dev , LKML , Ingo Molnar , Peter Zijlstra , Valentin Schneider , Nick Piggin , Oliver OHalloran , Nathan Lynch , Michael Neuling , Anton Blanchard , Vaidyanathan Srinivasan , Jordan Niethe Subject: Re: [PATCH v2 06/10] powerpc/smp: Generalize 2nd sched domain Message-ID: <20200722073936.GE9290@linux.vnet.ibm.com> Reply-To: Srikar Dronamraju References: <20200721113814.32284-1-srikar@linux.vnet.ibm.com> <20200721113814.32284-7-srikar@linux.vnet.ibm.com> <20200722065640.GE31038@in.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <20200722065640.GE31038@in.ibm.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235,18.0.687 definitions=2020-07-22_03:2020-07-22,2020-07-22 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 impostorscore=0 mlxscore=0 phishscore=0 priorityscore=1501 clxscore=1015 lowpriorityscore=0 adultscore=0 bulkscore=0 suspectscore=0 spamscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2007220052 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Gautham R Shenoy [2020-07-22 12:26:40]: > Hello Srikar, > > On Tue, Jul 21, 2020 at 05:08:10PM +0530, Srikar Dronamraju wrote: > > Currently "CACHE" domain happens to be the 2nd sched domain as per > > powerpc_topology. This domain will collapse if cpumask of l2-cache is > > same as SMT domain. However we could generalize this domain such that it > > could mean either be a "CACHE" domain or a "BIGCORE" domain. > > > > While setting up the "CACHE" domain, check if shared_cache is already > > set. > > @@ -1339,14 +1345,20 @@ void start_secondary(void *unused) > > /* Update topology CPU masks */ > > add_cpu_to_masks(cpu); > > > > - if (has_big_cores) > > - sibling_mask = cpu_smallcore_mask; > > /* > > * Check for any shared caches. Note that this must be done on a > > * per-core basis because one core in the pair might be disabled. > > */ > > - if (!cpumask_equal(cpu_l2_cache_mask(cpu), sibling_mask(cpu))) > > - shared_caches = true; > > + if (!shared_caches) { > > + struct cpumask *(*sibling_mask)(int) = cpu_sibling_mask; > > + struct cpumask *mask = cpu_l2_cache_mask(cpu); > > + > > + if (has_big_cores) > > + sibling_mask = cpu_smallcore_mask; > > + > > + if (cpumask_weight(mask) > cpumask_weight(sibling_mask(cpu))) > > + shared_caches = true; > > At the risk of repeating my comment to the v1 version of the patch, we > have shared caches only l2_cache_mask(cpu) is a strict superset of > sibling_mask(cpu). > > "cpumask_weight(mask) > cpumask_weight(sibling_mask(cpu))" does not > capture this. Why would it not? We are setting shared_caches if and only if l2_cache_mask is a strict superset of sibling/smallcore mask. > Could we please use > > if (!cpumask_equal(sibling_mask(cpu), mask) && > cpumask_subset(sibling_mask(cpu), mask) { > } > Scheduler mandates that two cpumasks for the same CPU would either have to be equal or one of them has to be a strict superset of the other. If not the scheduler would mark our domains as broken. That being the case, cpumask_weight will correctly capture what we are looking for. That said your condition is also correct but slightly heavier and doesn't provide us with any more information or correctness. > > Otherwise the patch looks good to me. > > -- > Thanks and Regards > gautham. -- Thanks and Regards Srikar Dronamraju