From patchwork Tue Aug 19 15:32:59 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 35625 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ig0-f200.google.com (mail-ig0-f200.google.com [209.85.213.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id EEF32202DD for ; Tue, 19 Aug 2014 15:37:14 +0000 (UTC) Received: by mail-ig0-f200.google.com with SMTP id uq10sf30160207igb.3 for ; Tue, 19 Aug 2014 08:37:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:subject:cc :precedence:list-id:list-unsubscribe:list-archive:list-post :list-help:list-subscribe:mime-version:sender:errors-to :x-original-sender:x-original-authentication-results:mailing-list :content-type:content-transfer-encoding; bh=j4c2g3SKL5sB4EtW9lVeHWqTyIEDglyxCN4TSVKwRjk=; b=IbXi0dtIv2a3FvkGv/Kh5t4l0QbnaJJ/zjtDDkCHBTGKNI8QKZ4TETS7dDetOGymHQ IMN/nq1DiesgLB0iWFdTwa6/ic1kwnCfWP/UwJJrB3sVv39doRkLnU+DHzUkhlcBgo5Q DyXOJAcBkM9z8bfnl6OxKvMOdib2wDov6bYbbu39oQJLbFNAbv+pN0UYn96U/fDza/nP 36XOhYvepi1cjIb/rNDZbuPs9dNwBB7ldsi8Rja1C/tJKcsi8a7xGf9iJsppBLizMTPh RN87/OWo0xMAbozFDFrjYvJDY3hGKittQmIL7NEHwOtrBldmJV19ROmT1wF/x9bUWpUC fU3A== X-Gm-Message-State: ALoCoQmslarkEBceCehVZad9vZD7oOrrgDY4y08pMauYYp9RZS+nZe/Wo0GH9g3+DKkKuR+TUc99 X-Received: by 10.50.23.45 with SMTP id j13mr3471272igf.7.1408462634431; Tue, 19 Aug 2014 08:37:14 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.91.40 with SMTP id y37ls2982867qgd.2.gmail; Tue, 19 Aug 2014 08:37:14 -0700 (PDT) X-Received: by 10.52.166.35 with SMTP id zd3mr186747vdb.96.1408462634208; Tue, 19 Aug 2014 08:37:14 -0700 (PDT) Received: from mail-vc0-f180.google.com (mail-vc0-f180.google.com [209.85.220.180]) by mx.google.com with ESMTPS id id4si8939621vdb.100.2014.08.19.08.37.14 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 19 Aug 2014 08:37:14 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.180 as permitted sender) client-ip=209.85.220.180; Received: by mail-vc0-f180.google.com with SMTP id ij19so7426839vcb.25 for ; Tue, 19 Aug 2014 08:37:14 -0700 (PDT) X-Received: by 10.220.118.136 with SMTP id v8mr1105070vcq.50.1408462634125; Tue, 19 Aug 2014 08:37:14 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp248914vcb; Tue, 19 Aug 2014 08:37:13 -0700 (PDT) X-Received: by 10.140.50.16 with SMTP id r16mr64682765qga.96.1408462633644; Tue, 19 Aug 2014 08:37:13 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id a110si29466271qge.3.2014.08.19.08.37.13 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 19 Aug 2014 08:37:13 -0700 (PDT) Received-SPF: none (google.com: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org does not designate permitted sender hosts) client-ip=2001:1868:205::9; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XJlQs-0004rM-RW; Tue, 19 Aug 2014 15:34:46 +0000 Received: from mezzanine.sirena.org.uk ([2400:8900::f03c:91ff:fedb:4f4]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XJlQp-0004ot-Gi for linux-arm-kernel@lists.infradead.org; Tue, 19 Aug 2014 15:34:44 +0000 Received: from [216.80.66.37] (helo=finisterre) by mezzanine.sirena.org.uk with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1XJlQ8-0004aJ-Jz; Tue, 19 Aug 2014 15:34:02 +0000 Received: from broonie by finisterre with local (Exim 4.84_RC1) (envelope-from ) id 1XJlQ0-0007Hv-Po; Tue, 19 Aug 2014 10:33:52 -0500 From: Mark Brown To: Lorenzo Pieralisi , Catalin Marinas Date: Tue, 19 Aug 2014 10:32:59 -0500 Message-Id: <1408462379-27968-1-git-send-email-broonie@kernel.org> X-Mailer: git-send-email 2.1.0.rc1 X-SA-Exim-Connect-IP: 216.80.66.37 X-SA-Exim-Mail-From: broonie@sirena.org.uk X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on mezzanine.sirena.org.uk X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham version=3.3.2 Subject: [PATCH] arm64: topology: Fix handling of multi-level cluster MPIDR-based detection X-SA-Exim-Version: 4.2.1 (built Mon, 26 Dec 2011 16:24:06 +0000) X-SA-Exim-Scanned: Yes (on mezzanine.sirena.org.uk) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140819_083443_667669_892252FA X-CRM114-Status: GOOD ( 11.70 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -0.0 SPF_PASS SPF: sender matches SPF record 0.0 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different Cc: Zi Shen Lim , Mark Brown , linux-arm-kernel@lists.infradead.org, linaro-kernel@lists.linaro.org, Ganapatrao Kulkarni X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: broonie@kernel.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.180 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 From: Mark Brown The only requirement the scheduler has on cluster IDs is that they must be unique. When enumerating the topology based on MPIDR information the kernel currently generates cluster IDs by using the first level of affinity above the core ID (either level one or two depending on if the core has multiple threads) however the ARMv8 architecture allows for up to three levels of affinity. This means that an ARMv8 system may contain cores which have MPIDRs identical other than affinity level three which with current code will cause us to report multiple cores with the same identification to the scheduler in violation of its uniqueness requirement. Ensure that we do not violate the scheduler requirements on systems that uses all the affinity levels by incorporating both affinity levels two and three into the cluser ID when the cores are not threaded. While no currently known hardware uses multi-level clusters it is better to program defensively, this will help ease bringup of systems that have them and will ensure that things like distribution install media do not need to be respun to replace kernels in order to deploy such systems. In the worst case the system will work but perform suboptimally until a kernel modified to handle the new topology better is installed, in the best case this will be an adequate description of such topologies for the scheduler to perform well. Signed-off-by: Mark Brown --- arch/arm64/kernel/topology.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/arm64/kernel/topology.c b/arch/arm64/kernel/topology.c index b6ee26b..5752c1b 100644 --- a/arch/arm64/kernel/topology.c +++ b/arch/arm64/kernel/topology.c @@ -255,7 +255,8 @@ void store_cpu_topology(unsigned int cpuid) /* Multiprocessor system : Multi-threads per core */ cpuid_topo->thread_id = MPIDR_AFFINITY_LEVEL(mpidr, 0); cpuid_topo->core_id = MPIDR_AFFINITY_LEVEL(mpidr, 1); - cpuid_topo->cluster_id = MPIDR_AFFINITY_LEVEL(mpidr, 2); + cpuid_topo->cluster_id = MPIDR_AFFINITY_LEVEL(mpidr, 2) | + MPIDR_AFFINITY_LEVEL(mpidr, 3) << 8; } else { /* Multiprocessor system : Single-thread per core */ cpuid_topo->thread_id = -1;