Skip to contentSkip to conversation

PM: Prevent direct cpufreq scaling during initialization

PATCH In review Romit Dasgupta 3 participants 6 messages Dec 2, 2009 – Dec 16, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PM: Prevent direct cpufreq scaling during initialization

It is seen that the OMAP specific cpufreq initialization code tries to scale the MPU frequency to the highest possible without taking care of the voltage level. On power on reset the power IC does not provide the necessary voltage for the highest available MPU frequency (that would satisfy all Si families). This potentially is an window of opportunity for things to go wrong.

---

arch/arm/plat-omap/cpu-omap.c +0 -2
index 449b6b6..f94df20 100644
@@ -149,8 +149,6 @@ static int __init omap_cpu_init(struct cpufreq_policy *policy)
 							VERY_HI_RATE) / 1000;
 	}
 
-	clk_set_rate(mpu_clk, policy->cpuinfo.max_freq * 1000);
-
 	policy->min = policy->cpuinfo.min_freq;
 	policy->max = policy->cpuinfo.max_freq;
 	policy->cur = omap_getspeed(0);
#1 lore raw
Quoted 16 lines · Romit Dasgupta

It is seen that the OMAP specific cpufreq initialization code tries to scale the MPU frequency to the highest possible without taking care of the voltage level. On power on reset the power IC does not provide the necessary voltage for the highest available MPU frequency (that would satisfy all Si families). This potentially is an window of opportunity for things to go wrong.

---

arch/arm/plat-omap/cpu-omap.c +0 -0
index 449b6b6..f94df20 100644

arch/arm/plat-omap/cpu-omap.c static int __init omap_cpu_init(struct cpufreq_policy *policy) · line 154

Quoted 8 lines
arch/arm/plat-omap/cpu-omap.c +0 -2
@@ -149,8 +149,6 @@ static int __init omap_cpu_init(struct cpufreq_policy *policy)
                                                       VERY_HI_RATE) / 1000;
       }
 
-       clk_set_rate(mpu_clk, policy->cpuinfo.max_freq * 1000);
-
       policy->min = policy->cpuinfo.min_freq;
       policy->max = policy->cpuinfo.max_freq;
       policy->cur = omap_getspeed(0);

This patch leads to hang with current PM branch, SRF and CPU IDLE enabled on OMAP3525 rev C.

#2 lore raw
Quoted 15 lines

arch/arm/plat-omap/cpu-

Quoted 5 lines

---

arch/arm/plat-omap/cpu- renamed from arch/arm/plat-omap/cpu-omap.c +0 -0

omap.c

arch/arm/plat-omap/cpu-omap.c static int __init omap_cpu_init(struct

Quoted 4 lines

index 449b6b6..f94df20 100644

arch/arm/plat-omap/cpu-omap.c +0 -0
@@ -149,8 +149,6 @@ static int __init omap_cpu_init(struct

cpufreq_policy *policy)

arch/arm/plat-omap/cpu-omap.c static int __init omap_cpu_init(struct · line 149

Quoted 1 line
arch/arm/plat-omap/cpu-omap.c +0 -0
                                                       VERY_HI_RATE) /

1000;

Quoted 2 lines
arch/arm/plat-omap/cpu-omap.c +0 -0
       }
 
Quoted 8 lines

arch/arm/plat-omap/cpu-omap.c static int __init omap_cpu_init(struct cpufreq_policy *policy) · line 154

Quoted 5 lines
arch/arm/plat-omap/cpu-omap.c +0 -2
-       clk_set_rate(mpu_clk, policy->cpuinfo.max_freq * 1000);
-
       policy->min = policy->cpuinfo.min_freq;
       policy->max = policy->cpuinfo.max_freq;
       policy->cur = omap_getspeed(0);

This patch leads to hang with current PM branch, SRF and CPU IDLE enabled on OMAP3525 rev C.

Verified this to work on Zoom2 + SRF + CPUidle. Can you give some debug info if possible?

#3 lore raw
Quoted 21 lines · Romit
Quoted 21 lines

arch/arm/plat-omap/cpu-

Quoted 5 lines

---

arch/arm/plat-omap/cpu- renamed from arch/arm/plat-omap/cpu-omap.c +0 -0

omap.c

arch/arm/plat-omap/cpu-omap.c static int __init omap_cpu_init(struct

Quoted 4 lines

index 449b6b6..f94df20 100644

arch/arm/plat-omap/cpu-omap.c +0 -0
@@ -149,8 +149,6 @@ static int __init omap_cpu_init(struct

cpufreq_policy *policy)

arch/arm/plat-omap/cpu-omap.c static int __init omap_cpu_init(struct · line 149

Quoted 1 line
arch/arm/plat-omap/cpu-omap.c +0 -0
                                                       VERY_HI_RATE) /

1000;

Quoted 7 lines
arch/arm/plat-omap/cpu-omap.c +0 -2
       }
 
-       clk_set_rate(mpu_clk, policy->cpuinfo.max_freq * 1000);
-
       policy->min = policy->cpuinfo.min_freq;
       policy->max = policy->cpuinfo.max_freq;
       policy->cur = omap_getspeed(0);
Quoted 4 lines
Quoted 2 lines

This patch leads to hang with current PM branch, SRF and CPU IDLE enabled on OMAP3525 rev C.

Verified this to work on Zoom2 + SRF + CPUidle. Can you give some debug info if possible?

Well, that looks like false alarm - I tried clean tree without local patches, and it seems to work.

However, without this line removed, my system boots faster. Is it possible to limit initial speed for unstable setups, but to boot as fast as possible?

Thanks a lot,
S.

#4 lore raw
Quoted 24 lines · Sergey Lapin
Quoted 14 lines · Romit
Quoted 14 lines

arch/arm/plat-omap/cpu-

Quoted 4 lines

---

arch/arm/plat-omap/cpu- renamed from arch/arm/plat-omap/cpu-omap.c +0 -0

omap.c

arch/arm/plat-omap/cpu-omap.c static int __init omap_cpu_init(struct

Quoted 4 lines

index 449b6b6..f94df20 100644

arch/arm/plat-omap/cpu-omap.c +0 -0
@@ -149,8 +149,6 @@ static int __init omap_cpu_init(struct

cpufreq_policy *policy)

arch/arm/plat-omap/cpu-omap.c static int __init omap_cpu_init(struct · line 149

Quoted 1 line
arch/arm/plat-omap/cpu-omap.c +0 -0
                                                       VERY_HI_RATE) /

1000;

Quoted 2 lines
arch/arm/plat-omap/cpu-omap.c +0 -0
       }
 
Quoted 9 lines
Quoted 7 lines

arch/arm/plat-omap/cpu-omap.c static int __init omap_cpu_init(struct cpufreq_policy *policy) · line 154

Quoted 5 lines
arch/arm/plat-omap/cpu-omap.c +0 -2
-       clk_set_rate(mpu_clk, policy->cpuinfo.max_freq * 1000);
-
       policy->min = policy->cpuinfo.min_freq;
       policy->max = policy->cpuinfo.max_freq;
       policy->cur = omap_getspeed(0);

This patch leads to hang with current PM branch, SRF and CPU IDLE enabled on OMAP3525 rev C.

Verified this to work on Zoom2 + SRF + CPUidle. Can you give some debug info if possible?

Quoted 8 lines

Well, that looks like false alarm - I tried clean tree without local patches, and it seems to work.

However, without this line removed, my system boots faster. Is it possible to limit initial speed for unstable setups, but to boot as fast as possible?

Thanks a lot,
S.

omap_cpufreq_init is a lateinitcall. So quite some part of the kernel startup happens with whatever speed the bootloader passes control to kernel initialization code. Only after we invoke omap_cpufreq_init will the cpufreq framework try to call the offending code 'clk_set_rate'. Quite soon after this the cpufreq default governor (whatever it is for your system, performance, ondemand etc) is initialized. If you choose performance governor it will immediately scale the frequency to the highest available for the system. So the way to boot fast would be

a) make your bootcode scale the voltage + freq to support the highest cpu freq. and/or
b) make performance governor the default.

#5 lore raw
In reply to Romit Dasgupta
Quoted 8 lines · Romit Dasgupta

It is seen that the OMAP specific cpufreq initialization code tries to scale the MPU frequency to the highest possible without taking care of the voltage level. On power on reset the power IC does not provide the necessary voltage for the highest available MPU frequency (that would satisfy all Si families). This potentially is an window of opportunity for things to go wrong.

Looks good. Pulling into PM branch, and queing in pm-fixes for .33-rc series.

Kevin

Quoted 14 lines

---

arch/arm/plat-omap/cpu-omap.c +0 -2
index 449b6b6..f94df20 100644
@@ -149,8 +149,6 @@ static int __init omap_cpu_init(struct cpufreq_policy *policy)
 							VERY_HI_RATE) / 1000;
 	}
 
-	clk_set_rate(mpu_clk, policy->cpuinfo.max_freq * 1000);
-
 	policy->min = policy->cpuinfo.min_freq;
 	policy->max = policy->cpuinfo.max_freq;
 	policy->cur = omap_getspeed(0);