diff mbox series

[2/2] cpufreq: vexpress-spc: Switch cpumask from topology core to OPP sharing

Message ID 20191128101547.519-2-sudeep.holla@arm.com (mailing list archive)
State Mainlined
Commit c9385887cbbf292ee367f75b400874f00ea34890
Headers show
Series [1/2] ARM: vexpress: Set-up shared OPP table instead of individual for each CPU | expand

Commit Message

Sudeep Holla Nov. 28, 2019, 10:15 a.m. UTC
Since commit ca74b316df96 ("arm: Use common cpu_topology structure and
functions.") the core cpumask has to be modified during cpu hotplug
operations. So using them to set up cpufreq policy cpumask may be
incorrect as it may contain only cpus that are online at that instance.

Instead, we can use the cpumask setup by OPP library that contains all
the cpus sharing OPP table using dev_pm_opp_get_sharing_cpus.

Cc: Viresh Kumar <viresh.kumar@linaro.org>
Tested-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
---
 drivers/cpufreq/vexpress-spc-cpufreq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Sudeep Holla Nov. 29, 2019, 11:49 a.m. UTC | #1
Hi Viresh, Rafael,

On Thu, Nov 28, 2019 at 10:15:47AM +0000, Sudeep Holla wrote:
> Since commit ca74b316df96 ("arm: Use common cpu_topology structure and
> functions.") the core cpumask has to be modified during cpu hotplug
> operations. So using them to set up cpufreq policy cpumask may be
> incorrect as it may contain only cpus that are online at that instance.
>
> Instead, we can use the cpumask setup by OPP library that contains all
> the cpus sharing OPP table using dev_pm_opp_get_sharing_cpus.
>
> Cc: Viresh Kumar <viresh.kumar@linaro.org>

This can go independently via PM tree and I can take 1/2 via SoC tree
(as the file is being moved). The problem will be fixed only after both
lands, but this alone won't break the build. Or if you guys provide
Ack, I can take both together via ARM SoC team. Let me know.

--
Regards,
Sudeep
Viresh Kumar Dec. 2, 2019, 2:01 a.m. UTC | #2
On 29-11-19, 11:49, Sudeep Holla wrote:
> Hi Viresh, Rafael,
> 
> On Thu, Nov 28, 2019 at 10:15:47AM +0000, Sudeep Holla wrote:
> > Since commit ca74b316df96 ("arm: Use common cpu_topology structure and
> > functions.") the core cpumask has to be modified during cpu hotplug
> > operations. So using them to set up cpufreq policy cpumask may be
> > incorrect as it may contain only cpus that are online at that instance.
> >
> > Instead, we can use the cpumask setup by OPP library that contains all
> > the cpus sharing OPP table using dev_pm_opp_get_sharing_cpus.
> >
> > Cc: Viresh Kumar <viresh.kumar@linaro.org>
> 
> This can go independently via PM tree and I can take 1/2 via SoC tree
> (as the file is being moved). The problem will be fixed only after both
> lands, but this alone won't break the build.

Yes, but it will break cpufreq for sure as shared-cpus won't be set by anyone.

> Or if you guys provide
> Ack, I can take both together via ARM SoC team. Let me know.

I was planning to take them through cpufreq tree, but that fine if you can do
that.

Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Sudeep Holla Dec. 2, 2019, 11:11 a.m. UTC | #3
On Mon, Dec 02, 2019 at 07:31:46AM +0530, Viresh Kumar wrote:
> On 29-11-19, 11:49, Sudeep Holla wrote:
> > Hi Viresh, Rafael,
> >
> > On Thu, Nov 28, 2019 at 10:15:47AM +0000, Sudeep Holla wrote:
> > > Since commit ca74b316df96 ("arm: Use common cpu_topology structure and
> > > functions.") the core cpumask has to be modified during cpu hotplug
> > > operations. So using them to set up cpufreq policy cpumask may be
> > > incorrect as it may contain only cpus that are online at that instance.
> > >
> > > Instead, we can use the cpumask setup by OPP library that contains all
> > > the cpus sharing OPP table using dev_pm_opp_get_sharing_cpus.
> > >
> > > Cc: Viresh Kumar <viresh.kumar@linaro.org>
> >
> > This can go independently via PM tree and I can take 1/2 via SoC tree
> > (as the file is being moved). The problem will be fixed only after both
> > lands, but this alone won't break the build.
>
> Yes, but it will break cpufreq for sure as shared-cpus won't be set by anyone.
>

It's already broke on hotplug :) but yes works on boot at-least.

> > Or if you guys provide
> > Ack, I can take both together via ARM SoC team. Let me know.
>
> I was planning to take them through cpufreq tree, but that fine if you can do
> that.
>

Arnd moved and compressed few folders in arch/arm/mach-*, and vexpress
was merged into versatile. Not sure if it's planned for v5.5, so to be
cautious, I preferred to take it via ARM SoC.

> Acked-by: Viresh Kumar <viresh.kumar@linaro.org>

Thanks, I will take them together via ARM SoC

--
Regards,
Sudeep
diff mbox series

Patch

diff --git a/drivers/cpufreq/vexpress-spc-cpufreq.c b/drivers/cpufreq/vexpress-spc-cpufreq.c
index 506e3f2bf53a..83c85d3d67e3 100644
--- a/drivers/cpufreq/vexpress-spc-cpufreq.c
+++ b/drivers/cpufreq/vexpress-spc-cpufreq.c
@@ -434,7 +434,7 @@  static int ve_spc_cpufreq_init(struct cpufreq_policy *policy)
 	if (cur_cluster < MAX_CLUSTERS) {
 		int cpu;
 
-		cpumask_copy(policy->cpus, topology_core_cpumask(policy->cpu));
+		dev_pm_opp_get_sharing_cpus(cpu_dev, policy->cpus);
 
 		for_each_cpu(cpu, policy->cpus)
 			per_cpu(physical_cluster, cpu) = cur_cluster;