From: Kevin Hilman <khilman@ti.com>
To: "Shilimkar, Santosh" <santosh.shilimkar@ti.com>
Cc: Rajendra Nayak <rnayak@ti.com>,
linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-pm@vger.kernel.org
Subject: Re: [PATCH 1/2] cpufreq: OMAP: Handle missing frequency table on SMP systems
Date: Wed, 08 Aug 2012 10:28:50 -0700 [thread overview]
Message-ID: <87wr19uwbx.fsf@ti.com> (raw)
In-Reply-To: <CAMQu2gyooQ4x=ZGDZFg5BuBaEkgQx2kTAvtiGLEjXwOYvF_wMQ@mail.gmail.com> (Santosh Shilimkar's message of "Wed, 8 Aug 2012 17:00:10 +0530")
"Shilimkar, Santosh" <santosh.shilimkar@ti.com> writes:
> On Wed, Aug 8, 2012 at 4:24 PM, Rajendra Nayak <rnayak@ti.com> 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. Add a check for a NULL freq_table to help error the rest
>> of the CPU instances out.
>>
>> Signed-off-by: Rajendra Nayak <rnayak@ti.com>
>> Cc: <linux-pm@vger.kernel.org>
>> ---
>> drivers/cpufreq/omap-cpufreq.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/cpufreq/omap-cpufreq.c
>> b/drivers/cpufreq/omap-cpufreq.c
>> index 17fa04d..0ee824c 100644
>> --- a/drivers/cpufreq/omap-cpufreq.c
>> +++ b/drivers/cpufreq/omap-cpufreq.c
>> @@ -221,7 +221,7 @@ static int __cpuinit omap_cpu_init(struct
>> cpufreq_policy *policy)
>> if (atomic_inc_return(&freq_table_users) == 1)
>> result = opp_init_cpufreq_table(mpu_dev, &freq_table);
>>
>> - if (result) {
>> + if (result || !freq_table) {
>> dev_err(mpu_dev, "%s: cpu%d: failed creating freq
>> table[%d]\n",
>> __func__, policy->cpu, result);
>> goto fail_ck;
>
> The freq_table use count seems to be buggy in that case.
> Something like below should fix the issue.
> Feel free to update your patch with below if you agree.
>
> diff --git a/drivers/cpufreq/omap-cpufreq.c b/drivers/cpufreq/omap-cpufreq.c
> index 17fa04d..fd97c3d 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 *po
>
> policy->cur = policy->min = policy->max = omap_getspeed(policy->cpu);
>
> - if (atomic_inc_return(&freq_table_users) == 1)
> + if (freq_table)
I think you meant 'if (!freq_table)' ?
Kevin
> result = opp_init_cpufreq_table(mpu_dev, &freq_table);
>
> if (result) {
> @@ -227,6 +227,7 @@ static int __cpuinit omap_cpu_init(struct cpufreq_policy *po
> goto fail_ck;
> }
>
> + atomic_inc_return(&freq_table_users);
> result = cpufreq_frequency_table_cpuinfo(policy, freq_table);
> if (result)
> goto fail_table;
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
WARNING: multiple messages have this Message-ID (diff)
From: khilman@ti.com (Kevin Hilman)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/2] cpufreq: OMAP: Handle missing frequency table on SMP systems
Date: Wed, 08 Aug 2012 10:28:50 -0700 [thread overview]
Message-ID: <87wr19uwbx.fsf@ti.com> (raw)
In-Reply-To: <CAMQu2gyooQ4x=ZGDZFg5BuBaEkgQx2kTAvtiGLEjXwOYvF_wMQ@mail.gmail.com> (Santosh Shilimkar's message of "Wed, 8 Aug 2012 17:00:10 +0530")
"Shilimkar, Santosh" <santosh.shilimkar@ti.com> writes:
> On Wed, Aug 8, 2012 at 4:24 PM, Rajendra Nayak <rnayak@ti.com> 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. Add a check for a NULL freq_table to help error the rest
>> of the CPU instances out.
>>
>> Signed-off-by: Rajendra Nayak <rnayak@ti.com>
>> Cc: <linux-pm@vger.kernel.org>
>> ---
>> drivers/cpufreq/omap-cpufreq.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/cpufreq/omap-cpufreq.c
>> b/drivers/cpufreq/omap-cpufreq.c
>> index 17fa04d..0ee824c 100644
>> --- a/drivers/cpufreq/omap-cpufreq.c
>> +++ b/drivers/cpufreq/omap-cpufreq.c
>> @@ -221,7 +221,7 @@ static int __cpuinit omap_cpu_init(struct
>> cpufreq_policy *policy)
>> if (atomic_inc_return(&freq_table_users) == 1)
>> result = opp_init_cpufreq_table(mpu_dev, &freq_table);
>>
>> - if (result) {
>> + if (result || !freq_table) {
>> dev_err(mpu_dev, "%s: cpu%d: failed creating freq
>> table[%d]\n",
>> __func__, policy->cpu, result);
>> goto fail_ck;
>
> The freq_table use count seems to be buggy in that case.
> Something like below should fix the issue.
> Feel free to update your patch with below if you agree.
>
> diff --git a/drivers/cpufreq/omap-cpufreq.c b/drivers/cpufreq/omap-cpufreq.c
> index 17fa04d..fd97c3d 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 *po
>
> policy->cur = policy->min = policy->max = omap_getspeed(policy->cpu);
>
> - if (atomic_inc_return(&freq_table_users) == 1)
> + if (freq_table)
I think you meant 'if (!freq_table)' ?
Kevin
> result = opp_init_cpufreq_table(mpu_dev, &freq_table);
>
> if (result) {
> @@ -227,6 +227,7 @@ static int __cpuinit omap_cpu_init(struct cpufreq_policy *po
> goto fail_ck;
> }
>
> + atomic_inc_return(&freq_table_users);
> result = cpufreq_frequency_table_cpuinfo(policy, freq_table);
> if (result)
> goto fail_table;
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pm" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2012-08-08 17:28 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-08 10:54 [PATCH 0/2] OMAP cpufreq fixes Rajendra Nayak
2012-08-08 10:54 ` Rajendra Nayak
2012-08-08 10:54 ` [PATCH 1/2] cpufreq: OMAP: Handle missing frequency table on SMP systems Rajendra Nayak
2012-08-08 10:54 ` Rajendra Nayak
2012-08-08 11:30 ` Shilimkar, Santosh
2012-08-08 11:30 ` Shilimkar, Santosh
2012-08-08 17:28 ` Kevin Hilman [this message]
2012-08-08 17:28 ` Kevin Hilman
2012-08-09 5:27 ` Shilimkar, Santosh
2012-08-09 5:27 ` Shilimkar, Santosh
2012-08-08 10:54 ` [PATCH 2/2] ARM: OMAP4: Register the OPP table only for 4430 device Rajendra Nayak
2012-08-08 10:54 ` Rajendra Nayak
2012-08-08 17:18 ` Kevin Hilman
2012-08-08 17:18 ` Kevin Hilman
2012-08-09 7:23 ` Rajendra Nayak
2012-08-09 7:23 ` Rajendra Nayak
2012-08-09 15:01 ` Kevin Hilman
2012-08-09 15:01 ` Kevin Hilman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87wr19uwbx.fsf@ti.com \
--to=khilman@ti.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-omap@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rnayak@ti.com \
--cc=santosh.shilimkar@ti.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.