From patchwork Tue May 27 23:49:24 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zi Shen Lim X-Patchwork-Id: 31025 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yh0-f69.google.com (mail-yh0-f69.google.com [209.85.213.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 7709D203C3 for ; Tue, 27 May 2014 23:51:31 +0000 (UTC) Received: by mail-yh0-f69.google.com with SMTP id i57sf43059126yha.0 for ; Tue, 27 May 2014 16:51:31 -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:date:from:to:subject:message-id :references:mime-version:in-reply-to:user-agent:cc:precedence :list-id:list-unsubscribe:list-archive:list-post:list-help :list-subscribe:sender:errors-to:x-original-sender :x-original-authentication-results:mailing-list:content-disposition :content-type:content-transfer-encoding; bh=FiUqTEVFyqOC1R0yXrykmKSPUvYospJc1DkOG1GP0e0=; b=BVoMfkkHOHA/E4EIEa/KRPkCBXvT5Le15dxP446PgovjPZD6GBhflpo5KeR8NwuSVT 7ShJObTgODTy3z80Ww/7Taur6HjuOJzmGiEA+1qZLIqdo6ZSPwUx2PY61A/RuXxtb0a7 OFMXO4unweyJ/KURGLzVWX19tLeXhbu1iuzahK/IW9YLL750vA/FR9vWojpCPXr27dYD ktJDa022QJ63ZqYEzVvwX3+9IsSv6DTvE9FPfoYLFCdVfjHHAPxSWgwZvSBph+GWkv6L h96tA3KXW7P9PnJ7aeFRTPohb3NYXrf4+jU2EqOYx2EPV13zN3utDo1kKQ+omSYM2fao dxHw== X-Gm-Message-State: ALoCoQm7Cleq1sIV1fA4Sszo2134rC+YfKW3QaT5QIOrUSvlJ65LFprT4A/Ahju0u88yLYPms/uc X-Received: by 10.236.135.145 with SMTP id u17mr13127842yhi.44.1401234691093; Tue, 27 May 2014 16:51:31 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.29.225 with SMTP id b88ls3205824qgb.32.gmail; Tue, 27 May 2014 16:51:30 -0700 (PDT) X-Received: by 10.53.13.35 with SMTP id ev3mr25406418vdd.1.1401234690924; Tue, 27 May 2014 16:51:30 -0700 (PDT) Received: from mail-vc0-f181.google.com (mail-vc0-f181.google.com [209.85.220.181]) by mx.google.com with ESMTPS id up9si9324727vec.97.2014.05.27.16.51.30 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 27 May 2014 16:51:30 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.181 as permitted sender) client-ip=209.85.220.181; Received: by mail-vc0-f181.google.com with SMTP id hy4so8164792vcb.12 for ; Tue, 27 May 2014 16:51:30 -0700 (PDT) X-Received: by 10.58.186.207 with SMTP id fm15mr30736273vec.4.1401234690675; Tue, 27 May 2014 16:51:30 -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.220.221.72 with SMTP id ib8csp158424vcb; Tue, 27 May 2014 16:51:30 -0700 (PDT) X-Received: by 10.140.104.195 with SMTP id a61mr44698997qgf.102.1401234689722; Tue, 27 May 2014 16:51:29 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id x7si19782212qai.20.2014.05.27.16.51.29 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 27 May 2014 16:51:29 -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 1WpR7s-00053D-O5; Tue, 27 May 2014 23:49:48 +0000 Received: from mail-gw2-out.broadcom.com ([216.31.210.63]) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WpR7q-000505-Lh for linux-arm-kernel@lists.infradead.org; Tue, 27 May 2014 23:49:47 +0000 X-IronPort-AV: E=Sophos;i="4.98,923,1392192000"; d="scan'208";a="31506746" Received: from irvexchcas08.broadcom.com (HELO IRVEXCHCAS08.corp.ad.broadcom.com) ([10.9.208.57]) by mail-gw2-out.broadcom.com with ESMTP; 27 May 2014 16:50:49 -0700 Received: from IRVEXCHSMTP3.corp.ad.broadcom.com (10.9.207.53) by IRVEXCHCAS08.corp.ad.broadcom.com (10.9.208.57) with Microsoft SMTP Server (TLS) id 14.3.174.1; Tue, 27 May 2014 16:49:24 -0700 Received: from mail-sj1-12.sj.broadcom.com (10.10.10.20) by IRVEXCHSMTP3.corp.ad.broadcom.com (10.9.207.53) with Microsoft SMTP Server id 14.3.174.1; Tue, 27 May 2014 16:49:23 -0700 Received: from lc-sj1-5012.broadcom.com (lc-sj1-5012.sj.broadcom.com [10.66.65.230]) by mail-sj1-12.sj.broadcom.com (Postfix) with ESMTP id 4F47B27A82; Tue, 27 May 2014 16:49:24 -0700 (PDT) Received: by lc-sj1-5012.broadcom.com (Postfix, from userid 28931) id 3D054E01E65; Tue, 27 May 2014 16:49:24 -0700 (PDT) Date: Tue, 27 May 2014 16:49:24 -0700 From: Zi Shen Lim To: Lorenzo Pieralisi , Mark Brown Subject: Re: [PATCH 4/6] arm64: topology: add MPIDR-based detection Message-ID: <20140527234924.GA2691@lc-sj1-5012.sj.broadcom.com> References: <1399063112-16917-1-git-send-email-broonie@kernel.org> <1399063112-16917-5-git-send-email-broonie@kernel.org> <53763DFC.8070309@arm.com> <20140516183915.GP22111@sirena.org.uk> <5379D594.2000200@arm.com> <20140519105405.GC5935@e102568-lin.cambridge.arm.com> <20140519123314.GU12304@sirena.org.uk> <20140519141323.GA2917@e102568-lin.cambridge.arm.com> <20140519161217.GX12304@sirena.org.uk> <20140519171511.GA5240@e102568-lin.cambridge.arm.com> MIME-Version: 1.0 In-Reply-To: <20140519171511.GA5240@e102568-lin.cambridge.arm.com> User-Agent: Mutt/1.4.2.2i X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140527_164946_746382_2E6F2422 X-CRM114-Status: GOOD ( 15.14 ) X-Spam-Score: -3.0 (---) X-Spam-Report: SpamAssassin version 3.3.2 on bombadil.infradead.org summary: Content analysis details: (-3.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, medium trust [216.31.210.63 listed in list.dnswl.org] -0.7 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain Cc: Mark Rutland , "linaro-kernel@lists.linaro.org" , Catalin Marinas , Will Deacon , Sudeep Holla , "linux-arm-kernel@lists.infradead.org" X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , 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: zlim@broadcom.com 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.181 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 Content-Disposition: inline On Mon, May 19, 2014 at 06:15:11PM +0100, Lorenzo Pieralisi wrote: [...] > > Hashing compresses the cluster index, but that index is not representative > of HW anyway. If you go for simple shifting we might end up with huge cluster > ids, which is fine but a bit weird. > > So either (1) you use three affinity levels or (2) the simplest way to combine > the affinity levels. > Sorry for jumping in late. The original patch packs the cluster_id, in hope of providing linear mapping when the affinity tree is balanced. I'm fine with the simplest way of shifting/oring, if that's the preferred method :) The patch below applies on top of the series Mark sent out. 1. Dropped mpidr_hash-related bits, in favor of simpler shift/or using MPIDR. 2. Also addressed Lorenzo's comment about redundant cluster_id==-1 check. Mark, can you please apply/squash this patch? Thanks, z diff --git a/arch/arm64/include/asm/cputype.h b/arch/arm64/include/asm/cputype.h index b3b3287..7639e8b 100644 --- a/arch/arm64/include/asm/cputype.h +++ b/arch/arm64/include/asm/cputype.h @@ -32,9 +32,6 @@ #define MPIDR_AFFINITY_LEVEL(mpidr, level) \ ((mpidr >> MPIDR_LEVEL_SHIFT(level)) & MPIDR_LEVEL_MASK) -#define MPIDR_AFF_MASK(level) \ - ((u64)MPIDR_LEVEL_MASK << MPIDR_LEVEL_SHIFT(level)) - #define read_cpuid(reg) ({ \ u64 __val; \ asm("mrs %0, " #reg : "=r" (__val)); \ diff --git a/arch/arm64/kernel/topology.c b/arch/arm64/kernel/topology.c index f7f3478..26fc5b0 100644 --- a/arch/arm64/kernel/topology.c +++ b/arch/arm64/kernel/topology.c @@ -22,7 +22,6 @@ #include #include -#include #include /* @@ -364,12 +363,6 @@ static void update_siblings_masks(unsigned int cpuid) struct cpu_topology *cpu_topo, *cpuid_topo = &cpu_topology[cpuid]; int cpu; - if (cpuid_topo->cluster_id == -1) { - /* No topology information for this cpu ?! */ - pr_err("CPU%u: No topology information configured\n", cpuid); - return; - } - /* update core and thread sibling masks */ for_each_possible_cpu(cpu) { cpu_topo = &cpu_topology[cpu]; @@ -410,19 +403,15 @@ 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 & MPIDR_AFF_MASK(2)) >> mpidr_hash.shift_aff[2] | - (mpidr & MPIDR_AFF_MASK(3)) >> mpidr_hash.shift_aff[3]) - >> mpidr_hash.shift_aff[1] >> mpidr_hash.shift_aff[0]; + 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; cpuid_topo->core_id = MPIDR_AFFINITY_LEVEL(mpidr, 0); - cpuid_topo->cluster_id = - ((mpidr & MPIDR_AFF_MASK(1)) >> mpidr_hash.shift_aff[1] | - (mpidr & MPIDR_AFF_MASK(2)) >> mpidr_hash.shift_aff[2] | - (mpidr & MPIDR_AFF_MASK(3)) >> mpidr_hash.shift_aff[3]) - >> mpidr_hash.shift_aff[0]; + cpuid_topo->cluster_id = MPIDR_AFFINITY_LEVEL(mpidr, 1) | + MPIDR_AFFINITY_LEVEL(mpidr, 2) << 8 | + MPIDR_AFFINITY_LEVEL(mpidr, 3) << 16; } pr_debug("CPU%u: cluster %d core %d thread %d mpidr %llx\n",