[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250429052444.zfmfzjirkcaq3edh@vireshk-i7>
Date: Tue, 29 Apr 2025 10:54:44 +0530
From: Viresh Kumar <viresh.kumar@...aro.org>
To: Seyediman Seyedarab <imandevel@...il.com>
Cc: rafael@...nel.org, linux-pm@...r.kernel.org,
linux-kernel@...r.kernel.org, skhan@...uxfoundation.org,
linux-kernel-mentees@...ts.linux.dev
Subject: Re: [PATCH v2] cpufreq: fix locking order in store_local_boost to
prevent deadlock
On 28-04-25, 13:19, Seyediman Seyedarab wrote:
> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> index acf19b004..5464c8487 100644
> --- a/drivers/cpufreq/cpufreq.c
> +++ b/drivers/cpufreq/cpufreq.c
> @@ -653,10 +653,7 @@ static ssize_t store_local_boost(struct cpufreq_policy *policy,
>
> policy->boost_enabled = enable;
>
> - cpus_read_lock();
> ret = cpufreq_driver->set_boost(policy, enable);
> - cpus_read_unlock();
> -
> if (ret) {
> policy->boost_enabled = !policy->boost_enabled;
> return ret;
> @@ -1045,11 +1042,17 @@ static ssize_t store(struct kobject *kobj, struct attribute *attr,
> if (!fattr->store)
> return -EIO;
>
> + if (fattr == &local_boost)
> + cpus_read_lock();
> +
Please add a comment as well to explain why this is required here.
> down_write(&policy->rwsem);
And please rebase over PM tree's linux-next branch, your patch won't
apply anymore due to recent changes.
> if (likely(!policy_is_inactive(policy)))
> ret = fattr->store(policy, buf, count);
> up_write(&policy->rwsem);
>
> + if (fattr == &local_boost)
> + cpus_read_unlock();
> +
> return ret;
> }
--
viresh
Powered by blists - more mailing lists