Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp361930ybv; Thu, 13 Feb 2020 01:48:09 -0800 (PST) X-Google-Smtp-Source: APXvYqy1m9Q4QLgBJk/JptvhuO8Q5qg4GYGDVQHKlnsMex2MQ5Vwxekc4uPDbdVQNEl3q0H/dOID X-Received: by 2002:a05:6830:1e37:: with SMTP id t23mr12885755otr.16.1581587289341; Thu, 13 Feb 2020 01:48:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581587289; cv=none; d=google.com; s=arc-20160816; b=r+KIys22EUZCPmeD6L7MCV4hrIzU49umtSxgL5L5Yx3shd8ca/i9mHAGk7AR58c4HK rsDrg1h7uYt7UfRh/CmNvuWB6uH6eRmixxCZEmyB6O3dFzW5iAOlUHWqwqNsa2ZfEIUH VUez+hC6683I6QurCiyjpctO8Y4nrCL0Zna+xIh+psnZ2REVVgGzMfefCd5LRQ0+pi+O JwsI0eoXYypplZf3rnnIy0bH1nkG5ZaMfGmk7qLij8rbee2LzH2mgIGjqztzHk7Oyn8O LbkpQxzt13hLRzzQ5bWpcCEI9MkH4EcZ070hwSMfDSmo2VYOcfD1MHsWs7fXBezZdAQ7 1x2w== 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; bh=5zXU8bTcdna0fu/b+voyeCjzrS1v4tSCLg3nfvVvYjg=; b=Z4fysz0JRUQjQ/E3wlwnzuH3vfjDYrJLVP3gIKakDzvtVcyoioJhQsBtYpVYO/Aqx/ gzd4uKH48m5XDVwD30vt8gsJAyCHIX5YfYwihNHT+84mXJO3YwakOdItcEv+Ugfi5C9o Uq9AWUAtJHZ12v8nHHYjmV55pMl5FPe+8QiLXbDVIURf4sxbXkpexo9U8IvqsUuqvUkD Vvsp4q5tyNnr+k7UeqfcTcnDoSo1POWzUfsL5a+pZ0G9a0o7KRfTsnlSw5/MIfY9rJ/c KdaiW72d/V8I1Bf3eWObp2B99mUO2m7XTtaM3FztyX6pt2xpsvR8MxTGT0xoPDSK5ECe 7AJg== 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 x16si916502otk.13.2020.02.13.01.47.56; Thu, 13 Feb 2020 01:48: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 S1729600AbgBMJrH (ORCPT + 99 others); Thu, 13 Feb 2020 04:47:07 -0500 Received: from foss.arm.com ([217.140.110.172]:44026 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729494AbgBMJrG (ORCPT ); Thu, 13 Feb 2020 04:47:06 -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 0132A1FB; Thu, 13 Feb 2020 01:47:05 -0800 (PST) Received: from localhost (unknown [10.1.198.52]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 959CF3F6CF; Thu, 13 Feb 2020 01:47:05 -0800 (PST) Date: Thu, 13 Feb 2020 09:47:04 +0000 From: Ionela Voinescu To: Lukasz Luba Cc: catalin.marinas@arm.com, will@kernel.org, mark.rutland@arm.com, maz@kernel.org, suzuki.poulose@arm.com, sudeep.holla@arm.com, valentin.schneider@arm.com, rjw@rjwysocki.net, peterz@infradead.org, mingo@redhat.com, vincent.guittot@linaro.org, viresh.kumar@linaro.org, linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Subject: Re: [PATCH v3 6/7] arm64: use activity monitors for frequency invariance Message-ID: <20200213094704.GA30335@arm.com> References: <20200211184542.29585-1-ionela.voinescu@arm.com> <20200211184542.29585-7-ionela.voinescu@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Lukasz, [..] > > + > > +/* Obtain max frequency (in KHz) as reported by hardware */ > > +__weak unsigned int cpu_get_max_freq(unsigned int cpu) > > +{ > > + return 0; > > +} > > + > > +#ifdef CONFIG_CPU_FREQ > > +/* Replace max frequency getter with cpufreq based function */ > > +#define cpu_get_max_freq cpufreq_get_hw_max_freq > > +#endif > > Can we just use cpufreq_get_hw_max_freq()? > We have cpufreq_get_hw_max_freq returning 0 in such case, so it should > be OK. > The reasoning for the implementation is the following: - For CONFIG_CPU_FREQ we use cpufreq_get_hw_max_freq (weak default or strong alternative) - For !CONFIG_CPU_FREQ cpufreq_get_hw_max_freq returns 0 - it signals that cpufreq cannot return the hardware max frequency. In this case cpu_get_max_freq is used (weak default or strong alternative implementation). > Is there a possibility that some platform which has !CONFIG_CPU_FREQ > would define its own cpu_get_max_freq() overwriting the weak function > above? > Based on the code which checks 'if (unlikely(!max_freq_hz))' it should, > otherwise 'valid_cpus' is not set. > > I would assume that we won't see such platform, interested > in AMU freq invariance without CONFIG_CPU_FREQ. > > We already have a lot of these defines or __weak functions, which is > hard to follow. There is no dependency between CONFIG_CPU_FREQ and frequency invariance. Therefore, I did not see a reason to potentially bypass the use of AMU for frequency invariance for !CONFIG_CPU_FREQ. But I agree it makes the code harder to read so I can remove cpu_get_max_freq and keep cpufreq_get_hw_max_freq only until there is a provable need for this. Thank you for the review, Ionela.