diff mbox

[v2,1/2] cpufreq: OMAP: Handle missing frequency table on SMP systems

Message ID 1344496102-24451-2-git-send-email-rnayak@ti.com (mailing list archive)
State New, archived
Headers show

Commit Message

Rajendra Nayak Aug. 9, 2012, 7:08 a.m. UTC
On OMAP4, if the first CPU fails to get a valid frequency table (this
could happen if the platform does not register any OPP table), the
subsequent CPU instances end up dealing with a NULL freq_table and
crash.

Check for an already existing freq_table, before trying to create one,
and increment the freq_table_users only if the table is sucessfully
created.

Signed-off-by: Rajendra Nayak <rnayak@ti.com>
Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Cc: <linux-pm@vger.kernel.org>
---
 drivers/cpufreq/omap-cpufreq.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Rafael Wysocki Aug. 9, 2012, 9:32 a.m. UTC | #1
On Thursday, August 09, 2012, Rajendra Nayak wrote:
> On OMAP4, if the first CPU fails to get a valid frequency table (this
> could happen if the platform does not register any OPP table), the
> subsequent CPU instances end up dealing with a NULL freq_table and
> crash.
> 
> Check for an already existing freq_table, before trying to create one,
> and increment the freq_table_users only if the table is sucessfully
> created.
> 
> Signed-off-by: Rajendra Nayak <rnayak@ti.com>
> Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
> Cc: <linux-pm@vger.kernel.org>

Kevin, are you going to merge this?

Rafael


> ---
>  drivers/cpufreq/omap-cpufreq.c |    4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/cpufreq/omap-cpufreq.c b/drivers/cpufreq/omap-cpufreq.c
> index 17fa04d..b47034e 100644
> --- a/drivers/cpufreq/omap-cpufreq.c
> +++ b/drivers/cpufreq/omap-cpufreq.c
> @@ -218,7 +218,7 @@ static int __cpuinit omap_cpu_init(struct cpufreq_policy *policy)
>  
>  	policy->cur = policy->min = policy->max = omap_getspeed(policy->cpu);
>  
> -	if (atomic_inc_return(&freq_table_users) == 1)
> +	if (!freq_table)
>  		result = opp_init_cpufreq_table(mpu_dev, &freq_table);
>  
>  	if (result) {
> @@ -227,6 +227,8 @@ static int __cpuinit omap_cpu_init(struct cpufreq_policy *policy)
>  		goto fail_ck;
>  	}
>  
> +	atomic_inc_return(&freq_table_users);
> +
>  	result = cpufreq_frequency_table_cpuinfo(policy, freq_table);
>  	if (result)
>  		goto fail_table;
>
Kevin Hilman Aug. 9, 2012, 3 p.m. UTC | #2
"Rafael J. Wysocki" <rjw@sisk.pl> writes:

> On Thursday, August 09, 2012, Rajendra Nayak wrote:
>> On OMAP4, if the first CPU fails to get a valid frequency table (this
>> could happen if the platform does not register any OPP table), the
>> subsequent CPU instances end up dealing with a NULL freq_table and
>> crash.
>> 
>> Check for an already existing freq_table, before trying to create one,
>> and increment the freq_table_users only if the table is sucessfully
>> created.
>> 
>> Signed-off-by: Rajendra Nayak <rnayak@ti.com>
>> Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
>> Cc: <linux-pm@vger.kernel.org>
>
> Kevin, are you going to merge this?
>

Yes, I plan to queue this with 2/2 for v3.6-rc.

Kevin
Rafael Wysocki Aug. 9, 2012, 7:32 p.m. UTC | #3
On Thursday, August 09, 2012, Kevin Hilman wrote:
> "Rafael J. Wysocki" <rjw@sisk.pl> writes:
> 
> > On Thursday, August 09, 2012, Rajendra Nayak wrote:
> >> On OMAP4, if the first CPU fails to get a valid frequency table (this
> >> could happen if the platform does not register any OPP table), the
> >> subsequent CPU instances end up dealing with a NULL freq_table and
> >> crash.
> >> 
> >> Check for an already existing freq_table, before trying to create one,
> >> and increment the freq_table_users only if the table is sucessfully
> >> created.
> >> 
> >> Signed-off-by: Rajendra Nayak <rnayak@ti.com>
> >> Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
> >> Cc: <linux-pm@vger.kernel.org>
> >
> > Kevin, are you going to merge this?
> >
> 
> Yes, I plan to queue this with 2/2 for v3.6-rc.

If you have any cpufreq patches for v3.7, can you please tell me where to
pull them from (and when)?

Rafael
Kevin Hilman Aug. 9, 2012, 9:25 p.m. UTC | #4
"Rafael J. Wysocki" <rjw@sisk.pl> writes:

> On Thursday, August 09, 2012, Kevin Hilman wrote:
>> "Rafael J. Wysocki" <rjw@sisk.pl> writes:
>> 
>> > On Thursday, August 09, 2012, Rajendra Nayak wrote:
>> >> On OMAP4, if the first CPU fails to get a valid frequency table (this
>> >> could happen if the platform does not register any OPP table), the
>> >> subsequent CPU instances end up dealing with a NULL freq_table and
>> >> crash.
>> >> 
>> >> Check for an already existing freq_table, before trying to create one,
>> >> and increment the freq_table_users only if the table is sucessfully
>> >> created.
>> >> 
>> >> Signed-off-by: Rajendra Nayak <rnayak@ti.com>
>> >> Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
>> >> Cc: <linux-pm@vger.kernel.org>
>> >
>> > Kevin, are you going to merge this?
>> >
>> 
>> Yes, I plan to queue this with 2/2 for v3.6-rc.
>
> If you have any cpufreq patches for v3.7, can you please tell me where to
> pull them from (and when)?

Yes, I will. 

Thanks,

Kevin
diff mbox

Patch

diff --git a/drivers/cpufreq/omap-cpufreq.c b/drivers/cpufreq/omap-cpufreq.c
index 17fa04d..b47034e 100644
--- a/drivers/cpufreq/omap-cpufreq.c
+++ b/drivers/cpufreq/omap-cpufreq.c
@@ -218,7 +218,7 @@  static int __cpuinit omap_cpu_init(struct cpufreq_policy *policy)
 
 	policy->cur = policy->min = policy->max = omap_getspeed(policy->cpu);
 
-	if (atomic_inc_return(&freq_table_users) == 1)
+	if (!freq_table)
 		result = opp_init_cpufreq_table(mpu_dev, &freq_table);
 
 	if (result) {
@@ -227,6 +227,8 @@  static int __cpuinit omap_cpu_init(struct cpufreq_policy *policy)
 		goto fail_ck;
 	}
 
+	atomic_inc_return(&freq_table_users);
+
 	result = cpufreq_frequency_table_cpuinfo(policy, freq_table);
 	if (result)
 		goto fail_table;