linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rafael@kernel.org>
To: Viresh Kumar <viresh.kumar@linaro.org>
Cc: Pavel Machek <pavel@ucw.cz>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Matthias Kaehlcke <mka@chromium.org>,
	Ulf Hansson <ulf.hansson@linaro.org>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Linux-pm mailing list <linux-pm@vger.kernel.org>,
	kernel list <linux-kernel@vger.kernel.org>,
	Stephen Rothwell <sfr@canb.auug.org.au>
Subject: Re: cpufreq notifiers break suspend -- Re: suspend broken in next-20190704 on Thinkpad X60
Date: Mon, 8 Jul 2019 12:47:54 +0200	[thread overview]
Message-ID: <CAJZ5v0gHNNkcYk5bV-oHDyxmrP=c7G_-bPZd5KXwHTo2oTDHnA@mail.gmail.com> (raw)
In-Reply-To: <20190708092840.ynibtrntval6krc4@vireshk-i7>

On Mon, Jul 8, 2019 at 11:28 AM Viresh Kumar <viresh.kumar@linaro.org> 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 ?
>
> -------------------------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 :)
>
> @Rafael: You want me to send a new diff patch with Fixes tag this time
> if this works out fine ?

I would prefer the original patch to be updated to avoid possible
bisection woes in the future.

  reply	other threads:[~2019-07-08 10:48 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-04 19:20 suspend broken in next-20190704 on Thinkpad X60 Pavel Machek
2019-07-04 22:59 ` Rafael J. Wysocki
2019-07-05 18:50   ` Pavel Machek
2019-07-06  8:33     ` Rafael J. Wysocki
2019-07-06 15:16       ` Pavel Machek
2019-07-06 15:32       ` Pavel Machek
2019-07-06 19:01       ` Pavel Machek
2019-07-06 20:30       ` cpufreq notifiers break suspend -- " Pavel Machek
2019-07-08  3:05         ` Viresh Kumar
2019-07-08  8:28           ` Rafael J. Wysocki
2019-07-08  9:28             ` Viresh Kumar
2019-07-08 10:47               ` Rafael J. Wysocki [this message]
2019-07-08 14:13               ` Pavel Machek
2019-07-09  7:26                 ` Viresh Kumar

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='CAJZ5v0gHNNkcYk5bV-oHDyxmrP=c7G_-bPZd5KXwHTo2oTDHnA@mail.gmail.com' \
    --to=rafael@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mka@chromium.org \
    --cc=pavel@ucw.cz \
    --cc=rjw@rjwysocki.net \
    --cc=sfr@canb.auug.org.au \
    --cc=ulf.hansson@linaro.org \
    --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;
as well as URLs for NNTP newsgroup(s).