Linux Power Management development
 help / color / mirror / Atom feed
From: Viresh Kumar <viresh.kumar@linaro.org>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Rafael Wysocki <rjw@rjwysocki.net>,
	Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>,
	Len Brown <lenb@kernel.org>, Ingo Molnar <mingo@redhat.com>,
	linux-pm@vger.kernel.org,
	Vincent Guittot <vincent.guittot@linaro.org>,
	smuckle.linux@gmail.com, juri.lelli@arm.com,
	Morten.Rasmussen@arm.com, patrick.bellasi@arm.com,
	eas-dev@lists.linaro.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH V3 1/3] sched: cpufreq: Allow remote cpufreq callbacks
Date: Mon, 24 Jul 2017 16:31:22 +0530	[thread overview]
Message-ID: <20170724110122.GX352@vireshk-i7> (raw)
In-Reply-To: <20170721130349.mv7soic62jdnirq5@hirez.programming.kicks-ass.net>

On 21-07-17, 15:03, Peter Zijlstra wrote:
> On Thu, Jul 13, 2017 at 12:14:37PM +0530, Viresh Kumar wrote:

> > @@ -42,6 +42,7 @@ void cpufreq_add_update_util_hook(int cpu, struct update_util_data *data,
> >  		return;
> >  
> >  	data->func = func;
> > +	data->cpu = cpu;
> >  	rcu_assign_pointer(per_cpu(cpufreq_update_util_data, cpu), data);
> >  }
> >  EXPORT_SYMBOL_GPL(cpufreq_add_update_util_hook);
> 
> redundant.

Actually we will still need it. We pass hook->cpu to sugov_get_util()
in the 2nd patch of this series and there is no work around possible
around that.

> > diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c
> > index 29a397067ffa..ed9c589e5386 100644
> > --- a/kernel/sched/cpufreq_schedutil.c
> > +++ b/kernel/sched/cpufreq_schedutil.c
> > @@ -218,6 +218,10 @@ static void sugov_update_single(struct update_util_data *hook, u64 time,
> >  	unsigned int next_f;
> >  	bool busy;
> >  
> > +	/* Remote callbacks aren't allowed for policies which aren't shared */
> > +	if (smp_processor_id() != hook->cpu)
> > +		return;
> > +
> >  	sugov_set_iowait_boost(sg_cpu, time, flags);
> >  	sg_cpu->last_update = time;
> >  
> > @@ -290,6 +294,10 @@ static void sugov_update_shared(struct update_util_data *hook, u64 time,
> >  	unsigned long util, max;
> >  	unsigned int next_f;
> >  
> > +	/* Don't allow remote callbacks */
> > +	if (smp_processor_id() != hook->cpu)
> > +		return;
> > +
> >  	sugov_get_util(&util, &max);
> >  
> >  	raw_spin_lock(&sg_policy->update_lock);
> 
> 
> Given the whole rq->lock thing, I suspect we could actually not do these
> two.

You meant sugov_get_util() and raw_spin_lock()? Why?

The locking is required here in the shared-policy case to make sure
only one CPU is updating the frequency for the entire policy. And we
can't really avoid that even with the rq->lock guarantees from the
scheduler for the target CPU. 

> That would then continue to process the iowait and other accounting
> stuff, but stall the moment we call into the actual driver, which will
> then drop the request on the floor as per the first few hunks.

I am not sure I understood your comment completely though.

> This seems ok. Except of course you'll have conflicts with Juri's patch
> set, but that should be trivial to sort out.

Yeah, I wouldn't mind rebasing if his series gets in first.

-- 
viresh

  reply	other threads:[~2017-07-24 11:01 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-13  6:44 [PATCH V3 0/3] sched: cpufreq: Allow remote callbacks Viresh Kumar
2017-07-13  6:44 ` [PATCH V3 1/3] sched: cpufreq: Allow remote cpufreq callbacks Viresh Kumar
2017-07-21 13:03   ` Peter Zijlstra
2017-07-24 11:01     ` Viresh Kumar [this message]
2017-07-24 13:47       ` Peter Zijlstra
2017-07-26  6:29         ` Viresh Kumar
2017-07-26  8:12           ` Peter Zijlstra
2017-07-26 17:26           ` Rafael J. Wysocki
2017-07-26 21:00     ` [Eas-dev] " Saravana Kannan
2017-07-27  3:30       ` Viresh Kumar
2017-07-27 19:55         ` Saravana Kannan
2017-07-28  4:33           ` Joel Fernandes (Google)
2017-07-28  6:00           ` Viresh Kumar
2017-07-28 21:05             ` Saravana Kannan
2017-07-31  3:58               ` Viresh Kumar
2017-07-13  6:44 ` [PATCH V3 2/3] cpufreq: schedutil: Process remote callback for shared policies Viresh Kumar
2017-07-14  2:02   ` [Eas-dev] " Saravana Kannan
2017-07-14  5:03     ` Viresh Kumar
2017-07-20 13:58       ` Peter Zijlstra
2017-07-20 12:22     ` Peter Zijlstra
2017-07-20 15:11       ` Sudeep Holla
2017-07-26 20:56       ` Saravana Kannan
2017-07-13  6:44 ` [PATCH V3 3/3] cpufreq: governor: " Viresh Kumar
2017-07-13 15:17 ` [PATCH V3 0/3] sched: cpufreq: Allow remote callbacks Rafael J. Wysocki

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=20170724110122.GX352@vireshk-i7 \
    --to=viresh.kumar@linaro.org \
    --cc=Morten.Rasmussen@arm.com \
    --cc=eas-dev@lists.linaro.org \
    --cc=juri.lelli@arm.com \
    --cc=lenb@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=patrick.bellasi@arm.com \
    --cc=peterz@infradead.org \
    --cc=rjw@rjwysocki.net \
    --cc=smuckle.linux@gmail.com \
    --cc=srinivas.pandruvada@linux.intel.com \
    --cc=vincent.guittot@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