linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Lezcano <daniel.lezcano@linaro.org>
To: Viresh Kumar <viresh.kumar@linaro.org>
Cc: rjw@rjwysocki.net, edubezval@gmail.com, kevin.wangtao@linaro.org,
	leo.yan@linaro.org, vincent.guittot@linaro.org,
	linux-kernel@vger.kernel.org, javi.merino@kernel.org,
	rui.zhang@intel.com, linux-pm@vger.kernel.org,
	daniel.thompson@linaro.org
Subject: Re: [PATCH V2] powercap/drivers/idle_injection: Add an idle injection framework
Date: Tue, 15 May 2018 10:01:34 +0200	[thread overview]
Message-ID: <20180515080134.GH29062@mai> (raw)
In-Reply-To: <20180515051241.xdrjj6u4ssqcatvy@vireshk-i7>

On Tue, May 15, 2018 at 10:42:41AM +0530, viresh kumar wrote:
> On 11-05-18, 13:55, Daniel Lezcano wrote:
> > On Fri, May 11, 2018 at 03:02:21PM +0530, viresh kumar wrote:
> > > On 10-05-18, 14:26, Daniel Lezcano wrote:
> > > > +int idle_injection_start(struct idle_injection_device *ii_dev)
> > > > +{
> > > > +	if (!atomic_read(&ii_dev->idle_duration_ms))
> > > > +		return -EINVAL;
> > > > +
> > > > +	if (!atomic_read(&ii_dev->run_duration_ms))
> > > > +		return -EINVAL;
> > > 
> > > You are required to have them as atomic variables to take care of the
> > > races while they are set ? 
> > 
> > The race is when you change the values, while the idle injection is acting and
> > you read those values in the idle injection thread function.
> > 
> > > What about getting the durations as arguments to this routine then ?
> > 
> > May be I missed your point but I don't think that will change the above.
> 
> Well, it can. Can you explain the kind of use-cases you have in mind ?
> 
> For example, what I assumed to be the usecase was:
> 
> idle_injection_start(iidev, idle_duration, run_duration);
> 
> and then at some point of time:
> 
> idle_injection_stop(iidev);
> 
> 
> With this, you would be required to stop the idle injection stuff to
> reconfigure the durations. And then you will never have a race which
> you mentioned above.
> 
> What you are trying to do is something like this:
> 
> idle_injection_set_duration(idle_duration, run_duration);
> idle_injection_start(iidev);
> 
> and then at some point of time:
> idle_injection_set_duration(idle_duration2, run_duration2);

Here potentially hundred of times between a start and a stop, and at a high
rate.
 
> and then at some point of time:
> idle_injection_stop(iidev);
> 
> I am not sure if we would ever want to do something like this. Or if
> stopping the idle injection to start it again is that bad of an idea.

It sounds strange, it is like you change the speed of the car by stopping and
restarting the motor.
 
> > > > +struct idle_injection_device *
> > > > +idle_injection_register(struct cpumask *cpumask, const char *name)
> > > > +{
> > > > +	struct idle_injection_device *ii_dev;
> > > > +	struct smp_hotplug_thread *smp_hotplug_thread;
> > > > +	char *idle_injection_comm;
> > > > +	int cpu, ret;
> > > > +
> > > > +	ret = -ENOMEM;
> > > 
> > > Maybe merge it earlier only ?
> > 
> > What do you mean ? int ret = -ENOMEM ?
> 
> Yes.

Ok.

-- 

 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

  reply	other threads:[~2018-05-15  8:01 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-10 10:34 [PATCH] powercap/drivers/idle_injection: Add an idle injection framework Daniel Lezcano
2018-05-10 12:26 ` [PATCH V2] " Daniel Lezcano
2018-05-11  9:32   ` Viresh Kumar
2018-05-11 11:55     ` Daniel Lezcano
2018-05-15  5:12       ` Viresh Kumar
2018-05-15  8:01         ` Daniel Lezcano [this message]
2018-05-11  6:11 ` [PATCH] " kbuild test robot

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=20180515080134.GH29062@mai \
    --to=daniel.lezcano@linaro.org \
    --cc=daniel.thompson@linaro.org \
    --cc=edubezval@gmail.com \
    --cc=javi.merino@kernel.org \
    --cc=kevin.wangtao@linaro.org \
    --cc=leo.yan@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=rui.zhang@intel.com \
    --cc=vincent.guittot@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).