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]
Date:   Mon, 8 Jul 2019 16:13:02 +0200
From:   Pavel Machek <pavel@....cz>
To:     Viresh Kumar <viresh.kumar@...aro.org>
Cc:     "Rafael J. Wysocki" <rafael@...nel.org>,
        Matthias Kaehlcke <mka@...omium.org>,
        Ulf Hansson <ulf.hansson@...aro.org>,
        "Rafael J. Wysocki" <rjw@...ysocki.net>,
        Linux-pm mailing list <linux-pm@...r.kernel.org>,
        kernel list <linux-kernel@...r.kernel.org>,
        Stephen Rothwell <sfr@...b.auug.org.au>
Subject: Re: cpufreq notifiers break suspend -- Re: suspend broken in
 next-20190704 on Thinkpad X60

On Mon 2019-07-08 14:58:40, Viresh Kumar wrote:
> On 08-07-19, 10:28, Rafael J. Wysocki wrote:
> > Pavel has tested the latest version of the patch series AFAICS.
> > 
> > The locking added by the commit in question to
> > refresh_frequency_limits() requires an update of
> > cpufreq_update_policy(), or it will deadlock in there because of the
> > lock acquired by cpufreq_cpu_get() if I haven't missed anything.
> 
> Ah, looks quite straight forward.
> 
> @Pavel: Can you please try this diff ?

I tried to apply it on top of current next
(d58b5ab90ee7528126fd5833df7fc5bda8331ce8, 20190708) and linux-pm-next
(1e2a4c9019eb53f62790fadf86c14a54f4cf4888), but failed due to
whitespace (?!).

Yes, symptoms would be consistent with deadlock on resume.

And yes, the patch seems to fix problem for me.

Tested-by: Pavel Machek <pavel@....cz>
									Pavel

> -------------------------8<-------------------------
> 
> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> index 9f68d0f306b8..4d6043ee7834 100644
> --- a/drivers/cpufreq/cpufreq.c
> +++ b/drivers/cpufreq/cpufreq.c
> @@ -1109,16 +1109,12 @@ void refresh_frequency_limits(struct cpufreq_policy *policy)
>  {
>         struct cpufreq_policy new_policy;
>  
> -       down_write(&policy->rwsem);
> -
>         if (!policy_is_inactive(policy)) {
>                 new_policy = *policy;
>                 pr_debug("updating policy for CPU %u\n", policy->cpu);
>  
>                 cpufreq_set_policy(policy, &new_policy);
>         }
> -
> -       up_write(&policy->rwsem);
>  }
>  EXPORT_SYMBOL(refresh_frequency_limits);
>  
> @@ -1128,7 +1124,9 @@ static void handle_update(struct work_struct *work)
>                 container_of(work, struct cpufreq_policy, update);
>  
>         pr_debug("handle_update for cpu %u called\n", policy->cpu);
> +       down_write(&policy->rwsem);
>         refresh_frequency_limits(policy);
> +       up_write(&policy->rwsem);
>  }
>  
> -------------------------8<-------------------------
> 
> Though it makes me wonder why I didn't hit this thing. I was using the
> cpu_cooling device the other day, which calls cpufreq_update_policy()
> very frequently on heat-up. And I had a hair dryer blowing over my
> board to heat it up. Lemme check that again :)

Can you test on some x86 ACPI? No dryers needed :-).

> @Rafael: You want me to send a new diff patch with Fixes tag this time
> if this works out fine ?



									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

Download attachment "signature.asc" of type "application/pgp-signature" (182 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ