Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp302722ybh; Wed, 22 Jul 2020 00:41:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwfeSQpkxGAqrOjbA7IyXvRIKvIp0H54m8tOgamNU/DotINYACd4InIVy8p91Bvuy3G1Tuh X-Received: by 2002:a17:906:1187:: with SMTP id n7mr27740606eja.161.1595403688758; Wed, 22 Jul 2020 00:41:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595403688; cv=none; d=google.com; s=arc-20160816; b=fMsa4SG7hLcEtt4JcTeB7ScFcJr3pd/c17C5t9NKGB4BP0TWEYgWxRY/Rn674dcdF9 m2XpMKI0q8YCrvo7cIESC9UgFbnVUmfr2KymbUvlZxmp4nWc2mkuj+/kOHCA8YAxerXS rChriqF4d5M5rYzaz7pPEOMxg7/5TaobJoDA8GyLG2KLqGPokNGLavdY5kE4llIgrpMW SnN+M76KD6Hf/gXXd51Irjfeuqk+nM4fDzpvRILHJckH7il5oP0Z718bPY+K9lvoRiKh vn9yzrUvSeVUtFGq1ZXK2RuLPZar6cIXBcLksbf9Nfc15fVlc6I/P3wjvIMz9Wd+gqCP ReRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:reply-to:message-id :subject:cc:to:from:date; bh=kJGhKg0hyytgrz4vU63aVUQZtNX1gvj9fuah76wGf9s=; b=br/hhx9yy0ulilE+AaO3Ro0ry5OAU0IhRUmi3iiGELgFvAWB5u7y9aq616yLmnbDfc g5OTl58toQHIHN7ijdwuyFcadgVhkX5Ricr/9k4Y4XffLJFrpish552iNcoFfLrKSiEu nVCBdj52slAZvjvUsfXYl5K5HDcOOTbAYHKrRQuc9Gx7gHyqH5gHnxr1p8BEFPoKxRqr IRb7O5h6Zn460RXzsQde9X4HlKJcvWpfLbnBoni0ABoAP2U50x7lU9D0djwIuR0DknO2 DVjSYY4/sLbZ9WAEY2vkdYBMuNwEuS6P2R3FzsyS2FqqAhqvDoR0Jih4WKJ4/DbCg1Ju kiSg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (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 a3si13082937ejc.288.2020.07.22.00.41.05; Wed, 22 Jul 2020 00:41:28 -0700 (PDT) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729259AbgGVHkC (ORCPT + 99 others); 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