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=-15.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=unavailable 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 8A1C5C432BE for ; Wed, 11 Aug 2021 14:09:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6B99F60F56 for ; Wed, 11 Aug 2021 14:09:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232320AbhHKOJn (ORCPT ); Wed, 11 Aug 2021 10:09:43 -0400 Received: from foss.arm.com ([217.140.110.172]:51656 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231872AbhHKOJl (ORCPT ); Wed, 11 Aug 2021 10:09:41 -0400 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 D0A151063; Wed, 11 Aug 2021 07:09:17 -0700 (PDT) Received: from [10.57.12.152] (unknown [10.57.12.152]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id F0CEF3F718; Wed, 11 Aug 2021 07:09:15 -0700 (PDT) Subject: Re: [PATCH V2 9/9] cpufreq: scmi: Use .register_em() callback To: Quentin Perret , Viresh Kumar Cc: Rafael Wysocki , Sudeep Holla , Cristian Marussi , linux-pm@vger.kernel.org, Vincent Guittot , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org References: <6094d891b4cb0cba3357e2894c8a4431c4c65e67.1628682874.git.viresh.kumar@linaro.org> From: Lukasz Luba Message-ID: Date: Wed, 11 Aug 2021 15:09:13 +0100 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 8/11/21 2:17 PM, Quentin Perret wrote: > On Wednesday 11 Aug 2021 at 17:28:47 (+0530), Viresh Kumar wrote: >> Set the newly added .register_em() callback to register with the EM >> after the cpufreq policy is properly initialized. >> >> Signed-off-by: Viresh Kumar >> --- >> drivers/cpufreq/scmi-cpufreq.c | 55 ++++++++++++++++++++-------------- >> 1 file changed, 32 insertions(+), 23 deletions(-) >> >> diff --git a/drivers/cpufreq/scmi-cpufreq.c b/drivers/cpufreq/scmi-cpufreq.c >> index 75f818d04b48..b916c9e22921 100644 >> --- a/drivers/cpufreq/scmi-cpufreq.c >> +++ b/drivers/cpufreq/scmi-cpufreq.c >> @@ -22,7 +22,9 @@ >> >> struct scmi_data { >> int domain_id; >> + int nr_opp; >> struct device *cpu_dev; >> + cpumask_var_t opp_shared_cpus; > > Can we use policy->related_cpus and friends directly in the callback Unfortunately not. This tricky setup code was introduced because we may have a platform with per-CPU policy, so single bit set in policy->related_cpus, but we want EAS to be still working on set of CPUs. That's why we construct temporary cpumask and pass it to EM. > instead? That should simplify the patch a bit. > > Also, we can probably afford calling dev_pm_opp_get_opp_count() from the > em_register callback as it is not a hot path, which would avoid wasting > some 'resident' memory here that is only used during init. > > Thanks, > Quentin >