Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp3474787ybv; Tue, 25 Feb 2020 02:00:20 -0800 (PST) X-Google-Smtp-Source: APXvYqx6JrlvP2UM1kJA6CSWfVT/LOJXxD1dw1F7WVg+ei0GvxnRHAycsF9WfG4JPKlrYmDMKMh4 X-Received: by 2002:a9d:d06:: with SMTP id 6mr45118558oti.176.1582624819987; Tue, 25 Feb 2020 02:00:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582624819; cv=none; d=google.com; s=arc-20160816; b=RZPbnF+5S+BQleksY5PQxNyDrjEQrzzi3lUCmEX0p7nBjHSylaCeptF0oToAVLENxA env2Xum9KNb+w+RhRL0n2CL/kzn1lboOWnc7bmfvbTZxwd4i6PGgs2uwm2UVf4mkOh9O Pg7JQUHL6jx4JO7aa+bJaRtOLuh69iGWTesdumWb6xPYqrV0a3I47D4jtfTVrqDxH7fP Wci1OE0YhKQIMeuzqHCRBm6V+qUi5/xKzKX21UunPYYlwwjOnq7Vng4kKQeWml6P2Avg NEA+wsWqPfEKTXTZgIgrC+XY+VoMd3tdDF7640WlOL1/EDweJcw9pmwekUfUoezvbCQp 4+4Q== 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=iNdgO6FrxG9F5vIixX2nMLw5SyZvIEZ/g6LJ3Anh9Mo=; b=V31hV6JMIapIKgjy6HT1uWu6ADKggh8uy+/lY/bx2ZsmmPyb2QcgrQk7jULLZtGE9K OwK8QSnWES8ULTOlEKpYZS0I17SK+0cMFk7tVua6oPpDCcW0Dwm02+6VZrZgORT7jN8i ATOqhlAi3Vs97m2aUQTfVwY1Pi6kurOhXQ6u2cy7p+iGeCPVqRgLpG6JW2LAl9CbUCgV M4TnEuzoK009iS0dnEX5ysacv9mV2FTQ1GEMJJzBAbppUBjOE6OTvEXMtZ5tbAi8wtjT tKO5pJSA28kZcuEjavmPCXT+GpRFIULq9MVMNTeU9bUxl6TZ0+XIhlWtqnCGQ6KXLoaN h8CQ== 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 q131si6484810oig.203.2020.02.25.02.00.08; Tue, 25 Feb 2020 02:00:19 -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 S1729686AbgBYJ71 (ORCPT + 99 others); Tue, 25 Feb 2020 04:59:27 -0500 Received: from foss.arm.com ([217.140.110.172]:48508 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729238AbgBYJ71 (ORCPT ); Tue, 25 Feb 2020 04:59:27 -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 A46E230E; Tue, 25 Feb 2020 01:59:26 -0800 (PST) Received: from [10.37.12.155] (unknown [10.37.12.155]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B6BFF3F6CF; Tue, 25 Feb 2020 01:59:22 -0800 (PST) Subject: Re: [PATCH v4 6/7] arm64: use activity monitors for frequency invariance To: Valentin Schneider , Ionela Voinescu Cc: catalin.marinas@arm.com, will@kernel.org, mark.rutland@arm.com, maz@kernel.org, suzuki.poulose@arm.com, sudeep.holla@arm.com, dietmar.eggemann@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 References: <20200224141142.25445-1-ionela.voinescu@arm.com> <20200224141142.25445-7-ionela.voinescu@arm.com> From: Lukasz Luba Message-ID: <18604cef-1e26-96a6-38b3-ab03b1b53b48@arm.com> Date: Tue, 25 Feb 2020 09:59:20 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed 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 2/24/20 6:40 PM, Valentin Schneider wrote: > > Ionela Voinescu writes: > >> Signed-off-by: Ionela Voinescu >> Cc: Catalin Marinas >> Cc: Will Deacon >> Cc: Sudeep Holla > > With the small nits below: > > Reviewed-by: Valentin Schneider > >> diff --git a/arch/arm64/kernel/topology.c b/arch/arm64/kernel/topology.c >> index fa9528dfd0ce..7606cbd63517 100644 >> --- a/arch/arm64/kernel/topology.c >> +++ b/arch/arm64/kernel/topology.c >> + >> +static inline int > > That should be bool, seeing what it returns. > >> +enable_policy_freq_counters(int cpu, cpumask_var_t valid_cpus) >> +{ >> + struct cpufreq_policy *policy = cpufreq_cpu_get(cpu); >> + >> + if (!policy) { >> + pr_debug("CPU%d: No cpufreq policy found.\n", cpu); >> + return false; >> + } >> + >> + if (cpumask_subset(policy->related_cpus, valid_cpus)) >> + cpumask_or(amu_fie_cpus, policy->related_cpus, >> + amu_fie_cpus); >> + >> + cpufreq_cpu_put(policy); >> + >> + return true; >> +} >> diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c >> index 1eb81f113786..1ab2b7503d63 100644 >> --- a/drivers/base/arch_topology.c >> +++ b/drivers/base/arch_topology.c >> @@ -29,6 +29,14 @@ void arch_set_freq_scale(struct cpumask *cpus, unsigned long cur_freq, >> unsigned long scale; >> int i; >> >> + /* >> + * If the use of counters for FIE is enabled, just return as we don't >> + * want to update the scale factor with information from CPUFREQ. >> + * Instead the scale factor will be updated from arch_scale_freq_tick. >> + */ >> + if (arch_cpu_freq_counters(cpus)) >> + return; >> + >> scale = (cur_freq << SCHED_CAPACITY_SHIFT) / max_freq; >> >> for_each_cpu(i, cpus) >> diff --git a/include/linux/topology.h b/include/linux/topology.h >> index eb2fe6edd73c..397aad6ae163 100644 >> --- a/include/linux/topology.h >> +++ b/include/linux/topology.h >> @@ -227,5 +227,12 @@ static inline const struct cpumask *cpu_cpu_mask(int cpu) >> return cpumask_of_node(cpu_to_node(cpu)); >> } >> >> +#ifndef arch_cpu_freq_counters >> +static __always_inline >> +bool arch_cpu_freq_counters(struct cpumask *cpus) >> +{ >> + return false; >> +} >> +#endif >> > > Apologies for commenting on this only now, I had missed it in my earlier > round of review. > > I would've liked to keep this contained within arm64 stuff until we agreed > on a more generic counter-driven FIE interface, but seems like we can't evade > it due to the arch_topology situation. > > Would it make sense to relocate this stub to arch_topology.h instead, at > least for the time being? That way the only non-arm64 changes are condensed > in arch_topology (even if it doesn't change much in terms of header files, > since topology.h imports arch_topology.h) Or make it as a 'weak' and place it just above the arch_set_freq_scale() in arch_topology.c, not touching headers?