Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1954419ybh; Fri, 24 Jul 2020 00:12:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx7dSmvCXTIL/GFyuSrtASs4lZbOiD7uDo3U7gUx1ex7VevvcH3524d9J4AzTEd3n+QcJMl X-Received: by 2002:a05:6402:31ad:: with SMTP id dj13mr7693721edb.88.1595574766768; Fri, 24 Jul 2020 00:12:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595574766; cv=none; d=google.com; s=arc-20160816; b=C870albCrPrT6zSNrxQguRz8Kg4uoajOZ66Wxyr4WyV84pIlJ/dmDknAHh/X/pqznE EgzQpchQI7lVreri4H0S2OlLu3lcje3Mrp/+EVqfAGJeSnunSvUqS7z5iVLS33cJoD2t 7KP5YJTRPWyXWhlWUQb6yX4FB2gQ3K9TBoXDuyasgpfgp+sTW9wK32CxgnEnonnJF+z7 PrMwBkOrbSCSBxMgHhDpwSYAwODuXQREBp097821B6MP3zpEfoqJ7xOUtP/Fmg5WWwgK 9ygLbfQ19ZJO53qT+SrWtvVGXJk1qkU4IDKrR1EUlZ2yAb+Om4Zcy5wZ/sogI/mXxQ8w fBXA== 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=i/xBFFsTteRwcwZJYcChbPinILPAZKmMm6qXQNZzwYw=; b=jj626n3cylw6dMrZ6pD5QhvWz0Z9w6Ei2AZ+dJHIb6copDh+Twxbg8A3QPa6RCd3ek nxcR+vyvBhkloeVQ8FC+P147jmk++1H/xod/PjR4fdOJlMYDZjYHzR8o7lyqlSuRVGa2 TJ9fveie1nF++0/JkKbi+eSGpupWS3ClntJiVNQgOkIXaq4u39RscowraAMcyney3z70 pmqEQGR/CXgIKr1eD5GJfk2GFzSOXIYE3tRkBKLCtZhCmW2TiHAidEHl9JJXQfUTScHw mPGQPCD63Q1OmjM+zY85JHc0vGRDhtykYsqBCkXhoF8FJCSxNMulsRLgMdYf+2xg2Anv 29eA== 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 mh8si69694ejb.245.2020.07.24.00.12.24; Fri, 24 Jul 2020 00:12:46 -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 S1726834AbgGXHL1 (ORCPT + 99 others); Fri, 24 Jul 2020 03:11:27 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:5558 "EHLO mx0b-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726559AbgGXHL1 (ORCPT ); Fri, 24 Jul 2020 03:11:27 -0400 Received: from pps.filterd (m0127361.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 06O73j6K126520; Fri, 24 Jul 2020 03:11:14 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 32fb8y6k2b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 24 Jul 2020 03:11:14 -0400 Received: from m0127361.ppops.net (m0127361.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 06O74wo3130104; Fri, 24 Jul 2020 03:11:13 -0400 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 32fb8y6k24-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 24 Jul 2020 03:11:13 -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 06O7AJPm032602; Fri, 24 Jul 2020 07:11:13 GMT Received: from b01cxnp23033.gho.pok.ibm.com (b01cxnp23033.gho.pok.ibm.com [9.57.198.28]) by ppma03dal.us.ibm.com with ESMTP id 32brqa77ca-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 24 Jul 2020 07:11:13 +0000 Received: from b01ledav005.gho.pok.ibm.com (b01ledav005.gho.pok.ibm.com [9.57.199.110]) by b01cxnp23033.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 06O7BCdF19661128 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 24 Jul 2020 07:11:12 GMT Received: from b01ledav005.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 46120AE062; Fri, 24 Jul 2020 07:11:12 +0000 (GMT) Received: from b01ledav005.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 91C6FAE05C; Fri, 24 Jul 2020 07:11:11 +0000 (GMT) Received: from sofia.ibm.com (unknown [9.85.93.226]) by b01ledav005.gho.pok.ibm.com (Postfix) with ESMTP; Fri, 24 Jul 2020 07:11:11 +0000 (GMT) Received: by sofia.ibm.com (Postfix, from userid 1000) id 1815A2E340E; Fri, 24 Jul 2020 12:41:08 +0530 (IST) Date: Fri, 24 Jul 2020 12:41:08 +0530 From: Gautham R Shenoy To: Srikar Dronamraju Cc: Michael Ellerman , linuxppc-dev , LKML , Nicholas Piggin , Anton Blanchard , "Oliver O'Halloran" , Nathan Lynch , Michael Neuling , Gautham R Shenoy , Ingo Molnar , Peter Zijlstra , Valentin Schneider , Jordan Niethe Subject: Re: [PATCH v3 05/10] powerpc/smp: Dont assume l2-cache to be superset of sibling Message-ID: <20200724071108.GD21415@in.ibm.com> Reply-To: ego@linux.vnet.ibm.com References: <20200723085116.4731-1-srikar@linux.vnet.ibm.com> <20200723085116.4731-6-srikar@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200723085116.4731-6-srikar@linux.vnet.ibm.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235,18.0.687 definitions=2020-07-24_01:2020-07-24,2020-07-23 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 lowpriorityscore=0 malwarescore=0 bulkscore=0 adultscore=0 suspectscore=0 phishscore=0 impostorscore=0 spamscore=0 clxscore=1015 mlxscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2007240052 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 23, 2020 at 02:21:11PM +0530, Srikar Dronamraju wrote: > Current code assumes that cpumask of cpus sharing a l2-cache mask will > always be a superset of cpu_sibling_mask. > > Lets stop that assumption. cpu_l2_cache_mask is a superset of > cpu_sibling_mask if and only if shared_caches is set. > > Cc: linuxppc-dev > Cc: LKML > Cc: Michael Ellerman > Cc: Nicholas Piggin > Cc: Anton Blanchard > Cc: Oliver O'Halloran > Cc: Nathan Lynch > Cc: Michael Neuling > Cc: Gautham R Shenoy > Cc: Ingo Molnar > Cc: Peter Zijlstra > Cc: Valentin Schneider > Cc: Jordan Niethe > Signed-off-by: Srikar Dronamraju Reviewed-by: Gautham R. Shenoy > --- > Changelog v1 -> v2: > Set cpumask after verifying l2-cache. (Gautham) > > arch/powerpc/kernel/smp.c | 28 +++++++++++++++------------- > 1 file changed, 15 insertions(+), 13 deletions(-) > > diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c > index da27f6909be1..d997c7411664 100644 > --- a/arch/powerpc/kernel/smp.c > +++ b/arch/powerpc/kernel/smp.c > @@ -1194,6 +1194,7 @@ static bool update_mask_by_l2(int cpu, struct cpumask *(*mask_fn)(int)) > if (!l2_cache) > return false; > > + cpumask_set_cpu(cpu, mask_fn(cpu)); > for_each_cpu(i, cpu_online_mask) { > /* > * when updating the marks the current CPU has not been marked > @@ -1276,29 +1277,30 @@ static void add_cpu_to_masks(int cpu) > * add it to it's own thread sibling mask. > */ > cpumask_set_cpu(cpu, cpu_sibling_mask(cpu)); > + cpumask_set_cpu(cpu, cpu_core_mask(cpu)); > > for (i = first_thread; i < first_thread + threads_per_core; i++) > if (cpu_online(i)) > set_cpus_related(i, cpu, cpu_sibling_mask); > > add_cpu_to_smallcore_masks(cpu); > - /* > - * Copy the thread sibling mask into the cache sibling mask > - * and mark any CPUs that share an L2 with this CPU. > - */ > - for_each_cpu(i, cpu_sibling_mask(cpu)) > - set_cpus_related(cpu, i, cpu_l2_cache_mask); > update_mask_by_l2(cpu, cpu_l2_cache_mask); > > - /* > - * Copy the cache sibling mask into core sibling mask and mark > - * any CPUs on the same chip as this CPU. > - */ > - for_each_cpu(i, cpu_l2_cache_mask(cpu)) > - set_cpus_related(cpu, i, cpu_core_mask); > + if (pkg_id == -1) { > + struct cpumask *(*mask)(int) = cpu_sibling_mask; > + > + /* > + * Copy the sibling mask into core sibling mask and > + * mark any CPUs on the same chip as this CPU. > + */ > + if (shared_caches) > + mask = cpu_l2_cache_mask; > + > + for_each_cpu(i, mask(cpu)) > + set_cpus_related(cpu, i, cpu_core_mask); > > - if (pkg_id == -1) > return; > + } > > for_each_cpu(i, cpu_online_mask) > if (get_physical_package_id(i) == pkg_id) > -- > 2.18.2 >