Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1329881imm; Tue, 22 May 2018 02:14:35 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoxy3Oa532Pre9b9RGamYsGzbVZ7ORQtIZKBw00Li1eA+dYUEpqyyFLe/ERvAV+avIBo9tq X-Received: by 2002:a17:902:a714:: with SMTP id w20-v6mr23304997plq.374.1526980475251; Tue, 22 May 2018 02:14:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526980475; cv=none; d=google.com; s=arc-20160816; b=Pe4iQfEddnzq9KeAZvhzuJsWeSP9D8y/RB/BGpemNwuOsHmj/HbQnWt4pA4FwtN1we KvcSD5PYY4a8Dn2zL9bKUClNwQjhEtSFo6eVQ2MIN/QEb+lmxJTjog39ya9cwLPdLLjF 8aTC2lQzD7B/xtT/VASMe8rJmG55VzyYerPn+74EdWnKpA76LYWidnwAjjpo9Q07eIPr ER8Zmvi1l1X6AwMrjp7kPFYtuNTk/7/lUUkD7kp+DPL4c9ApPkPOVjRiLXU+VA9nAYVn U55R0rdJIG15nmRLLU4Ymskls5WfPuAelBvXBp+NnS4QT1NlVVVXzk0dPVySdOS5H8Xa vSFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:organization:from:references:to:subject:cc :arc-authentication-results; bh=iwkysDqST9cLdyyjk1jZJsj74uH2oRJzWGa/DGop+eU=; b=atkg6LFzBRZfptj4tQmHv1JzGm7RNa/gXJHCFiACkwPa2NlsZZQhQ+Z1Y0zBNwrTpK /C470lLfFVTrc2qcB+3IkG3n9gvJjIDaeu5LHNgK0Qzc4Jrz86JfHQAldb0rTtEo/KV6 ovdyG/avWa8s7F9nq9mU6kTfdzoCkhXQo4TI+4CZjSRcG2AUkln0F9g02heKYSd4wrbc GtdjmzQ7gEq+aYj4nV8gcK3Gzh1OaFLWCKY9LIGGyjUXIOQ1C5ZtXPFYRqKAxy1KncKH X1OopmrPJtc5QVf1y7Vvx0CMnRWCYR4MZ/4z9w0cVvXXncbiA0WjfIP4mfCN5tJQ+g/C 9Xxg== 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 o7-v6si16082807pfh.103.2018.05.22.02.14.19; Tue, 22 May 2018 02:14:35 -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 S1751390AbeEVJMq (ORCPT + 99 others); Tue, 22 May 2018 05:12:46 -0400 Received: from foss.arm.com ([217.140.101.70]:33330 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751240AbeEVJMn (ORCPT ); Tue, 22 May 2018 05:12:43 -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 18EE61435; Tue, 22 May 2018 02:12:43 -0700 (PDT) Received: from [10.1.210.28] (unknown [10.1.210.28]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B27D33F577; Tue, 22 May 2018 02:12:35 -0700 (PDT) Cc: Sudeep Holla , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, rnayak@codeaurora.org, amit.kucheria@linaro.org, nicolas.dechesne@linaro.org, celster@codeaurora.org, tfinkel@codeaurora.org Subject: Re: [PATCH] cpufreq: Add Kryo CPU scaling driver To: ilialin@codeaurora.org, mturquette@baylibre.com, sboyd@kernel.org, robh@kernel.org, mark.rutland@arm.com, viresh.kumar@linaro.org, nm@ti.com, lgirdwood@gmail.com, broonie@kernel.org, andy.gross@linaro.org, david.brown@linaro.org, catalin.marinas@arm.com, will.deacon@arm.com, rjw@rjwysocki.net, linux-clk@vger.kernel.org References: <1526555955-29960-11-git-send-email-ilialin@codeaurora.org> <1526729701-8589-1-git-send-email-ilialin@codeaurora.org> <153cc316-dcb5-972f-5a2f-c91fe0f6348b@arm.com> <000f01d3f103$3ff78ba0$bfe6a2e0$@codeaurora.org> <2ace10bc-e1c4-2060-94d3-eb71e966ffbe@arm.com> <001201d3f19a$0130a860$0391f920$@codeaurora.org> From: Sudeep Holla Organization: ARM Message-ID: <5b2eb27b-b852-97ff-b099-fe4c22b44937@arm.com> Date: Tue, 22 May 2018 10:12:34 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <001201d3f19a$0130a860$0391f920$@codeaurora.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 22/05/18 07:56, ilialin@codeaurora.org wrote: > > >> -----Original Message----- >> From: Sudeep Holla >> Sent: Monday, May 21, 2018 16:05 [...] >> >> >> That may be true and I am not that bothered about it. But assuming physical >> ordering from the logical cpu number is *incorrect* and will break if kernel >> decides to change the allocation algorithm. Kernel provides no guarantee on >> that, so you need to depend on some physical ID or may be DT to achieve >> what your want. But the current code as it stands is wrong. > > Got your point. In fact CPUs are numbered 0-3 and ordered into 2 clusters in the DT: > > cpus { > #address-cells = <2>; > #size-cells = <0>; > > CPU0: cpu@0 { > ... > reg = <0x0 0x0>; > ... > }; > > CPU1: cpu@1 { > ... > reg = <0x0 0x1>; > ... > }; > > CPU2: cpu@100 { > ... > reg = <0x0 0x100>; > ... > }; > > CPU3: cpu@101 { > ... > reg = <0x0 0x101>; > ... > }; > > cpu-map { > cluster0 { > core0 { > cpu = <&CPU0>; > }; > > core1 { > cpu = <&CPU1>; > }; > }; > > cluster1 { > core0 { > cpu = <&CPU2>; > }; > > core1 { > cpu = <&CPU3>; > }; > }; > }; > }; > > As far, as I understand, they are probed in the same order. Yes that's correct today, will that have to remain same for ever ? No it's not user ABI and kernel can decide to change the allocation order. What if for some reason one/more CPUs fails to boot or even configured not to boot ? > However, to be certain that the physical CPU is the one I intend to > configure, I have to fetch the device structure pointer for the cpu-map -> > clusterX -> core0 -> cpu path. Could you suggest a kernel API to do > that? > Let's rewind a bit. Do you supply OPPs only on CPU0 and CPU2 ? If yes, that's again wrong. Simple solution is to parse all logical CPUs and skip if the share OPPs with some other CPUs. I think that logic already exists in OPP library IIRC. -- Regards, Sudeep