linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Viresh Kumar <viresh.kumar@linaro.org>
To: "Joel Fernandes (Google)" <joel.opensrc@gmail.com>
Cc: Rafael Wysocki <rjw@rjwysocki.net>,
	Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>,
	Len Brown <lenb@kernel.org>, Ingo Molnar <mingo@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	linux-pm@vger.kernel.org,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	smuckle.linux@gmail.com, eas-dev@lists.linaro.org,
	Joel Fernandes <joelaf@google.com>
Subject: Re: [Eas-dev] [PATCH V4 1/3] sched: cpufreq: Allow remote cpufreq callbacks
Date: Thu, 27 Jul 2017 12:44:41 +0530	[thread overview]
Message-ID: <20170727071441.GL352@vireshk-i7> (raw)
In-Reply-To: <CAEi0qNnYANJ9qNAnh3H4F5igXvHhT8ujoVH3JjMgr_1aBvvcRg@mail.gmail.com>

On 26-07-17, 23:13, Joel Fernandes (Google) wrote:
> On Wed, Jul 26, 2017 at 10:50 PM, Viresh Kumar <viresh.kumar@linaro.org> wrote:
> > On 26-07-17, 22:34, Joel Fernandes (Google) wrote:
> >> On Wed, Jul 26, 2017 at 2:22 AM, Viresh Kumar <viresh.kumar@linaro.org> wrote:
> >> > @@ -221,7 +226,7 @@ static void sugov_update_single(struct update_util_data *hook, u64 time,
> >> >         sugov_set_iowait_boost(sg_cpu, time, flags);
> >> >         sg_cpu->last_update = time;
> >> >
> >> > -       if (!sugov_should_update_freq(sg_policy, time))
> >> > +       if (!sugov_should_update_freq(sg_policy, time, hook->cpu))
> >> >                 return;
> >>
> >> Since with the remote callbacks now possible, isn't it unsafe to
> >> modify sg_cpu and sg_policy structures without a lock in
> >> sugov_update_single?
> >>
> >> Unlike sugov_update_shared, we don't acquire any lock in
> >> sugov_update_single before updating these structures. Did I miss
> >> something?
> >
> > As Peter already mentioned it earlier, the callbacks are called with
> > rq locks held and so sugov_update_single() wouldn't get called in
> > parallel for a target CPU.
> 
> Ah ok, I have to catch up with that discussion since I missed the
> whole thing. Now that you will have me on CC, that shouldn't happen,
> thanks and sorry about the noise.
> 
> > That's the only race you were worried about ?
> 
> Yes. So then in that case, makes sense to move raw_spin_lock in
> sugov_update_shared further down? (Just discussing, this point is
> independent of your patch), Something like:

Even that was discussed tomorrow with Peter :)

No it wouldn't work because sg_cpu->util we are updating here may be
getting read from some other cpu that shares policy with sg_cpu.

-- 
viresh

  reply	other threads:[~2017-07-27  7:14 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-26  9:22 [PATCH V4 0/3] sched: cpufreq: Allow remote callbacks Viresh Kumar
2017-07-26  9:22 ` [PATCH V4 1/3] sched: cpufreq: Allow remote cpufreq callbacks Viresh Kumar
2017-07-26 17:42   ` Rafael J. Wysocki
2017-07-27  3:23     ` Viresh Kumar
2017-07-27  5:34   ` [Eas-dev] " Joel Fernandes (Google)
2017-07-27  5:50     ` Viresh Kumar
2017-07-27  6:13       ` Joel Fernandes (Google)
2017-07-27  7:14         ` Viresh Kumar [this message]
2017-07-27  9:10           ` Peter Zijlstra
2017-07-28  3:34           ` Joel Fernandes (Google)
2017-07-27  9:56   ` Peter Zijlstra
2017-07-26  9:22 ` [PATCH V4 2/3] cpufreq: schedutil: Process remote callback for shared policies Viresh Kumar
2017-07-27  5:49   ` [Eas-dev] " Joel Fernandes (Google)
2017-07-26  9:22 ` [PATCH V4 3/3] cpufreq: governor: " Viresh Kumar
2017-07-27  5:14 ` [Eas-dev] [PATCH V4 0/3] sched: cpufreq: Allow remote callbacks Joel Fernandes (Google)
2017-07-27  5:46   ` Viresh Kumar
2017-07-27  6:23     ` Joel Fernandes (Google)
2017-07-27  7:19       ` Viresh Kumar
2017-07-27  7:21       ` Juri Lelli
2017-07-28  3:44         ` Joel Fernandes (Google)

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=20170727071441.GL352@vireshk-i7 \
    --to=viresh.kumar@linaro.org \
    --cc=eas-dev@lists.linaro.org \
    --cc=joel.opensrc@gmail.com \
    --cc=joelaf@google.com \
    --cc=lenb@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rjw@rjwysocki.net \
    --cc=smuckle.linux@gmail.com \
    --cc=srinivas.pandruvada@linux.intel.com \
    /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).