From: "Gautham R. Shenoy" <ego@linux.vnet.ibm.com>
To: Shilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com>,
viresh.kumar@linaro.org, rjw@rjwysocki.net,
huntbag@linux.vnet.ibm.com, akshay.adiga@linux.vnet.ibm.com,
Michael Ellerman <mpe@ellerman.id.au>,
Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com>,
Balbir Singh <bsingharora@gmail.com>
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
linuxppc-dev@lists.ozlabs.org,
"Gautham R. Shenoy" <ego@linux.vnet.ibm.com>
Subject: [v3 PATCH 0/3] powernv-cpufreq: Multiple pstate related fixes.
Date: Wed, 13 Dec 2017 12:27:38 +0530 [thread overview]
Message-ID: <1513148261-21097-1-git-send-email-ego@linux.vnet.ibm.com> (raw)
From: "Gautham R. Shenoy" <ego@linux.vnet.ibm.com>
This is a third version of the patch to fix pstate related issues in
the powernv-cpufreq driver.
The previous versions can be found here:
[v2]: https://lkml.org/lkml/2017/12/7/1562
[v1]: https://lkml.org/lkml/2017/11/29/1338
On POWERNV platform, Pstates are 8-bit values. On POWER8 they are
negatively numbered while on POWER9 they are positively
numbered. Thus, on POWER9, the maximum number of pstates could be as
high as 256.
In multiple places, the current code interprets pstates as a signed
8-bit value which subsequently gets assigned to a signed integer
variable. This causes a problem on POWER9 platforms which have more
than 128 pstates. On such systems, on a CPU that is in a lower
pstate whose number is greater than 128, querying the current pstate
via the pstate_to_idx() returns a "pstate X is out of bound" error
message and the current pstate is reported as the nominal
pstate. This is due to the manner in which the bounds are checked in
pstate_to_idx which again depends on the sign of pstates and whether
the pstates max to min are monotonically increasing or decreasing.
Further the current code makes a couple of assumptions which is not
guaranteed by the device-tree bindings:
1) Pstate ids are continguous.
2) Every Pstate should always lie between the max and the min
pstates that are explicitly reported in the device tree.
Both these assumptions are unwarranted and can change on future
platforms.
In this patch-series, we fix the implementation via the following
changes:
PATCH 1: Define a helper function to correctly extract the pstates
from the PMCR and take care of any sign extentions. This is
an immediate fix to add the ability to handle more than 128
pstates on POWER9 systems.
PATCH 2: Define a hash-map which will return the index into the
cpufreq frequency table for a given pstate. Use this hashmap
in the implementation of pstate_to_idx(). This does away with
the assumptions (1) mentioned above, and will work with non
continguous pstate ids. If no entry exists for a particular
pstate, then such a pstate is treated as being out of
bounds. This gets rid of assumption (2).
PATCH 3: Treat pstates as opaque 8-bit values consistent with the
definitions in the PMSR and PMCR. We no longer need any
sign-extentions nor do we require to interpret the sign of
the pstates anywhere in the code.
Gautham R. Shenoy (3):
powernv-cpufreq: Add helper to extract pstate from PMSR
powernv-cpufreq: Fix pstate_to_idx() to handle non-continguous pstates
powernv-cpufreq: Treat pstates as opaque 8-bit values
drivers/cpufreq/powernv-cpufreq.c | 139 ++++++++++++++++++++++++--------------
1 file changed, 90 insertions(+), 49 deletions(-)
--
1.9.4
next reply other threads:[~2017-12-13 6:58 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-13 6:57 Gautham R. Shenoy [this message]
2017-12-13 6:57 ` [v3 PATCH 1/3] powernv-cpufreq: Add helper to extract pstate from PMSR Gautham R. Shenoy
2017-12-17 3:04 ` Balbir Singh
2017-12-18 9:03 ` Gautham R Shenoy
2017-12-13 6:57 ` [v3 PATCH 2/3] powernv-cpufreq: Fix pstate_to_idx() to handle non-continguous pstates Gautham R. Shenoy
2017-12-17 3:15 ` Balbir Singh
2017-12-18 8:38 ` Gautham R Shenoy
2018-01-03 12:07 ` Rafael J. Wysocki
2018-01-03 12:47 ` Balbir Singh
2018-01-10 8:55 ` Gautham R Shenoy
2018-01-10 12:00 ` Rafael J. Wysocki
2017-12-13 6:57 ` [v3 PATCH 3/3] powernv-cpufreq: Treat pstates as opaque 8-bit values Gautham R. Shenoy
2017-12-17 3:17 ` Balbir Singh
2017-12-18 8:43 ` Gautham R Shenoy
2018-01-10 9:43 ` [v3 PATCH 0/3] powernv-cpufreq: Multiple pstate related fixes 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=1513148261-21097-1-git-send-email-ego@linux.vnet.ibm.com \
--to=ego@linux.vnet.ibm.com \
--cc=akshay.adiga@linux.vnet.ibm.com \
--cc=bsingharora@gmail.com \
--cc=huntbag@linux.vnet.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
--cc=rjw@rjwysocki.net \
--cc=shilpa.bhat@linux.vnet.ibm.com \
--cc=svaidy@linux.vnet.ibm.com \
--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).