From patchwork Sat Jul 27 10:42:08 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hanjun Guo X-Patchwork-Id: 2834606 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 034D89F243 for ; Sat, 27 Jul 2013 10:48:09 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1861720134 for ; Sat, 27 Jul 2013 10:48:08 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 10B7820131 for ; Sat, 27 Jul 2013 10:48:07 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1V322a-00042d-Fp; Sat, 27 Jul 2013 10:48:00 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1V322Y-0003AT-EA; Sat, 27 Jul 2013 10:47:58 +0000 Received: from mail-pd0-f181.google.com ([209.85.192.181]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1V322V-00039p-CV for linux-arm-kernel@lists.infradead.org; Sat, 27 Jul 2013 10:47:56 +0000 Received: by mail-pd0-f181.google.com with SMTP id g10so70863pdj.26 for ; Sat, 27 Jul 2013 03:47:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=Sm+N0+grxA73Wf4ubc0tTyQzDmRC2i+4oQIJh2yah0E=; b=nvRHPWN3bvlYXvBR31WaeTXqh2oR0jqz/k9Vixl2YvA9Hf/qRrcFuJ1tlJ6jR6wfOd uPHrCfzjROfcmiIBb+2cpLAooySaiuom+gjFvZc5cFKVnJ/4jDk8lBhlSnhmNLRc6+wR h5YMWX57S5lSzsake0MtMQQRfpoDMz8pIbQG2lsA/xmrxsm1bfmyIDIx9EF1+vVNiwuR aeY3lCZ5eDgRcfIIF4QdPYBjrgxp5Wt1DnVYwSsYZz+OpXlBCQ9MSwBlsTAz0R7OWKWo Xyng10CZXAmJvnx/4sRFrqmJdIM64+koVoTlW4bKcLikUIx5EJ7ENs5mqdd/tEAFVthB HSnA== X-Received: by 10.66.146.42 with SMTP id sz10mr58612812pab.78.1374922053946; Sat, 27 Jul 2013 03:47:33 -0700 (PDT) Received: from localhost ([218.17.215.175]) by mx.google.com with ESMTPSA id at2sm8917423pac.11.2013.07.27.03.45.04 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sat, 27 Jul 2013 03:47:33 -0700 (PDT) From: Hanjun Guo To: Catalin Marinas , Will Deacon Subject: [RFC][PATCH 2/2] ARM64: introduce cluster id and make a difference between socket id Date: Sat, 27 Jul 2013 18:42:08 +0800 Message-Id: <1374921728-9007-2-git-send-email-hanjun.guo@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1374921728-9007-1-git-send-email-hanjun.guo@linaro.org> References: <1374921728-9007-1-git-send-email-hanjun.guo@linaro.org> X-Gm-Message-State: ALoCoQlLQH8Dm6bEB/GuPGJra4dEo5aYK7I1Ne8nLE4DwZx8nmYuX+fggoB/XEchGWEHWGb3nQY4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130727_064755_527392_B2303992 X-CRM114-Status: GOOD ( 13.22 ) X-Spam-Score: -1.1 (-) Cc: linaro-kernel@lists.linaro.org, Vincent Guittot , Graeme Gregory , Al Stone , patches@linaro.org, Naresh Bhat , linaro-acpi@lists.linaro.org, linux-kernel@vger.kernel.org, Tomasz Nowicki , Hanjun Guo , Russell King , 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: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_WEB, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In the cpu topology information, we define topology_physical_package_id() as cpu socket id, which means that the socket id is the idenfication for physical processor, not for a cluster in a cpu die. On ARM64 platform, multi cluster in a cpu die will be normal, here is a example with 2 cores in a cluster and 2 cluster in a socket: |--------------------------------------| | socket | | | | |---------------| |---------------| | | | cluster | | cluster | | | | | | | | | | |----| |----| | | |----| |----| | | | | |core| |core| | | |core| |core| | | | | |----| |----| | | |----| |----| | | | | | | | | | |---------------| |---------------| | | | |--------------------------------------| ARM64 extended the MPIDR into 64 bit and introduce another affinity level, we can use this affinity level for socket id and use the third highest level affinity for cluster id, which make the socket id behavior in its original way. Signed-off-by: Hanjun Guo --- arch/arm64/include/asm/topology.h | 1 + arch/arm64/kernel/topology.c | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/arch/arm64/include/asm/topology.h b/arch/arm64/include/asm/topology.h index 8631808..ff68ecc 100644 --- a/arch/arm64/include/asm/topology.h +++ b/arch/arm64/include/asm/topology.h @@ -8,6 +8,7 @@ struct cputopo_arm64 { int thread_id; int core_id; + int cluster_id; int socket_id; cpumask_t thread_sibling; cpumask_t core_sibling; diff --git a/arch/arm64/kernel/topology.c b/arch/arm64/kernel/topology.c index 1eb0435..6d1e5a6 100644 --- a/arch/arm64/kernel/topology.c +++ b/arch/arm64/kernel/topology.c @@ -80,12 +80,14 @@ void store_cpu_topology(unsigned int cpuid) /* core performance interdependency */ cpuid_topo->thread_id = MPIDR_AFFINITY_LEVEL_0(mpidr); cpuid_topo->core_id = MPIDR_AFFINITY_LEVEL_1(mpidr); - cpuid_topo->socket_id = MPIDR_AFFINITY_LEVEL_2(mpidr); + cpuid_topo->cluster_id = MPIDR_AFFINITY_LEVEL_2(mpidr); + cpuid_topo->socket_id = MPIDR_AFFINITY_LEVEL_3(mpidr); } else { /* largely independent cores */ cpuid_topo->thread_id = -1; cpuid_topo->core_id = MPIDR_AFFINITY_LEVEL_0(mpidr); - cpuid_topo->socket_id = MPIDR_AFFINITY_LEVEL_1(mpidr); + cpuid_topo->cluster_id = MPIDR_AFFINITY_LEVEL_1(mpidr); + cpuid_topo->socket_id = MPIDR_AFFINITY_LEVEL_2(mpidr); } } else { /* @@ -95,6 +97,7 @@ void store_cpu_topology(unsigned int cpuid) */ cpuid_topo->thread_id = -1; cpuid_topo->core_id = 0; + cpuid_topo->cluster_id = -1; cpuid_topo->socket_id = -1; } @@ -120,6 +123,7 @@ void __init init_cpu_topology(void) topo->thread_id = -1; topo->core_id = -1; + topo->cluster_id = -1; topo->socket_id = -1; cpumask_clear(&topo->core_sibling); cpumask_clear(&topo->thread_sibling);