Received: by 10.192.165.156 with SMTP id m28csp1665231imm; Tue, 17 Apr 2018 03:26:06 -0700 (PDT) X-Google-Smtp-Source: AIpwx48tZqXfUd6pWXDfNtREMJOEZ48X493BiLxKnrUT8Y6OjtznicXOqUSMsbMkBhgtfgxZK43M X-Received: by 10.99.109.195 with SMTP id i186mr1267455pgc.403.1523960766419; Tue, 17 Apr 2018 03:26:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523960766; cv=none; d=google.com; s=arc-20160816; b=i+s81fN2S6NKgdKWRc/CfR/YaWg8cvl6AWxjbsGXCym6m+lG36nWYoIDoYnAGYeCl3 qVJqOm2w54Qpj3rwS8zo0S+xsa+oO3YA54cKJpTXc4zVU4N4z4j7yhA48aNtHNZfoRT2 Dx3XKKxBbACi5PHBCESAz+bMOCNweO98OZkOPmqHERLwOlUggZg49H2PtwaR1foMcz5x 6lSZuFCa8NKgBAAIdkmogswWOe2MMB9xpyZCLpDwenKcbQSPpj+SB3INkY16k28sIPgp pkv8JCJc2Amq81cCW5X0+U8stihYpGFOrwYSSj9gvrXdqOEXxg1kwcvJL/x0qXzOGwH7 XrJA== 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:message-id:subject:cc :to:from:date:arc-authentication-results; bh=E1LXzmA58ErAv9fNvlakVAh2Tk+U4B0rWmOSpUY6YsA=; b=uhGUUljvKe/UF82j+7CgSdvjARcjgAqeAWOvNQ+HoSQPfSB5q9x+e2z+v13QENDWUo UHoEOtozKssFrR5G5qJFCNKzBgeYUjcv1Jr4rcBdfQJLdXVavMQGa75n4Ygt544wgKuA S+tGmfFqe9QUAh/Ulj6bug3KUI5oLJyd3oYug3RHs/x+4VMiwaO1HUAF+3A3qop8SAi0 Hy2IUODKhTIsrTUQYX4rJZEfNT47ujv+cOmV8mg7B4GF+93VFK3EiuhVzIuwm2ZR2EKn 618e20vluRALfj52ozB3EBtk+Xwv4aqUpj78zqRp3l8W31xTwO4i10t+2U7YintttUlN GEDw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z1si11449753pgs.132.2018.04.17.03.25.52; Tue, 17 Apr 2018 03:26:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752511AbeDQKYe (ORCPT + 99 others); Tue, 17 Apr 2018 06:24:34 -0400 Received: from foss.arm.com ([217.140.101.70]:40600 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752273AbeDQKYc (ORCPT ); Tue, 17 Apr 2018 06:24:32 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 667A315AB; Tue, 17 Apr 2018 03:24:32 -0700 (PDT) Received: from e107981-ln.cambridge.arm.com (e107981-ln.cambridge.arm.com [10.1.207.54]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 32DD73F587; Tue, 17 Apr 2018 03:24:30 -0700 (PDT) Date: Tue, 17 Apr 2018 11:24:24 +0100 From: Lorenzo Pieralisi To: Daniel Lezcano Cc: Viresh Kumar , Sudeep Holla , edubezval@gmail.com, kevin.wangtao@linaro.org, leo.yan@linaro.org, vincent.guittot@linaro.org, linux-kernel@vger.kernel.org, javi.merino@kernel.org, rui.zhang@intel.com, daniel.thompson@linaro.org, linux-pm@vger.kernel.org, Amit Daniel Kachhap Subject: Re: [PATCH v3 6/7] thermal/drivers/cpu_cooling: Introduce the cpu idle cooling driver Message-ID: <20180417102424.GA27279@e107981-ln.cambridge.arm.com> References: <20180416093747.GB4244@vireshk-i7> <4abf0d97-d2b8-46ab-3c05-4a11510ac3fe@linaro.org> <20180416095006.GC4244@vireshk-i7> <20180416101021.GD4244@vireshk-i7> <1c61128a-dea6-b12c-4cd8-ef53a5c8628d@linaro.org> <20180416123019.GA9341@e107981-ln.cambridge.arm.com> <633cdc63-ce6d-89af-26dd-bdc3a27556ed@linaro.org> <20180416142243.GB32565@red-moon> <845fafa3-f0ab-2050-fe32-1780dc61b8a8@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <845fafa3-f0ab-2050-fe32-1780dc61b8a8@linaro.org> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 17, 2018 at 09:17:36AM +0200, Daniel Lezcano wrote: [...] > >>>> Actually there is no impact with the change Sudeep is referring to. It > >>>> is for ACPI, we are DT based. Confirmed with Jeremy. > >>>> > >>>> So AFAICT, it is not a problem. > >>> > >>> It is a problem - DT or ACPI alike. Sudeep was referring to the notion > >>> of "cluster" that has no architectural meaning whatsoever and using > >>> topology_physical_package_id() to detect a "cluster" was/is/will always > >>> be the wrong thing to do. The notion of cluster must not appear in the > >>> kernel at all, it has no architectural meaning. I understand you need > >>> to group CPUs but that has to be done in a different way, through > >>> cooling devices, thermal domains or power domains DT/ACPI bindings but > >>> not by using topology masks. > >> > >> I don't get it. What is the cluster concept defined in the ARM > >> documentation? > >> > >> ARM Cortex-A53 MPCore Processor Technical Reference Manual > >> > >> 4.5.2. Multiprocessor Affinity Register > >> > >> I see the documentation says: > >> > >> A cluster with two cores, three cores, ... > >> > >> How the kernel can represent that if you kill the > >> topology_physical_package_id() ? > > > > From an Arm ARM perspective (ARM v8 reference manual), the MPIDR_EL1 has > > no notion of cluster which means that a cluster is not architecturally > > defined on Arm systems. > > Sorry, I'm lost :/ You say the MPIDR_EL1 has no notion of cluster but > the documentation describing this register is all talking about cluster. > > http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0500g/BABHBJCI.html I pointed you at the documentation I am referring to. You are referring to A53 TRM, I am referring to the Arm architecture reference manual that is the reference for all Arm cores. > > Currently, as Morten explained today, topology_physical_package_id() > > is supposed to represent a "cluster" and that's completely wrong > > because a "cluster" cannot be defined from an architectural perspective. > > > > It was a bodge used as a shortcut, wrongly. We should have never used > > that API for that purpose and there must be no code in the kernel > > relying on: > > > > topology_physical_package_id() > > > > to define a cluster; the information you require to group CPUs must > > come from something else, which is firmware bindings(DT or ACPI) as > > I mentioned. > > Why not ? I explained why not :). A cluster is not defined architecturally on Arm - it is as simple as that and you can't rely on a given MPIDR_EL1 subfield to define what a cluster id is. > diff --git a/arch/arm64/include/asm/topology.h > b/arch/arm64/include/asm/topology.h > index c4f2d50..ac0776d 100644 > --- a/arch/arm64/include/asm/topology.h > +++ b/arch/arm64/include/asm/topology.h > @@ -14,7 +14,8 @@ struct cpu_topology { > > extern struct cpu_topology cpu_topology[NR_CPUS]; > > -#define topology_physical_package_id(cpu) > (cpu_topology[cpu].cluster_id) > +#define topology_physical_package_id(cpu) (0) > +#define topology_physical_cluster_id(cpu) There is no such a thing (and there is no architecturally defined package id on Arm either). > (cpu_topology[cpu].cluster_id) > #define topology_core_id(cpu) (cpu_topology[cpu].core_id) > #define topology_core_cpumask(cpu) (&cpu_topology[cpu].core_sibling) > #define topology_sibling_cpumask(cpu) (&cpu_topology[cpu].thread_sibling) > > > > Please speak to Sudeep who will fill you on the reasoning above. > > Yes, Sudeep is next to me but I would prefer to keep the discussion on > the mailing list so everyone can get the reasoning. It is not a reasoning - it is the Arm architecture. There is no architecturally defined cluster id on Arm. The affinity bits in MPIDR_EL1 must be treated as a unique number that represents a given core/thread, how the bits are allocated across affinity levels is not something that you can rely on architecturally - that's why DT/ACPI topology bindings exist to group cpus in a hierarchical topology. HTH, Lorenzo