From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D93DCC433DB for ; Fri, 8 Jan 2021 09:45:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A900D233EA for ; Fri, 8 Jan 2021 09:45:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727948AbhAHJpF (ORCPT ); Fri, 8 Jan 2021 04:45:05 -0500 Received: from foss.arm.com ([217.140.110.172]:48056 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727649AbhAHJpE (ORCPT ); Fri, 8 Jan 2021 04:45:04 -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 CB46A31B; Fri, 8 Jan 2021 01:44:18 -0800 (PST) Received: from localhost (unknown [10.1.198.32]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 6D18A3F70D; Fri, 8 Jan 2021 01:44:18 -0800 (PST) Date: Fri, 8 Jan 2021 09:44:17 +0000 From: Ionela Voinescu To: Viresh Kumar Cc: Catalin Marinas , Will Deacon , Vincent Guittot , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH V3 3/3] arm64: topology: Make AMUs work with modular cpufreq drivers Message-ID: <20210108094416.GA19952@arm.com> References: <5ffc7b9ed03c6301ac2f710f609282959491b526.1608010334.git.viresh.kumar@linaro.org> <8f0fe23d1c9effed71d5660c939472d43726a61b.1608010334.git.viresh.kumar@linaro.org> <20201216000349.GA5299@arm.com> <20201216043805.bx6laemhfm2eaufv@vireshk-i7> <20201216193724.GA375@arm.com> <20201217105049.z3aqhl4mo56hhqvk@vireshk-i7> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201217105049.z3aqhl4mo56hhqvk@vireshk-i7> User-Agent: Mutt/1.9.4 (2018-02-28) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thursday 17 Dec 2020 at 16:20:49 (+0530), Viresh Kumar wrote: > On 16-12-20, 19:37, Ionela Voinescu wrote: > > I did not yet test this, but reading this comment made me wonder.. > > > > arch_scale_freq_invariant() (or topology_scale_freq_invariant()) is also > > called from schedutil when obtaining the next frequency. > > > > So if we had a system that only partly supports AMUs but had at some > > point a cpufreq driver that provided FIE for the other CPUs, when we > > unregister the driver, the cpufreq_freq_invariance static key is > > disabled. Therefore, none of the conditions for system invariance is > > now accomplished and arch_scale_freq_invariant() will return false. > > This will be broken as utilization is still scaled, but the algorithm > > for computing the next frequency in schedutil will not take this into > > account. > > I think the best and the easiest solution for this is: > > bool arch_freq_counters_available(const struct cpumask *cpus) > { > return amu_freq_invariant(); > } > > But we probably need to rename it to something like arch_is_fie(). > Now that I think of it again (after spending 30 minutes trying to come up with a more clear solution) I realised this is not actually a problem :). The only location that checks the invariance status is schedutil, but what a cpufreq governor does becomes irrelevant if you remove the cpufreq driver. The only potential problem is if one then inmods a cpufreq driver that's not invariant. But I think that might be on "if" too many to consider. What do you think? Thanks, Ionela.