Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp606933ybl; Fri, 10 Jan 2020 03:57:09 -0800 (PST) X-Google-Smtp-Source: APXvYqwkEYdGEfCwZocynGWzC6aXyfnIkUvi6S7/CZZDeySbTKDipB6ENW01bSH4pPavM2F42PNK X-Received: by 2002:a9d:4e99:: with SMTP id v25mr2303584otk.363.1578657429616; Fri, 10 Jan 2020 03:57:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578657429; cv=none; d=google.com; s=arc-20160816; b=Djb3Wt9ej07+cRqCslkuiP6SBLDaQoDZsboF1OcTc9s7qxu/PoSp0r7SE43g1KEcZk VXBIyyFm1FbGIpJVXsM+mcKqYEM7N4yCswKe5zB7hNjrSSf9L9CjPa2gmsG8eL7MrwHz 3BnMAt0tKKqDBFfOS6HJYjzCl8chgIcLVKgidl1fOQHNoAtK31gwFjw3/MO5g2b4z0d8 +v+wnrROySrlt+TMnQMHacTC0baQsSTBmixklTauSrg10d7b1k4tONASZViKqHZNVNGP KddUmb9XdaQEnPg8gmb7Udw2v6FZQ8/jI6/CFF1S2hMP/6fZCSA11iMy85Z2jvby5bWe ZOdA== 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:from:references:cc:to:subject; bh=s7CUz+p4+SnpVTfGHdb95XEVNN2cIAzsJcImvIoXyJQ=; b=EUAl80DsHkGjiTAUjtCJ9smHzKX6rzadXeLF3T0AQVgsIbDolp3o/Fbf9g1/Avlnlo 29FMj2lx70FKkYmCgqnziscpCIeyCYUh6xpYWVtLk1vCjlsFKK1o1dUMEj4gazDw8dn7 17sQN40z1jVNrqWI2JyEBlS621+XSgXk+fOp93ikrG7MgBrZtwU1H87m/9+hgolktGah 1ILn1x2FECJNBZjjR5ASGCPcoUR9xwbdT04kk7Q+kBwLwGASHiID0nsmddJFDlDeu9mS krrcG1Ws0ZOOk2tNkwsFzIrFRK/N6sAiBFgnhoRjnmgta6qQvgRgI0JY6bxHuyetYdL8 6JjQ== 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 v18si1123098otn.202.2020.01.10.03.56.58; Fri, 10 Jan 2020 03:57:09 -0800 (PST) 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 S1728219AbgAJLyv (ORCPT + 99 others); Fri, 10 Jan 2020 06:54:51 -0500 Received: from foss.arm.com ([217.140.110.172]:43242 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728183AbgAJLyu (ORCPT ); Fri, 10 Jan 2020 06:54:50 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 2F6861063; Fri, 10 Jan 2020 03:54:50 -0800 (PST) Received: from [192.168.1.123] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C60173F534; Fri, 10 Jan 2020 03:54:48 -0800 (PST) Subject: Re: [PATCH v1] arch_topology: Adjust initial CPU capacities with current freq To: Sudeep Holla , Jeffy Chen Cc: linux-kernel@vger.kernel.org, Brian Norris , Marc Zyngier , Douglas Anderson , Heiko Stuebner , Greg Kroah-Hartman , "Rafael J. Wysocki" References: <20200109075214.31943-1-jeffy.chen@rock-chips.com> <20200110113711.GB39451@bogus> From: Robin Murphy Message-ID: <9edb57be-97bc-f0bd-3edd-854dfc8c780f@arm.com> Date: Fri, 10 Jan 2020 11:54:48 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:68.0) Gecko/20100101 Thunderbird/68.3.1 MIME-Version: 1.0 In-Reply-To: <20200110113711.GB39451@bogus> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020-01-10 11:37 am, Sudeep Holla wrote: > On Thu, Jan 09, 2020 at 03:52:14PM +0800, Jeffy Chen wrote: >> The CPU freqs are not supposed to change before cpufreq policies >> properly registered, meaning that they should be used to calculate the >> initial CPU capacities. >> >> Doing this helps choosing the best CPU during early boot, especially >> for the initramfs decompressing. >> >> Signed-off-by: Jeffy Chen > > [...] > >> @@ -146,10 +153,15 @@ bool __init topology_parse_cpu_capacity(struct device_node *cpu_node, int cpu) >> return false; >> } >> } >> - capacity_scale = max(cpu_capacity, capacity_scale); >> raw_capacity[cpu] = cpu_capacity; >> pr_debug("cpu_capacity: %pOF cpu_capacity=%u (raw)\n", >> cpu_node, raw_capacity[cpu]); >> + >> + cpu_clk = of_clk_get(cpu_node, 0); >> + if (!PTR_ERR_OR_ZERO(cpu_clk)) >> + per_cpu(max_freq, cpu) = clk_get_rate(cpu_clk) / 1000; >> + >> + clk_put(cpu_clk); > > I don't like to assume DVFS to be supplied only using 'clk'. So NACK! > We have other non-clk mechanism for CPU DVFS and this needs to simply > use cpufreq APIs to get frequency value if required. ...but in this case, as soon as cpufreq is ready the problem is gone anyway, because it sees the big cluster's clock rate is way out-of-spec and bumps it up to a sane OPP. It really is unfortunate that so many RK3399 images out there are using the broken firmware combination that manages to miss out the boot-time PLL setup altogether. Robin.