lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJZ5v0hU0obSLwCxUX5Qa2Usa7hMoF23mAGxcRK2TCuAYiGZcg@mail.gmail.com>
Date:   Tue, 14 Jun 2022 15:51:47 +0200
From:   "Rafael J. Wysocki" <rafael@...nel.org>
To:     Viresh Kumar <viresh.kumar@...aro.org>
Cc:     "Rafael J. Wysocki" <rafael@...nel.org>,
        Linux PM <linux-pm@...r.kernel.org>,
        Vincent Guittot <vincent.guittot@...aro.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 3/3] cpufreq: Drop unnecessary cpus locking from store()

On Thu, May 26, 2022 at 1:51 PM Viresh Kumar <viresh.kumar@...aro.org> wrote:
>
> This change was introduced long back by:
>
> commit 4f750c930822 ("cpufreq: Synchronize the cpufreq store_*() routines with CPU hotplug")
>
> Since then, both cpufreq and hotplug core have been reworked and have
> much better locking in place. The race mentioned in commit 4f750c930822
> isn't possible anymore.
>
> Drop the unnecessary locking.
>
> Signed-off-by: Viresh Kumar <viresh.kumar@...aro.org>
> ---
>  drivers/cpufreq/cpufreq.c | 19 ++++---------------
>  1 file changed, 4 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> index 53d163a84e06..bb237d1ce5e7 100644
> --- a/drivers/cpufreq/cpufreq.c
> +++ b/drivers/cpufreq/cpufreq.c
> @@ -973,21 +973,10 @@ static ssize_t store(struct kobject *kobj, struct attribute *attr,
>         if (!fattr->store)
>                 return -EIO;
>
> -       /*
> -        * cpus_read_trylock() is used here to work around a circular lock
> -        * dependency problem with respect to the cpufreq_register_driver().
> -        */
> -       if (!cpus_read_trylock())
> -               return -EBUSY;
> -
> -       if (cpu_online(policy->cpu)) {
> -               down_write(&policy->rwsem);
> -               if (likely(!policy_is_inactive(policy)))
> -                       ret = fattr->store(policy, buf, count);
> -               up_write(&policy->rwsem);
> -       }
> -
> -       cpus_read_unlock();
> +       down_write(&policy->rwsem);
> +       if (likely(!policy_is_inactive(policy)))
> +               ret = fattr->store(policy, buf, count);
> +       up_write(&policy->rwsem);
>
>         return ret;
>  }
> --

Applied along with the [1/3] as 5.20 material, thanks!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ