public inbox for cpufreq@vger.kernel.org
 help / color / mirror / Atom feed
From: Jane Li <jiel@marvell.com>
To: Viresh Kumar <viresh.kumar@linaro.org>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
	"cpufreq@vger.kernel.org" <cpufreq@vger.kernel.org>
Subject: Re: cpufreq ondemand governor debugobjects warning
Date: Fri, 27 Dec 2013 17:35:54 +0800	[thread overview]
Message-ID: <52BD49FA.9070002@marvell.com> (raw)
In-Reply-To: <CAKohpo=xxt2BRsiLkufkH7qdBeQrxw_SinRMyLWFiC6MTHUJWw@mail.gmail.com>


On 12/27/2013 04:01 PM, Viresh Kumar wrote:
> On 27 December 2013 08:36, Jane Li <jiel@marvell.com> wrote:
>> When gov_queue_work(), governor_enabled may be modified.  Following patch
>> can fix it by adding cpufreq_governor_lock in gov_queue_work. But in this
>> way, cpufreq_governor_lock also protects __gov_queue_work(). Do you think
>> this is a good idea?
> I don't see a alternative than this solution after the deadlock issue with timer
> lock.
>
>> diff --git a/drivers/cpufreq/cpufreq_governor.c
>> b/drivers/cpufreq/cpufreq_governor.c
>> index e6be635..a27246c 100644
>> --- a/drivers/cpufreq/cpufreq_governor.c
>> +++ b/drivers/cpufreq/cpufreq_governor.c
>> @@ -118,9 +118,11 @@ void gov_queue_work(struct dbs_data *dbs_data,
>> struct cpufreq_policy *policy,
>>                    unsigned int delay, bool all_cpus)
>>     {
>>            int i;
>> -
> don't remove this.
>
>> -       if (!policy->governor_enabled)
>> +       mutex_lock(&cpufreq_governor_lock);
>> +       if (!policy->governor_enabled) {
>> +               mutex_unlock(&cpufreq_governor_lock);
>>                    return;
>> +       }
>>
>>            if (!all_cpus) {
>>                    /*
>> @@ -135,6 +137,7 @@ void gov_queue_work(struct dbs_data *dbs_data,
>> struct cpufreq_policy *policy,
>>                    for_each_cpu(i, policy->cpus)
>>                            __gov_queue_work(i, dbs_data, delay);
>>            }
>> +       mutex_unlock(&cpufreq_governor_lock);
>>     }
>>     EXPORT_SYMBOL_GPL(gov_queue_work);
> You also need to remove 'static' from lock's declaration.
>
> --
> viresh

Thanks. I have pushed one patch named "[PATCH] cpufreq: Fix timer/workqueue corruption by protecting reading governor_enabled".


      reply	other threads:[~2013-12-27  9:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <52BCEA76.1020906@marvell.com>
2013-12-27  3:06 ` cpufreq ondemand governor debugobjects warning Jane Li
2013-12-27  5:31   ` Viresh Kumar
2013-12-27  6:18     ` Jane Li
2013-12-27  8:01   ` Viresh Kumar
2013-12-27  9:35     ` Jane Li [this message]

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=52BD49FA.9070002@marvell.com \
    --to=jiel@marvell.com \
    --cc=cpufreq@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=viresh.kumar@linaro.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox