Re: [PATCH] cpufreq: Fix sysfs deadlock with concurrent hotplug/frequencyswitch

From: Stephen Boyd
Date: Fri Jul 20 2012 - 13:34:01 EST


On 07/20/12 03:05, Rafael J. Wysocki wrote:
>
> The following part of your changelog has confused Patchwork. I guess it
> will also confuse other tools, so care to describe what to do instead?

Sure. I thought that might happen but I put a space in front in hopes it
wouldn't cause troubles.

>
>> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
>> index a290771..62af12d 100644
>> --- a/drivers/cpufreq/cpufreq.c
>> +++ b/drivers/cpufreq/cpufreq.c
>> @@ -675,6 +675,7 @@ static ssize_t store(struct kobject *kobj
>>
>> unlock_policy_rwsem_write(policy->cpu);
>> fail:
>> + msleep(10000);
>> cpufreq_cpu_put_sysfs(policy);
>> no_policy:
>> return ret;
>>
>> and then write scaling_setspeed in one task and offline the cpu
>> in another. The first task will hang and be detected by the hung
>> task detector.
>>
>> Signed-off-by: Stephen Boyd <sboyd@xxxxxxxxxxxxxx>
>> ---
>>
>> Before you ask, I've seen the comment above cpufreq_add_dev() about
>> concurrent hotplug/cpufreq.
>>
>> drivers/cpufreq/cpufreq.c | 35 +++++++++++++++++++++++++++--------
>> 1 file changed, 27 insertions(+), 8 deletions(-)
>>
>> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
>> index 7f2f149..a290771 100644
>> --- a/drivers/cpufreq/cpufreq.c
>> +++ b/drivers/cpufreq/cpufreq.c
>> @@ -138,7 +138,7 @@ void disable_cpufreq(void)
>> static LIST_HEAD(cpufreq_governor_list);
>> static DEFINE_MUTEX(cpufreq_governor_mutex);
>>
>> -struct cpufreq_policy *cpufreq_cpu_get(unsigned int cpu)
>> +static struct cpufreq_policy *__cpufreq_cpu_get(unsigned int cpu, int sysfs)
> I'd prefer the sysfs arg to be a bool.

Sure. V2 coming right up.

--
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/