Linux Power Management development
 help / color / mirror / Atom feed
From: Viresh Kumar <viresh.kumar@linaro.org>
To: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@gmail.com>
Cc: Stephen Boyd <sboyd@codeaurora.org>,
	Waldemar Rymarkiewicz <waldemarx.rymarkiewicz@intel.com>,
	linux-pm@vger.kernel.org, Viresh Kumar <vireshk@kernel.org>,
	Nishanth Menon <nm@ti.com>
Subject: Re: [PATCH] PM / OPP: Don't check not plugged in CPUs to avoid error
Date: Tue, 18 Jul 2017 10:05:36 +0530	[thread overview]
Message-ID: <20170718043536.GT352@vireshk-i7> (raw)
In-Reply-To: <CAHKzcEP5+btsJ1Tog4KQAynmmbBSixfWAxO9V0EFWeP5pP5M=w@mail.gmail.com>

On 17-07-17, 15:03, Waldemar Rymarkiewicz wrote:
> Isn't that cpufreq registers only online CPUs at boot up and will add
> hot-added CPUs later on calling cpufreq_online() ~>

Yes, but its a bit complicated than that.

> cpufreq_driver->init()?

init() is called only once for a cpufreq policy and it should fill
policy->cpus with all the *possible* CPUs that share their
clock/voltage rails. i.e. it includes the CPUs which aren't hotplugged
in yet.

Later on when the CPU gets hotplugged in, we check it in existing
policies ->related_cpus field. If its their, then very minimal stuff
is done, else a new policy is created.

> this calls cpufreq_driver->init() which check for sharing CPUs. If
> that's called for online_cpus only so I guess it's OK to check only
> within online cpus for shared freq_table. If a cpu is plugged in later
>  this is called again, so we can eventually add this cpu to the mask.
> Is this right?
>
> > We will have a problem if we are going to use OPP framework on
> > platforms where CPUs are hotpluggable. The cpumask returned by this
> > function is used by the cpufreq drivers to get the related_cpus mask
> > and that will be used when a cpu is inserted in later on.

And that's why I said this.

> related_cpus bitmask is set in cpufreq_online() too,
> 
>    http://elixir.free-electrons.com/linux/v4.13-rc1/source/drivers/cpufreq/cpufreq.c#L1188
> 
> Policy->cpus is for online CPUs, so where are the offline CPUs added
> to related_cpus mask?

So policy->init() sets policy->cpus to all online+offline CPUs. That
is copied to related_cpus by core and then policy->cpus is capped to
only have online CPUs.
 
> I don't think so there is an up streamed code that uses opp framework
> in such use case. I use MIPS platform which starts with maxcpu=4 but
> it puts 2 cpus offline at boot up for some reason. Will try to check
> how cpufreq behave if I hot-add a CPU in runtime.

Ok.

-- 
viresh

  reply	other threads:[~2017-07-18  4:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20170713122201.30048-1-waldemarx.rymarkiewicz@intel.com>
2017-07-13 23:42 ` [PATCH] PM / OPP: Don't check not plugged in CPUs to avoid error Stephen Boyd
2017-07-17  7:12   ` Viresh Kumar
2017-07-17 13:03     ` Waldemar Rymarkiewicz
2017-07-18  4:35       ` Viresh Kumar [this message]
2017-07-19 14:10         ` Waldemar Rymarkiewicz
2017-07-20  3:31           ` Viresh Kumar
2017-07-20  9:06             ` Waldemar Rymarkiewicz

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=20170718043536.GT352@vireshk-i7 \
    --to=viresh.kumar@linaro.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=nm@ti.com \
    --cc=sboyd@codeaurora.org \
    --cc=vireshk@kernel.org \
    --cc=waldemar.rymarkiewicz@gmail.com \
    --cc=waldemarx.rymarkiewicz@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