cpufreq: arm_big_little: set lowest frequcency for cluster when no cpus in it
PATCH 1/1 cpufreq: arm_big_little: set lowest frequcency for cluster when no cpus in it
From: Thomas Abraham <[email protected]>
If there are no active cpus in a cluster, the clock frequency of the cluster can be lowered to the lowest possible frequency for that cluster. This can help reduce the output clock speed of the PLL clocking the cluster and save power.
The get_table_min() function is also moved with this change to avoid forward declaration. The function get_table_max() is also moved along with get_table_min() so that these two functions are adjacent the code.
--- drivers/cpufreq/arm_big_little.c | 51 +++++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 23 deletions(-)
drivers/cpufreq/arm_big_little.c +28 -23
@@ -75,6 +75,28 @@ static inline int cpu_to_cluster(int cpu) MAX_CLUSTERS :raw_cpu_to_cluster (cpu); } +/* get the minimum frequency in the cpufreq_frequency_table */ +static inline u32 get_table_min (struct cpufreq_frequency_table *table) +{ +struct cpufreq_frequency_table *pos; +uint32_t min_freq = ~0 ; +cpufreq_for_each_entry (pos, table) +if (pos->frequency < min_freq) + min_freq = pos->frequency; +return min_freq; +} + +/* get the maximum frequency in the cpufreq_frequency_table */ +static inline u32 get_table_max (struct cpufreq_frequency_table *table) +{ +struct cpufreq_frequency_table *pos; +uint32_t max_freq =0 ; +cpufreq_for_each_entry (pos, table) +if (pos->frequency > max_freq) + max_freq = pos->frequency; +return max_freq; +} +static unsigned int find_cluster_maxfreq (int cluster) {int j;
@@ -170,9 +192,14 @@ bL_cpufreq_set_rate(u32 cpu, u32 old_cluster, u32 new_cluster, u32 rate)mutex_lock (&cluster_lock[old_cluster]); -/* Set freq of old cluster if there are cpus left on it */ +/* +* Set freq of old cluster. If there are no cpus left on it, +* set the lowest possible frequency for that cluster. +*/ new_rate =find_cluster_maxfreq (old_cluster); new_rate =ACTUAL_FREQ (old_cluster, new_rate); +if (!new_rate) + new_rate =get_table_min (freq_table[old_cluster]);if (new_rate) { pr_debug("%s: Updating rate of old cluster: %d, to freq: %d\n",
@@ -223,28 +250,6 @@ static inline u32 get_table_count(struct cpufreq_frequency_table *table)return count; } -/* get the minimum frequency in the cpufreq_frequency_table */ -static inline u32 get_table_min (struct cpufreq_frequency_table *table) -{ -struct cpufreq_frequency_table *pos; -uint32_t min_freq = ~0 ; -cpufreq_for_each_entry (pos, table) -if (pos->frequency < min_freq) - min_freq = pos->frequency; -return min_freq; -} - -/* get the maximum frequency in the cpufreq_frequency_table */ -static inline u32 get_table_max (struct cpufreq_frequency_table *table) -{ -struct cpufreq_frequency_table *pos; -uint32_t max_freq =0 ; -cpufreq_for_each_entry (pos, table) -if (pos->frequency > max_freq) - max_freq = pos->frequency; -return max_freq; -} -static int merge_cluster_tables (void ) {int i, j, k =0 , count =1 ;
Signature · 1 line
1.7.9.5
Viresh Kumar
maintainerQuoted 10 lines · Thomas Abraham
From: Thomas Abraham <[email protected]>
If there are no active cpus in a cluster, the clock frequency of the cluster can be lowered to the lowest possible frequency for that cluster. This can help reduce the output clock speed of the PLL clocking the cluster and save power.
The
get_table_min()function is also moved with this change to avoid forward declaration. The functionget_table_max()is also moved along withget_table_min()so that these two functions are adjacent the code.
Makes sense as my poor mind also thought this over an year and half back.
Quoted 41 lines
Signed-off-by Thomas Abraham <[email protected]>--- drivers/cpufreq/arm_big_little.c | 51 +++++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 23 deletions(-)drivers/cpufreq/arm_big_little.c +22
-0@@ -75,6 +75,28 @@ static inline int cpu_to_cluster(int cpu) MAX_CLUSTERS :raw_cpu_to_cluster (cpu); } +/* get the minimum frequency in the cpufreq_frequency_table */ +static inline u32 get_table_min (struct cpufreq_frequency_table *table) +{ +struct cpufreq_frequency_table *pos; +uint32_t min_freq = ~0 ; +cpufreq_for_each_entry (pos, table) +if (pos->frequency < min_freq) + min_freq = pos->frequency; +return min_freq; +} + +/* get the maximum frequency in the cpufreq_frequency_table */ +static inline u32 get_table_max (struct cpufreq_frequency_table *table) +{ +struct cpufreq_frequency_table *pos; +uint32_t max_freq =0 ; +cpufreq_for_each_entry (pos, table) +if (pos->frequency > max_freq) + max_freq = pos->frequency; +return max_freq; +} +static unsigned int find_cluster_maxfreq (int cluster) {int j;@@ -170,9 +192,14 @@ bL_cpufreq_set_rate(u32 cpu, u32 old_cluster, u32 new_cluster, u32 rate)mutex_lock (&cluster_lock[old_cluster]);
drivers/cpufreq/arm_big_little.c bL_cpufreq_set_rate(u32 cpu, u32 old_cluster, u32 new_cluster, u32 rate) · line 202
Quoted 10 lines
drivers/cpufreq/arm_big_little.c +6
-1-/* Set freq of old cluster if there are cpus left on it */ +/* +* Set freq of old cluster. If there are no cpus left on it, +* set the lowest possible frequency for that cluster. +*/ new_rate =find_cluster_maxfreq (old_cluster); new_rate =ACTUAL_FREQ (old_cluster, new_rate); +if (!new_rate) + new_rate =get_table_min (freq_table[old_cluster]);
Have you hit this code? How did you test it?
In case you have hit this code, you must be using IKS as in MP it doesn't make sense.
Two things:
- First in case this patch gets in, you can check !new_rate just after find_cluster_maxfreq() as it will be zero there as well..
- The counter argument given to me from Sudeep at that time was, "it is just a waste of time". Because if we aren't using the cluster anymore, it will be switched off very soon and there is no point wasting time changing freq to lowest..
And I somewhat agreed to it then..
Cc'ing Nico as he can throw some light from MCPM's perspective here.
--
viresh
Quoted 72 lines · Viresh Kumar
Quoted 10 lines · Thomas Abraham
From: Thomas Abraham <[email protected]>
If there are no active cpus in a cluster, the clock frequency of the cluster can be lowered to the lowest possible frequency for that cluster. This can help reduce the output clock speed of the PLL clocking the cluster and save power.
The
get_table_min()function is also moved with this change to avoid forward declaration. The functionget_table_max()is also moved along withget_table_min()so that these two functions are adjacent the code.Makes sense as my poor mind also thought this over an year and half back.
Quoted 41 lines
Signed-off-by Thomas Abraham <[email protected]>--- drivers/cpufreq/arm_big_little.c | 51 +++++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 23 deletions(-)drivers/cpufreq/arm_big_little.c +22
-0@@ -75,6 +75,28 @@ static inline int cpu_to_cluster(int cpu) MAX_CLUSTERS :raw_cpu_to_cluster (cpu); } +/* get the minimum frequency in the cpufreq_frequency_table */ +static inline u32 get_table_min (struct cpufreq_frequency_table *table) +{ +struct cpufreq_frequency_table *pos; +uint32_t min_freq = ~0 ; +cpufreq_for_each_entry (pos, table) +if (pos->frequency < min_freq) + min_freq = pos->frequency; +return min_freq; +} + +/* get the maximum frequency in the cpufreq_frequency_table */ +static inline u32 get_table_max (struct cpufreq_frequency_table *table) +{ +struct cpufreq_frequency_table *pos; +uint32_t max_freq =0 ; +cpufreq_for_each_entry (pos, table) +if (pos->frequency > max_freq) + max_freq = pos->frequency; +return max_freq; +} +static unsigned int find_cluster_maxfreq (int cluster) {int j;@@ -170,9 +192,14 @@ bL_cpufreq_set_rate(u32 cpu, u32 old_cluster, u32 new_cluster, u32 rate)mutex_lock (&cluster_lock[old_cluster]);drivers/cpufreq/arm_big_little.c bL_cpufreq_set_rate(u32 cpu, u32 old_cluster, u32 new_cluster, u32 rate) · line 202
Quoted 10 lines
drivers/cpufreq/arm_big_little.c +6
-1-/* Set freq of old cluster if there are cpus left on it */ +/* +* Set freq of old cluster. If there are no cpus left on it, +* set the lowest possible frequency for that cluster. +*/ new_rate =find_cluster_maxfreq (old_cluster); new_rate =ACTUAL_FREQ (old_cluster, new_rate); +if (!new_rate) + new_rate =get_table_min (freq_table[old_cluster]);Have you hit this code? How did you test it?
In case you have hit this code, you must be using IKS as in MP it doesn't make sense.
Quoted 9 lines
Two things:
- First in case this patch gets in, you can check !new_rate just afterfind_cluster_maxfreq()as it will be zero there as well..- The counter argument given to me from Sudeep at that time was, "it is just a waste of time". Because if we aren't using the cluster anymore, it will be switched off very soon and there is no point wasting time changing freq to lowest..
I was just writing the same thing again, you saved my time :) Since in IKS the cluster will be powered down if no CPU is active, I see no point in doing this. bL_switch_request would initiate cluster powerdown and trying to reset the clk to lowest might unnecessarily wake it up(though the exact behaviour depends on the firmware/code managing it)
Regards,
Sudeep
Quoted 85 lines · Sudeep Holla
Quoted 82 lines · Viresh Kumar
Quoted 10 lines · Thomas Abraham
From: Thomas Abraham <[email protected]>
If there are no active cpus in a cluster, the clock frequency of the cluster
can be lowered to the lowest possible frequency for that cluster. This can
help reduce the output clock speed of the PLL clocking the cluster and save power.Quoted 4 lines
The
get_table_min()function is also moved with this change to avoid forward
declaration. The functionget_table_max()is also moved along withget_table_min()so that these two functions are adjacent the code.Makes sense as my poor mind also thought this over an year and half back.
Quoted 56 lines
Signed-off-by Thomas Abraham <[email protected]>--- drivers/cpufreq/arm_big_little.c | 51 +++++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 23 deletions(-)drivers/cpufreq/arm_big_little.c +28
-1@@ -75,6 +75,28 @@ static inline int cpu_to_cluster(int cpu) MAX_CLUSTERS :raw_cpu_to_cluster (cpu); } +/* get the minimum frequency in the cpufreq_frequency_table */ +static inline u32 get_table_min (struct cpufreq_frequency_table *table) +{ +struct cpufreq_frequency_table *pos; +uint32_t min_freq = ~0 ; +cpufreq_for_each_entry (pos, table) +if (pos->frequency < min_freq) + min_freq = pos->frequency; +return min_freq; +} + +/* get the maximum frequency in the cpufreq_frequency_table */ +static inline u32 get_table_max (struct cpufreq_frequency_table *table) +{ +struct cpufreq_frequency_table *pos; +uint32_t max_freq =0 ; +cpufreq_for_each_entry (pos, table) +if (pos->frequency > max_freq) + max_freq = pos->frequency; +return max_freq; +} +static unsigned int find_cluster_maxfreq (int cluster) {int j;@@ -170,9 +192,14 @@ bL_cpufreq_set_rate(u32 cpu, u32 old_cluster, u32new_cluster, u32 rate) mutex_lock(&cluster_lock[old_cluster]); -/* Set freq of old cluster if there are cpus left on it */ +/* +* Set freq of old cluster. If there are no cpus left on it, +* set the lowest possible frequency for that cluster. +*/ new_rate =find_cluster_maxfreq (old_cluster); new_rate =ACTUAL_FREQ (old_cluster, new_rate); +if (!new_rate) + new_rate =Quoted 1 line
get_table_min(freq_table[old_cluster]);Have you hit this code? How did you test it?
Quoted 2 lines
Quoted 2 lines
In case you have hit this code, you must be using IKS as in MP it doesn't make sense.
Yes, I have hit this code with IKS.
Quoted 4 lines
Quoted 4 lines
Two things:
- First in case this patch gets in, you can check !new_rate just afterfind_cluster_maxfreq()as it will be zero there as well..
Ok.
Quoted 10 lines
Quoted 6 lines
- The counter argument given to me from Sudeep at that time was, "it is just a waste of time". Because if we aren't using the cluster anymore, it will be switched off very soon and there is no point wasting time changing freq to lowest..
I was just writing the same thing again, you saved my time :) Since in IKS the cluster will be powered down if no CPU is active, I see no point in doing this.
bL_switch_requestwould initiate cluster powerdown and
The CPU clock domain can contain additional components than just the mutli-core cluster. Those continue to be alive and clocked even when the cluster is power gated. This results in additional power consumption, though may not be high enough, but can be reduced by lowering the clock speed.
Quoted 2 lines
trying to reset the clk to lowest might unnecessarily wake it up(though the exact behaviour depends on the
firmware/codemanaging it)
Any particular example of a platform that has this problem, just to understand what could cause such a behavior and if is mostly a software or a hardware induced problem.
Thanks,
Thomas.
Quoted 9 lines
Regards,
Sudeep--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 109 lines · Thomas Abraham
Quoted 85 lines · Sudeep Holla
Quoted 82 lines · Viresh Kumar
Quoted 10 lines · Thomas Abraham
From: Thomas Abraham <[email protected]>
If there are no active cpus in a cluster, the clock frequency of the cluster
can be lowered to the lowest possible frequency for that cluster. This can
help reduce the output clock speed of the PLL clocking the cluster and save power.Quoted 4 lines
The
get_table_min()function is also moved with this change to avoid forward
declaration. The functionget_table_max()is also moved along withget_table_min()so that these two functions are adjacent the code.Makes sense as my poor mind also thought this over an year and half back.
Quoted 56 lines
Signed-off-by Thomas Abraham <[email protected]>--- drivers/cpufreq/arm_big_little.c | 51 +++++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 23 deletions(-)drivers/cpufreq/arm_big_little.c +28
-1@@ -75,6 +75,28 @@ static inline int cpu_to_cluster(int cpu) MAX_CLUSTERS :raw_cpu_to_cluster (cpu); } +/* get the minimum frequency in the cpufreq_frequency_table */ +static inline u32 get_table_min (struct cpufreq_frequency_table *table) +{ +struct cpufreq_frequency_table *pos; +uint32_t min_freq = ~0 ; +cpufreq_for_each_entry (pos, table) +if (pos->frequency < min_freq) + min_freq = pos->frequency; +return min_freq; +} + +/* get the maximum frequency in the cpufreq_frequency_table */ +static inline u32 get_table_max (struct cpufreq_frequency_table *table) +{ +struct cpufreq_frequency_table *pos; +uint32_t max_freq =0 ; +cpufreq_for_each_entry (pos, table) +if (pos->frequency > max_freq) + max_freq = pos->frequency; +return max_freq; +} +static unsigned int find_cluster_maxfreq (int cluster) {int j;@@ -170,9 +192,14 @@ bL_cpufreq_set_rate(u32 cpu, u32 old_cluster, u32new_cluster, u32 rate) mutex_lock(&cluster_lock[old_cluster]); -/* Set freq of old cluster if there are cpus left on it */ +/* +* Set freq of old cluster. If there are no cpus left on it, +* set the lowest possible frequency for that cluster. +*/ new_rate =find_cluster_maxfreq (old_cluster); new_rate =ACTUAL_FREQ (old_cluster, new_rate); +if (!new_rate) + new_rate =Quoted 1 line
get_table_min(freq_table[old_cluster]);Have you hit this code? How did you test it?
Quoted 2 lines
Quoted 2 lines
In case you have hit this code, you must be using IKS as in MP it doesn't make sense.
Yes, I have hit this code with IKS.
Quoted 4 lines
Quoted 4 lines
Two things:
- First in case this patch gets in, you can check !new_rate just afterfind_cluster_maxfreq()as it will be zero there as well..Ok.
Quoted 10 lines
Quoted 6 lines
- The counter argument given to me from Sudeep at that time was, "it is just a waste of time". Because if we aren't using the cluster anymore, it will be switched off very soon and there is no point wasting time changing freq to lowest..
I was just writing the same thing again, you saved my time :) Since in IKS the cluster will be powered down if no CPU is active, I see no point in doing this.
bL_switch_requestwould initiate cluster powerdown and
Quoted 6 lines
The CPU clock domain can contain additional components than just the mutli-core cluster. Those continue to be alive and clocked even when the cluster is power gated. This results in additional power consumption, though may not be high enough, but can be reduced by lowering the clock speed.
I am not really sure if that's the case. Consider a single cluster system, how would you handle that ? Do you set the clock to lowest every time you enter deepest C-state.
Alternatively in a multi-cluster platform if I hotplug out all the cpus in one cluster, do you mean we still have to explicitly set the frequency to lowest before the last cpu goes down. This needs to be handled implicitly IMO, but they may be some restrictions on some platforms which I am not aware of.
It would be good to know why exactly you need that.
Quoted 7 lines
Quoted 2 lines
trying to reset the clk to lowest might unnecessarily wake it up(though the exact behaviour depends on the
firmware/codemanaging it)Any particular example of a platform that has this problem, just to understand what could cause such a behavior and if is mostly a software or a hardware induced problem.
No I don't know any particular platform.
Quoted 132 lines · Sudeep Holla
Quoted 122 lines · Thomas Abraham
Quoted 91 lines · Sudeep Holla
Quoted 87 lines · Viresh Kumar
Quoted 11 lines · Thomas Abraham
From: Thomas Abraham <[email protected]>
If there are no active cpus in a cluster, the clock frequency of the cluster
can be lowered to the lowest possible frequency for that cluster. This can
help reduce the output clock speed of the PLL clocking the cluster and save power.Quoted 4 lines
The
get_table_min()function is also moved with this change to avoid forward
declaration. The functionget_table_max()is also moved along withget_table_min()so that these two functions are adjacent the code.Makes sense as my poor mind also thought this over an year and half back.
Quoted 57 lines
Signed-off-by Thomas Abraham <[email protected]>--- drivers/cpufreq/arm_big_little.c | 51 +++++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 23 deletions(-)drivers/cpufreq/arm_big_little.c +24
-1@@ -75,6 +75,28 @@ static inline int cpu_to_cluster(int cpu) MAX_CLUSTERS :raw_cpu_to_cluster (cpu); } +/* get the minimum frequency in the cpufreq_frequency_table */ +static inline u32 get_table_min (struct cpufreq_frequency_table *table) +{ +struct cpufreq_frequency_table *pos; +uint32_t min_freq = ~0 ; +cpufreq_for_each_entry (pos, table) +if (pos->frequency < min_freq) + min_freq = pos->frequency; +return min_freq; +} + +/* get the maximum frequency in the cpufreq_frequency_table */ +static inline u32 get_table_max (struct cpufreq_frequency_table *table) +{ +struct cpufreq_frequency_table *pos; +uint32_t max_freq =0 ; +cpufreq_for_each_entry (pos, table) +if (pos->frequency > max_freq) + max_freq = pos->frequency; +return max_freq; +} +static unsigned int find_cluster_maxfreq (int cluster) {int j;@@ -170,9 +192,14 @@ bL_cpufreq_set_rate(u32 cpu, u32 old_cluster, u32new_cluster, u32 rate) mutex_lock(&cluster_lock[old_cluster]); -/* Set freq of old cluster if there are cpus left on it */ +/* +* Set freq of old cluster. If there are no cpus left on
it,drivers/cpufreq/arm_big_little.c +4
-0+* set the lowest possible frequency for that cluster. +*/ new_rate =find_cluster_maxfreq (old_cluster); new_rate =ACTUAL_FREQ (old_cluster, new_rate); +if (!new_rate) + new_rate =Quoted 1 line
get_table_min(freq_table[old_cluster]);Have you hit this code? How did you test it?
Quoted 2 lines
Quoted 2 lines
In case you have hit this code, you must be using IKS as in MP it doesn't make sense.
Yes, I have hit this code with IKS.
Quoted 4 lines
Quoted 4 lines
Two things:
- First in case this patch gets in, you can check !new_rate just afterfind_cluster_maxfreq()as it will be zero there as well..Ok.
Quoted 7 lines
Quoted 6 lines
- The counter argument given to me from Sudeep at that time was, "it is just a waste of time". Because if we aren't using the cluster anymore, it will be switched off very soon and there is no point wasting time changing freq to lowest..
Quoted 5 lines
I was just writing the same thing again, you saved my time :) Since in IKS the cluster will be powered down if no CPU is active, I see no
point in doing this.bL_switch_requestwould initiate cluster powerdown andQuoted 6 lines
The CPU clock domain can contain additional components than just the mutli-core cluster. Those continue to be alive and clocked even when the cluster is power gated. This results in additional power consumption, though may not be high enough, but can be reduced by lowering the clock speed.
Quoted 3 lines
I am not really sure if that's the case. Consider a single cluster system, how would you handle that ? Do you set the clock to lowest every time you enter deepest C-state.
In that case we need not do this. And this patch is not meant for such a case.
Quoted 5 lines
Alternatively in a multi-cluster platform if I hotplug out all the cpus in one
cluster, do you mean we still have to explicitly set the frequency to lowest before the last cpu goes down.
Yes, but it would "after" the last cpu goes down. As mentioned in my previous reply, there is an opportunity to save power by doing this.
Quoted 2 lines
This needs to be handled implicitly IMO, but
they may be some restrictions on some platforms which I am not aware of.
This change is useful on Exynos based platforms and not intrusive either. So if we can get this on linux-next and gets test coverage on other platforms until maybe -rc7, we can be reasonably sure that other platforms are not affected by this. I see no reason in holding this back just based on assumptions about other platforms.
Quoted 2 lines
It would be good to know why exactly you need that.
It is to avoid power wastage by clocking the components in the CPU clock domain at a higher speed when the cluster in that CPU clock domain is switched off. I did mention this reason in my previous reply.
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
trying to reset the clk to lowest might unnecessarily wake it up(though the exact behaviour depends on the
firmware/codemanaging it)
Quoted 6 lines
Quoted 4 lines
Any particular example of a platform that has this problem, just to understand what could cause such a behavior and if is mostly a software or a hardware induced problem.
No I don't know any particular platform.
Ok.
Quoted 1 line
Thanks,
Thomas.
Viresh Kumar
maintainerQuoted 8 lines · Thomas Abraham
Quoted 4 lines · Sudeep Holla
Alternatively in a multi-cluster platform if I hotplug out all the cpus in one
cluster, do you mean we still have to explicitly set the frequency to lowest before the last cpu goes down.Yes, but it would "after" the last cpu goes down. As mentioned in my
How will you change freq *after* last cpu goes down? This code always initiate freq-switch from last-cpu.
Also, we must keep in mind that switching to lowest freq would make it take more time to execute the cluster shutdown code..
Quoted 10 lines
previous reply, there is an opportunity to save power by doing this.
Quoted 2 lines
This needs to be handled implicitly IMO, but
they may be some restrictions on some platforms which I am not aware of.This change is useful on Exynos based platforms and not intrusive either. So if we can get this on linux-next and gets test coverage on other platforms until maybe -rc7, we can be reasonably sure that other platforms are not affected by this. I see no reason in holding this back just based on assumptions about other platforms.
I don't think getting this to linux-next would make a difference. There aren't many big LITTLE platforms, even lesser would be using linux-next and very very few would be using IKS :)
So, we have to decide whatever we want here only.
@Nicolas: Please comment here, we need your suggestions :)
As I told you before, I wrote something similar long back and had the same mindset as you have now. Yes, it *might* be useful but we wanna be sure about it. That's why all these discussions. So, just hold on :)
I am not asking you to reveal internals of Exynos octa, but what exactly is using this clock when the cluster goes down? L2 caches might stay on for a while if they have something useful, don't know exactly how the CPU clock would be affecting that..
This is what my understanding is and it holds true for the cpuidle case sudeep mentioned:
- If cluster is going to shutdown soon, there is no point changing clk rate.
- If cluster isn't going down for a complete shutdown, yes we can save some power by playing with clk rate. And the L2 cache example above fits here.
@Daniel: Are there some idle states for clusters where we aren't switching it off completely, but all CPUs are idle? And will switching to lowest freq sensible there ?
--
viresh
Quoted 8 lines · Viresh Kumar
Quoted 7 lines · Thomas Abraham
Quoted 4 lines · Sudeep Holla
Alternatively in a multi-cluster platform if I hotplug out all the cpus in one
cluster, do you mean we still have to explicitly set the frequency to lowest before the last cpu goes down.
Quoted 4 lines
Quoted 1 line
Yes, but it would "after" the last cpu goes down. As mentioned in my
How will you change freq *after* last cpu goes down? This code always initiate freq-switch from last-cpu.
meaning, after the 'bL_switch_request' call for the last cpu in the cluster.
Quoted 3 lines
Also, we must keep in mind that switching to lowest freq would make it take more time to execute the cluster shutdown code..
The inbound CPU is probably on this way to execute useful code while the outbound CPU does the cluster down and it is the frequency of the outbound cluster that is being changed here.
Quoted 12 lines
Quoted 11 lines
previous reply, there is an opportunity to save power by doing this.
Quoted 2 lines
This needs to be handled implicitly IMO, but
they may be some restrictions on some platforms which I am not aware of.This change is useful on Exynos based platforms and not intrusive either. So if we can get this on linux-next and gets test coverage on other platforms until maybe -rc7, we can be reasonably sure that other platforms are not affected by this. I see no reason in holding this back just based on assumptions about other platforms.
Quoted 5 lines
I don't think getting this to linux-next would make a difference. There aren't many big LITTLE platforms, even lesser would be using linux-next and very very few would be using IKS :)
So, we have to decide whatever we want here only.
Ok.
Quoted 7 lines
@Nicolas: Please comment here, we need your suggestions :)
As I told you before, I wrote something similar long back and had the same mindset as you have now. Yes, it *might* be useful but we wanna be sure about it. That's why all these discussions. So, just hold on :)
The reason for sending this patch was because of the power saving observed on Chromebook platform. So this patch is not based on an assumption.
Quoted 5 lines
I am not asking you to reveal internals of Exynos octa, but what exactly is using this clock when the cluster goes down? L2 caches might stay on for a while if they have something useful, don't know exactly how the CPU clock would be affecting that..
There are few blocks running of the CPU clock (internal buses, Coresight, JTAG, AXI interface clock). Also, it has been observed that a lower ARM clock reduces the power consumed on the voltage rail for the peripherals block.
Quoted 11 lines
This is what my understanding is and it holds true for the cpuidle case sudeep mentioned:
- If cluster is going to shutdown soon, there is no point changing clk rate.
- If cluster isn't going down for a complete shutdown, yes we can save some power by playing with clk rate. And the L2 cache example above fits here.@Daniel: Are there some idle states for clusters where we aren't switching it off completely, but all CPUs are idle? And will switching to lowest freq sensible there ?
Maybe I misunderstand here, but why is this patch being linked with CPU idle?
Thanks,
Thomas.
Quoted 3 lines
--
viresh
Viresh Kumar
maintainerQuoted 8 lines · Thomas Abraham
Quoted 2 lines · Viresh Kumar
Also, we must keep in mind that switching to lowest freq would make it take more time to execute the cluster shutdown code..
The inbound CPU is probably on this way to execute useful code while the outbound CPU does the cluster down and it is the frequency of the outbound cluster that is being changed here.
I didn't get you here. For the cluster going down, there is no Inbound CPU. And the last outbound CPU of dying cluster will shut it down and I was talking about the code it has to execute to get it down.. It will take more time to get it down now..
Quoted 3 lines
The reason for sending this patch was because of the power saving observed on Chromebook platform. So this patch is not based on an assumption.
Always ALWAYS mention such details in logs. It helps people understand you really need it. Giving values would be the best though.. Or atleast mention % improvement with a commit.
So, how much you saved here?
Quoted 2 lines
There are few blocks running of the CPU clock (internal buses, Coresight, JTAG, AXI interface clock).
Don't they go down with the cluster? Or we aren't performing a full cluster down?
Quoted 3 lines
Also, it has been observed that
a lower ARM clock reduces the power consumed on the voltage rail for the peripherals block.
Peripherals internal to cluster? Like arch-timer?
Quoted 1 line
Maybe I misunderstand here, but why is this patch being linked with CPU idle?
If this patch saves us some energy for IKS, then we can use something similar for MP as well by reducing frequency on cluster cpu-idle ..
Quoted 6 lines · Viresh Kumar
Quoted 5 lines · Thomas Abraham
Quoted 2 lines · Viresh Kumar
Also, we must keep in mind that switching to lowest freq would make it take more time to execute the cluster shutdown code..
Quoted 8 lines
Quoted 3 lines
The inbound CPU is probably on this way to execute useful code while the outbound CPU does the cluster down and it is the frequency of the outbound cluster that is being changed here.
I didn't get you here. For the cluster going down, therclock e is no Inbound CPU. And the last outbound CPU of dying cluster will shut it down and I was talking about the code it has to execute to get it down.. It will take more time to get it down now..
I was trying to emphasis on the point that we are reducing the frequency of the outbound cluster. The inbound CPU (pair of the last man CPU in the outbound cluster) would be executing useful code while the outbound last man CPU is executing the cluster down sequence. Does it hurt if the cluster down sequence is executed a bit slower (and if yes, then why not set the max speed of the cluster for cluster down).
I haven't checked in detail but won't the cluster down be completed most of the times before return from bL_switch_request()?
Quoted 10 lines
Quoted 4 lines
The reason for sending this patch was because of the power saving observed on Chromebook platform. So this patch is not based on an assumption.
Always ALWAYS mention such details in logs. It helps people understand you really need it. Giving values would be the best though.. Or atleast mention % improvement with a commit.
So, how much you saved here?
Depending on the frequency of the outbound cluster, the savings was about 5~10mA. It is close to 25mA in case the PLL driving the CPU is also turned off.
Quoted 6 lines
Quoted 3 lines
There are few blocks running of the CPU clock (internal buses, Coresight, JTAG, AXI interface clock).
Don't they go down with the cluster? Or we aren't performing a full cluster down?
We are doing a full cluster down. I am not sure which of these continue to consume power in case of full cluster down.
Quoted 6 lines
Quoted 4 lines
Also, it has been observed that
a lower ARM clock reduces the power consumed on the voltage rail for the peripherals block.Peripherals internal to cluster? Like arch-timer?
No, the voltage rail on which the SoC peripherals such as connectivity, media, storage IP's are connected.
Quoted 5 lines
Quoted 2 lines
Maybe I misunderstand here, but why is this patch being linked with CPU idle?
If this patch saves us some energy for IKS, then we can use something similar for MP as well by reducing frequency on cluster cpu-idle ..
Ok. The reason I asked was because this is being done in bL_cpufreq_set_rate() function.
Thanks,
Thomas.
Viresh Kumar
maintainerQuoted 6 lines · Thomas Abraham
I was trying to emphasis on the point that we are reducing the frequency of the outbound cluster. The inbound CPU (pair of the last man CPU in the outbound cluster) would be executing useful code while the outbound last man CPU is executing the cluster down sequence. Does it hurt if the cluster down sequence is executed a bit slower (and if yes, then why not set the max speed of the cluster for cluster down).
Okay, I wasn't worried about performance but power here.
What I meant was that, because it *might* take more time to shutdown the cluster it will be on for longer. And so might end up consuming more power with this.
Quoted 2 lines
I haven't checked in detail but won't the cluster down be completed most of the times before return from
bL_switch_request()?
No idea :)
Quoted 3 lines
Depending on the frequency of the outbound cluster, the savings was about 5~10mA. It is close to 25mA in case the PLL driving the CPU is also turned off.
Shouldn't we talk about Energy here instead of current?
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
There are few blocks running of the CPU clock (internal buses, Coresight, JTAG, AXI interface clock).
Don't they go down with the cluster? Or we aren't performing a full cluster down?
We are doing a full cluster down. I am not sure which of these continue to consume power in case of full cluster down.
None should.
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Also, it has been observed that
a lower ARM clock reduces the power consumed on the voltage rail for the peripherals block.Peripherals internal to cluster? Like arch-timer?
No, the voltage rail on which the SoC peripherals such as connectivity, media, storage IP's are connected.
What do they have to do with cluster frequency ?
Quoted 8 lines · Viresh Kumar
Quoted 6 lines · Thomas Abraham
I was trying to emphasis on the point that we are reducing the frequency of the outbound cluster. The inbound CPU (pair of the last man CPU in the outbound cluster) would be executing useful code while the outbound last man CPU is executing the cluster down sequence. Does it hurt if the cluster down sequence is executed a bit slower (and if yes, then why not set the max speed of the cluster for cluster down).
Quoted 5 lines
Okay, I wasn't worried about performance but power here.
What I meant was that, because it *might* take more time to shutdown the cluster it will be on for longer. And so might end up consuming more power with this.
Ok. It is a comparison with the amount of power saved during the duration in which cluster remains inactive and clocked at a lower speed.
Quoted 11 lines
Quoted 3 lines
I haven't checked in detail but won't the cluster down be completed most of the times before return from
bL_switch_request()?No idea :)
Quoted 3 lines
Depending on the frequency of the outbound cluster, the savings was about 5~10mA. It is close to 25mA in case the PLL driving the CPU is also turned off.
Shouldn't we talk about Energy here instead of current?
Sorry, it is mW units.
Quoted 16 lines
Quoted 9 lines
Quoted 6 lines
Quoted 3 lines
There are few blocks running of the CPU clock (internal buses, Coresight, JTAG, AXI interface clock).
Don't they go down with the cluster? Or we aren't performing a full cluster down?
We are doing a full cluster down. I am not sure which of these continue to consume power in case of full cluster down.
None should.
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
Also, it has been observed that
a lower ARM clock reduces the power consumed on the voltage rail for the peripherals block.
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
Peripherals internal to cluster? Like arch-timer?
No, the voltage rail on which the SoC peripherals such as connectivity, media, storage IP's are connected.
What do they have to do with cluster frequency ?
I am not sure but maybe maintaining sync between two buses with a large clock frequency difference between them. Just a guess, but there does seem to be a relation with the cluster frequency.
Thanks,
Thomas.
Quoted 27 lines · Viresh Kumar
Quoted 8 lines · Thomas Abraham
Quoted 4 lines · Sudeep Holla
Alternatively in a multi-cluster platform if I hotplug out all the cpus in one
cluster, do you mean we still have to explicitly set the frequency to lowest before the last cpu goes down.Yes, but it would "after" the last cpu goes down. As mentioned in my
How will you change freq *after* last cpu goes down? This code always initiate freq-switch from last-cpu.
Also, we must keep in mind that switching to lowest freq would make it take more time to execute the cluster shutdown code..
Quoted 10 lines
previous reply, there is an opportunity to save power by doing this.
Quoted 2 lines
This needs to be handled implicitly IMO, but
they may be some restrictions on some platforms which I am not aware of.This change is useful on Exynos based platforms and not intrusive either. So if we can get this on linux-next and gets test coverage on other platforms until maybe -rc7, we can be reasonably sure that other platforms are not affected by this. I see no reason in holding this back just based on assumptions about other platforms.
Quoted 7 lines
I don't think getting this to linux-next would make a difference. There aren't many big LITTLE platforms, even lesser would be using linux-next and very very few would be using IKS :)
So, we have to decide whatever we want here only.
@Nicolas: Please comment here, we need your suggestions :)
OK...
If reducing the frequency of the cluster going down saves power, then it should be done _all_ the time i.e. when using CPU hotplug, when cpuidle sends all CPUs to sleep, etc. So this has nothing to do with the switcher even if the switcher would also benefit from this.
In other words, this should be performed by the MCPM backend as part of the last man operations. This way it is generic and completely transparent to the rest of the system.
To restore the CPU frequency that was effective before going down, you may use the MCPM powered_up method.
Nicolas
Viresh Kumar
maintainerQuoted 11 lines · Nicolas Pitre
If reducing the frequency of the cluster going down saves power, then it should be done _all_ the time i.e. when using CPU hotplug, when cpuidle sends all CPUs to sleep, etc. So this has nothing to do with the switcher even if the switcher would also benefit from this.
In other words, this should be performed by the MCPM backend as part of the last man operations. This way it is generic and completely transparent to the rest of the system.
To restore the CPU frequency that was effective before going down, you may use the MCPM
powered_upmethod.
Oh yes, this is exactly what we want then..
But do we want this forced for every platform? Or can we have some flag set by multi-cluster platforms, so that it stays optional ?
Quoted 10 lines · Viresh Kumar
Quoted 9 lines · Nicolas Pitre
If reducing the frequency of the cluster going down saves power, then it should be done _all_ the time i.e. when using CPU hotplug, when cpuidle sends all CPUs to sleep, etc. So this has nothing to do with the switcher even if the switcher would also benefit from this.
In other words, this should be performed by the MCPM backend as part of the last man operations. This way it is generic and completely transparent to the rest of the system.
Quoted 7 lines
Quoted 2 lines
To restore the CPU frequency that was effective before going down, you may use the MCPM
powered_upmethod.Oh yes, this is exactly what we want then..
But do we want this forced for every platform? Or can we have some flag set by multi-cluster platforms, so that it stays optional ?
Thanks Nicolas and Viresh for your feedback. Probably, this can be handled in platform specific mcpm backend driver.
Viresh Kumar
maintainerQuoted 2 lines · Thomas Abraham
Thanks Nicolas and Viresh for your feedback. Probably, this can be handled in platform specific mcpm backend driver.
This can be a generic requirement and so doing it inside MCPM core would be better IMO.
But the control should be there with backend driver.
Quoted 10 lines · Viresh Kumar
Quoted 9 lines · Nicolas Pitre
If reducing the frequency of the cluster going down saves power, then it should be done _all_ the time i.e. when using CPU hotplug, when cpuidle sends all CPUs to sleep, etc. So this has nothing to do with the switcher even if the switcher would also benefit from this.
In other words, this should be performed by the MCPM backend as part of the last man operations. This way it is generic and completely transparent to the rest of the system.
Quoted 7 lines
Quoted 2 lines
To restore the CPU frequency that was effective before going down, you may use the MCPM
powered_upmethod.Oh yes, this is exactly what we want then..
But do we want this forced for every platform? Or can we have some flag set by multi-cluster platforms, so that it stays optional ?
No flags. That's a "power saving measure" specific to that platform being invoked from a platform specific backend.
Nicolas
Quoted 6 lines · Viresh Kumar
Quoted 2 lines · Thomas Abraham
Thanks Nicolas and Viresh for your feedback. Probably, this can be handled in platform specific mcpm backend driver.
This can be a generic requirement and so doing it inside MCPM core would be better IMO.
Let me rephrase the above.
This could become a generic requirement at which point doing it inside MCPM core would be better.
Let's resist overengineering. things prematurely.
Nicolas