From: Gautham R. Shenoy <hidden> Date: 2017-12-13 06:58:29
From: "Gautham R. Shenoy" <redacted>
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
From: Gautham R. Shenoy <hidden> Date: 2017-12-13 06:58:02
From: "Gautham R. Shenoy" <redacted>
On POWER8 and POWER9, the PMSR and the PMCR registers define pstates
to be 8-bit wide values. The device-tree exports pstates as 32-bit
wide values of which the lower byte is the actual pstate.
The current implementation in the kernel treats pstates as integer
type, since it used to use the sign of the pstate for performing some
boundary-checks. This is no longer required after the patch
"powernv-cpufreq: Fix pstate_to_idx() to handle non-continguous
pstates".
So, in this patch, we modify the powernv-cpufreq driver to uniformly
treat pstates as opaque 8-bit values obtained from the device-tree or
the PMCR. This simplifies the extract_pstate() helper function since
we no longer no longer require to worry about the sign-extentions.
Signed-off-by: Gautham R. Shenoy <redacted>
---
drivers/cpufreq/powernv-cpufreq.c | 47 ++++++++++++++++-----------------------
1 file changed, 19 insertions(+), 28 deletions(-)
@@ -194,7 +188,7 @@ static inline int extract_pstate(u64 pmsr_val, unsigned int shift)*If@iisoutofbound,thiswillreturnthepstate*correspondingtothenominalfrequency.*/-staticinlineintidx_to_pstate(unsignedinti)+staticinlineu8idx_to_pstate(unsignedinti){if(unlikely(i>=powernv_pstate_info.nr_pstates)){pr_warn_once("idx_to_pstate: index %u is out of bound\n",i);
@@ -213,7 +207,7 @@ static inline int idx_to_pstate(unsigned int i)*thiswillreturntheindexofthenominal*frequency.*/-staticunsignedintpstate_to_idx(intpstate)+staticunsignedintpstate_to_idx(u8pstate){unsignedintkey=pstate%POWERNV_MAX_PSTATES;structpstate_idx_revmap_data*revmap_data;
@@ -223,7 +217,7 @@ static unsigned int pstate_to_idx(int pstate)returnrevmap_data->cpufreq_table_idx;}-pr_warn_once("pstate_to_idx: pstate %d not found\n",pstate);+pr_warn_once("pstate_to_idx: pstate 0x%x not found\n",pstate);returnpowernv_pstate_info.nominal;}
@@ -291,7 +285,7 @@ static int init_powernv_pstates(void)powernv_pstate_info.wof_enabled=true;next:-pr_info("cpufreq pstate min %d nominal %d max %d\n",pstate_min,+pr_info("cpufreq pstate min 0x%x nominal 0x%x max 0x%x\n",pstate_min,pstate_nominal,pstate_max);pr_info("Workload Optimized Frequency is %s in the platform\n",(powernv_pstate_info.wof_enabled)?"enabled":"disabled");
@@ -323,8 +317,6 @@ static int init_powernv_pstates(void)powernv_pstate_info.nr_pstates=nr_pstates;pr_debug("NR PStates %d\n",nr_pstates);-pstate_sign_prefix=pstate_min&~0xFF;-for(i=0;i<nr_pstates;i++){u32id=be32_to_cpu(pstate_ids[i]);u32freq=be32_to_cpu(pstate_freqs[i]);
@@ -333,14 +325,14 @@ static int init_powernv_pstates(void)pr_debug("PState id %d freq %d MHz\n",id,freq);powernv_freqs[i].frequency=freq*1000;/* kHz */-powernv_freqs[i].driver_data=id;+powernv_freqs[i].driver_data=id&0xFF;revmap_data=(structpstate_idx_revmap_data*)kmalloc(sizeof(*revmap_data),GFP_KERNEL);-revmap_data->pstate_id=id;+revmap_data->pstate_id=id&0xFF;revmap_data->cpufreq_table_idx=i;-key=id%POWERNV_MAX_PSTATES;+key=(revmap_data->pstate_id)%POWERNV_MAX_PSTATES;hash_add(pstate_revmap,&revmap_data->hentry,key);if(id==pstate_max)
@@ -364,14 +356,13 @@ static int init_powernv_pstates(void)}/* Returns the CPU frequency corresponding to the pstate_id. */-staticunsignedintpstate_id_to_freq(intpstate_id)+staticunsignedintpstate_id_to_freq(u8pstate_id){inti;i=pstate_to_idx(pstate_id);if(i>=powernv_pstate_info.nr_pstates||i<0){-pr_warn("PState id %d outside of PState table, "-"reporting nominal id %d instead\n",+pr_warn("PState id 0x%x outside of PState table, reporting nominal id 0x%x instead\n",pstate_id,idx_to_pstate(powernv_pstate_info.nominal));i=powernv_pstate_info.nominal;}
@@ -477,8 +468,8 @@ static inline void set_pmspr(unsigned long sprn, unsigned long val)*/structpowernv_smp_call_data{unsignedintfreq;-intpstate_id;-intgpstate_id;+u8pstate_id;+u8gpstate_id;};/*
@@ -579,7 +570,7 @@ static void powernv_cpufreq_throttle_check(void *data)gotonext;chip->throttled=true;if(pmsr_pmax_idx>powernv_pstate_info.nominal){-pr_warn_once("CPU %d on Chip %u has Pmax(%d) reduced below nominal frequency(%d)\n",+pr_warn_once("CPU %d on Chip %u has Pmax(0x%x) reduced below that of nominal frequency(0x%x)\n",cpu,chip->id,pmsr_pmax,idx_to_pstate(powernv_pstate_info.nominal));chip->throttle_sub_turbo++;
From: Gautham R. Shenoy <hidden> Date: 2017-12-13 06:58:05
From: "Gautham R. Shenoy" <redacted>
On POWERNV platform, the fields for pstates in the Power Management
Status Register (PMSR) and the Power Management Control Register
(PMCR) are 8-bits wide. On POWER8 the pstates are negatively numbered
while on POWER9 they are positively numbered.
The device-tree exports pstates as 32-bit entries. The device-tree
implementation sign-extends the 8-bit pstate values to obtain the
corresponding 32-bit entry.
Eg: On POWER8, a pstate value 0x82 [-126] is represented in the
device-tree as 0xfffffff82 while on POWER9, the same value 0x82 [130]
is represented in the device-tree as 0x00000082.
The powernv-cpufreq driver implementation represents pstates using the
integer type. In multiple places in the driver, the code interprets
the pstates extracted from the PMSR as a signed byte and assigns it to
a integer variable to get the sign-extention.
On POWER9 platforms which have greater than 128 pstates, this results
in the driver performing incorrect sign-extention, and thereby
treating a legitimate pstate (say 130) as an invalid pstates (since it
is interpreted as -126).
This patch fixes the issue by implementing a helper function to
extract Pstates from PMSR register, and correctly sign-extend it to be
consistent with the values provided by the device-tree.
Signed-off-by: Gautham R. Shenoy <redacted>
---
drivers/cpufreq/powernv-cpufreq.c | 37 +++++++++++++++++++++++--------------
1 file changed, 23 insertions(+), 14 deletions(-)
@@ -148,6 +147,20 @@ enum throttle_reason_type {boolwof_enabled;}powernv_pstate_info;+staticinlineintextract_pstate(u64pmsr_val,unsignedintshift)+{+intret=((pmsr_val>>shift)&0xFF);++if(!ret)+returnret;++return(pstate_sign_prefix|ret);+}++#define extract_local_pstate(x) extract_pstate(x, LPSTATE_SHIFT)+#define extract_global_pstate(x) extract_pstate(x, GPSTATE_SHIFT)+#define extract_max_pstate(x) extract_pstate(x, MAX_PSTATE_SHIFT)+/* Use following macros for conversions between pstate_id and index */staticinlineintidx_to_pstate(unsignedinti){
@@ -278,6 +291,9 @@ static int init_powernv_pstates(void)powernv_pstate_info.nr_pstates=nr_pstates;pr_debug("NR PStates %d\n",nr_pstates);++pstate_sign_prefix=pstate_min&~0xFF;+for(i=0;i<nr_pstates;i++){u32id=be32_to_cpu(pstate_ids[i]);u32freq=be32_to_cpu(pstate_freqs[i]);
From: Gautham R. Shenoy <hidden> Date: 2017-12-13 06:58:31
From: "Gautham R. Shenoy" <redacted>
The code in powernv-cpufreq, makes the following two assumptions which
are not guaranteed by the device-tree bindings:
1) Pstate ids are continguous: This is used in pstate_to_idx() to
obtain the reverse map from a pstate to it's corresponding
entry into the cpufreq frequency table.
2) Every Pstate should always lie between the max and the min
pstates that are explicitly reported in the device tree: This
is used to determine whether a pstate reported by the PMSR is
out of bounds.
Both these assumptions are unwarranted and can change on future
platforms.
In this patch, we maintain the reverse map from a pstate to it's index
in the cpufreq frequency table and use this in 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).
On all the existing platforms, where the pstates are 8-bit long
values, the new implementation of pstate_to_idx() takes constant time.
Signed-off-by: Gautham R. Shenoy <redacted>
---
drivers/cpufreq/powernv-cpufreq.c | 85 +++++++++++++++++++++++++++++----------
1 file changed, 63 insertions(+), 22 deletions(-)
@@ -161,39 +184,47 @@ static inline int extract_pstate(u64 pmsr_val, unsigned int shift)#define extract_global_pstate(x) extract_pstate(x, GPSTATE_SHIFT)#define extract_max_pstate(x) extract_pstate(x, MAX_PSTATE_SHIFT)-/* Use following macros for conversions between pstate_id and index */+/* Use following functions for conversions between pstate_id and index */++/**+*idx_to_pstate:Returnsthepstateidcorrespondingtothe+*frequencyinthecpufreqfrequencytable+*powernv_freqsindexedby@i.+*+*If@iisoutofbound,thiswillreturnthepstate+*correspondingtothenominalfrequency.+*/staticinlineintidx_to_pstate(unsignedinti){if(unlikely(i>=powernv_pstate_info.nr_pstates)){-pr_warn_once("index %u is out of bound\n",i);+pr_warn_once("idx_to_pstate: index %u is out of bound\n",i);returnpowernv_freqs[powernv_pstate_info.nominal].driver_data;}returnpowernv_freqs[i].driver_data;}-staticinlineunsignedintpstate_to_idx(intpstate)+/**+*pstate_to_idx:Returnstheindexinthecpufreqfrequencytable+*powernv_freqsforthefrequencywhosecorresponding+*pstateidis@pstate.+*+*Ifnofrequencycorrespondingto@pstateisfound,+*thiswillreturntheindexofthenominal+*frequency.+*/+staticunsignedintpstate_to_idx(intpstate){-intmin=powernv_freqs[powernv_pstate_info.min].driver_data;-intmax=powernv_freqs[powernv_pstate_info.max].driver_data;+unsignedintkey=pstate%POWERNV_MAX_PSTATES;+structpstate_idx_revmap_data*revmap_data;-if(min>0){-if(unlikely((pstate<max)||(pstate>min))){-pr_warn_once("pstate %d is out of bound\n",pstate);-returnpowernv_pstate_info.nominal;-}-}else{-if(unlikely((pstate>max)||(pstate<min))){-pr_warn_once("pstate %d is out of bound\n",pstate);-returnpowernv_pstate_info.nominal;-}+hash_for_each_possible(pstate_revmap,revmap_data,hentry,key){+if(revmap_data->pstate_id==pstate)+returnrevmap_data->cpufreq_table_idx;}-/*-*abs()isdeliberatelyusedsothatisworkswith-*bothmonotonicallyincreasinganddecreasing-*pstatevalues-*/-returnabs(pstate-idx_to_pstate(powernv_pstate_info.max));++pr_warn_once("pstate_to_idx: pstate %d not found\n",pstate);+returnpowernv_pstate_info.nominal;}staticinlinevoidreset_gpstates(structcpufreq_policy*policy)
@@ -297,11 +328,21 @@ static int init_powernv_pstates(void)for(i=0;i<nr_pstates;i++){u32id=be32_to_cpu(pstate_ids[i]);u32freq=be32_to_cpu(pstate_freqs[i]);+structpstate_idx_revmap_data*revmap_data;+unsignedintkey;pr_debug("PState id %d freq %d MHz\n",id,freq);powernv_freqs[i].frequency=freq*1000;/* kHz */powernv_freqs[i].driver_data=id;+revmap_data=(structpstate_idx_revmap_data*)+kmalloc(sizeof(*revmap_data),GFP_KERNEL);++revmap_data->pstate_id=id;+revmap_data->cpufreq_table_idx=i;+key=id%POWERNV_MAX_PSTATES;+hash_add(pstate_revmap,&revmap_data->hentry,key);+if(id==pstate_max)powernv_pstate_info.max=i;elseif(id==pstate_nominal)
On Wed, Dec 13, 2017 at 5:57 PM, Gautham R. Shenoy
[off-list ref] wrote:
From: "Gautham R. Shenoy" <redacted>
On POWERNV platform, the fields for pstates in the Power Management
Status Register (PMSR) and the Power Management Control Register
(PMCR) are 8-bits wide. On POWER8 the pstates are negatively numbered
while on POWER9 they are positively numbered.
The device-tree exports pstates as 32-bit entries. The device-tree
implementation sign-extends the 8-bit pstate values to obtain the
corresponding 32-bit entry.
Eg: On POWER8, a pstate value 0x82 [-126] is represented in the
device-tree as 0xfffffff82 while on POWER9, the same value 0x82 [130]
is represented in the device-tree as 0x00000082.
The powernv-cpufreq driver implementation represents pstates using the
integer type. In multiple places in the driver, the code interprets
the pstates extracted from the PMSR as a signed byte and assigns it to
a integer variable to get the sign-extention.
On POWER9 platforms which have greater than 128 pstates, this results
in the driver performing incorrect sign-extention, and thereby
treating a legitimate pstate (say 130) as an invalid pstates (since it
is interpreted as -126).
This patch fixes the issue by implementing a helper function to
extract Pstates from PMSR register, and correctly sign-extend it to be
consistent with the values provided by the device-tree.
Signed-off-by: Gautham R. Shenoy <redacted>
---
This looks better
Acked-by: Balbir Singh <bsingharora@gmail.com>
Balbir Singh
On Wed, Dec 13, 2017 at 5:57 PM, Gautham R. Shenoy
[off-list ref] wrote:
From: "Gautham R. Shenoy" <redacted>
The code in powernv-cpufreq, makes the following two assumptions which
are not guaranteed by the device-tree bindings:
1) Pstate ids are continguous: This is used in pstate_to_idx() to
obtain the reverse map from a pstate to it's corresponding
entry into the cpufreq frequency table.
2) Every Pstate should always lie between the max and the min
pstates that are explicitly reported in the device tree: This
is used to determine whether a pstate reported by the PMSR is
out of bounds.
Both these assumptions are unwarranted and can change on future
platforms.
While this is a good thing, I wonder if it is worth the complexity. Pstates
are contiguous because they define transitions in incremental value
of change in frequency and I can't see how this can be broken in the
future?
Balbir Singh.
On Wed, Dec 13, 2017 at 5:57 PM, Gautham R. Shenoy
[off-list ref] wrote:
quoted hunk
From: "Gautham R. Shenoy" <redacted>
On POWER8 and POWER9, the PMSR and the PMCR registers define pstates
to be 8-bit wide values. The device-tree exports pstates as 32-bit
wide values of which the lower byte is the actual pstate.
The current implementation in the kernel treats pstates as integer
type, since it used to use the sign of the pstate for performing some
boundary-checks. This is no longer required after the patch
"powernv-cpufreq: Fix pstate_to_idx() to handle non-continguous
pstates".
So, in this patch, we modify the powernv-cpufreq driver to uniformly
treat pstates as opaque 8-bit values obtained from the device-tree or
the PMCR. This simplifies the extract_pstate() helper function since
we no longer no longer require to worry about the sign-extentions.
Signed-off-by: Gautham R. Shenoy <redacted>
---
drivers/cpufreq/powernv-cpufreq.c | 47 ++++++++++++++++-----------------------
1 file changed, 19 insertions(+), 28 deletions(-)
So we just added this and moved from an int to u8. I was going to ask
if we still need an int in patch1, but I thought the driver dealt with
just integers because of the larger framework.
Balbir Singh.
From: Gautham R Shenoy <hidden> Date: 2017-12-18 08:38:33
Hi Balbir,
On Sun, Dec 17, 2017 at 02:15:25PM +1100, Balbir Singh wrote:
On Wed, Dec 13, 2017 at 5:57 PM, Gautham R. Shenoy
[off-list ref] wrote:
quoted
From: "Gautham R. Shenoy" <redacted>
The code in powernv-cpufreq, makes the following two assumptions which
are not guaranteed by the device-tree bindings:
1) Pstate ids are continguous: This is used in pstate_to_idx() to
obtain the reverse map from a pstate to it's corresponding
entry into the cpufreq frequency table.
2) Every Pstate should always lie between the max and the min
pstates that are explicitly reported in the device tree: This
is used to determine whether a pstate reported by the PMSR is
out of bounds.
Both these assumptions are unwarranted and can change on future
platforms.
While this is a good thing, I wonder if it is worth the complexity. Pstates
are contiguous because they define transitions in incremental value
of change in frequency and I can't see how this can be broken in the
future?
In the future, we can have the OPAL firmware give us a smaller set of
pstates instead of expose every one of them. As it stands today, for
most of the workloads, we will need at best 20-30 pstates and not
beyond that.
From: Gautham R Shenoy <hidden> Date: 2017-12-18 08:43:42
Hi Balbir,
On Sun, Dec 17, 2017 at 02:17:02PM +1100, Balbir Singh wrote:
On Wed, Dec 13, 2017 at 5:57 PM, Gautham R. Shenoy
[..snip..]
quoted
-static inline int extract_pstate(u64 pmsr_val, unsigned int shift)
+static inline u8 extract_pstate(u64 pmsr_val, unsigned int shift)
{
- int ret = ((pmsr_val >> shift) & 0xFF);
-
- if (!ret)
- return ret;
-
- return (pstate_sign_prefix | ret);
+ return ((pmsr_val >> shift) & 0xFF);
}
So we just added this and moved from an int to u8. I was going to ask
if we still need an int in patch1, but I thought the driver dealt with
just integers because of the larger framework.
The larger framework is with respect to the device tree which defines
pstates as 32-bit integers (I am not aware of the reasons for this
choice, but perhaps device-tree doesn't have a s8/u8 type?!). The
driver still knows that pstates are only 8-bits wide because of the
PMSR,PMCR definitions. Before this patch, the driver was still doing
the conversions from 8-bit to int and vice-versa every time. With this
patch, we do it only once, i.e at the initialization. After that we
treat pstates as 8-bit integers.
From: Gautham R Shenoy <hidden> Date: 2017-12-18 09:03:34
Hi Balbir,
On Sun, Dec 17, 2017 at 02:04:03PM +1100, Balbir Singh wrote:
On Wed, Dec 13, 2017 at 5:57 PM, Gautham R. Shenoy
[off-list ref] wrote:
quoted
From: "Gautham R. Shenoy" <redacted>
On POWERNV platform, the fields for pstates in the Power Management
Status Register (PMSR) and the Power Management Control Register
(PMCR) are 8-bits wide. On POWER8 the pstates are negatively numbered
while on POWER9 they are positively numbered.
The device-tree exports pstates as 32-bit entries. The device-tree
implementation sign-extends the 8-bit pstate values to obtain the
corresponding 32-bit entry.
Eg: On POWER8, a pstate value 0x82 [-126] is represented in the
device-tree as 0xfffffff82 while on POWER9, the same value 0x82 [130]
is represented in the device-tree as 0x00000082.
The powernv-cpufreq driver implementation represents pstates using the
integer type. In multiple places in the driver, the code interprets
the pstates extracted from the PMSR as a signed byte and assigns it to
a integer variable to get the sign-extention.
On POWER9 platforms which have greater than 128 pstates, this results
in the driver performing incorrect sign-extention, and thereby
treating a legitimate pstate (say 130) as an invalid pstates (since it
is interpreted as -126).
This patch fixes the issue by implementing a helper function to
extract Pstates from PMSR register, and correctly sign-extend it to be
consistent with the values provided by the device-tree.
Signed-off-by: Gautham R. Shenoy <redacted>
---
From: Rafael J. Wysocki <hidden> Date: 2018-01-03 12:08:35
On Monday, December 18, 2017 9:38:20 AM CET Gautham R Shenoy wrote:
Hi Balbir,
On Sun, Dec 17, 2017 at 02:15:25PM +1100, Balbir Singh wrote:
quoted
On Wed, Dec 13, 2017 at 5:57 PM, Gautham R. Shenoy
[off-list ref] wrote:
quoted
From: "Gautham R. Shenoy" <redacted>
The code in powernv-cpufreq, makes the following two assumptions which
are not guaranteed by the device-tree bindings:
1) Pstate ids are continguous: This is used in pstate_to_idx() to
obtain the reverse map from a pstate to it's corresponding
entry into the cpufreq frequency table.
2) Every Pstate should always lie between the max and the min
pstates that are explicitly reported in the device tree: This
is used to determine whether a pstate reported by the PMSR is
out of bounds.
Both these assumptions are unwarranted and can change on future
platforms.
While this is a good thing, I wonder if it is worth the complexity. Pstates
are contiguous because they define transitions in incremental value
of change in frequency and I can't see how this can be broken in the
future?
In the future, we can have the OPAL firmware give us a smaller set of
pstates instead of expose every one of them. As it stands today, for
most of the workloads, we will need at best 20-30 pstates and not
beyond that.
I'm not sure about the status here.
Is this good to go as is or is it going to be updated?
Thanks,
Rafael
On Wed, Jan 3, 2018 at 11:07 PM, Rafael J. Wysocki [off-list ref] wrote:
On Monday, December 18, 2017 9:38:20 AM CET Gautham R Shenoy wrote:
quoted
Hi Balbir,
On Sun, Dec 17, 2017 at 02:15:25PM +1100, Balbir Singh wrote:
quoted
On Wed, Dec 13, 2017 at 5:57 PM, Gautham R. Shenoy
[off-list ref] wrote:
quoted
From: "Gautham R. Shenoy" <redacted>
The code in powernv-cpufreq, makes the following two assumptions which
are not guaranteed by the device-tree bindings:
1) Pstate ids are continguous: This is used in pstate_to_idx() to
obtain the reverse map from a pstate to it's corresponding
entry into the cpufreq frequency table.
2) Every Pstate should always lie between the max and the min
pstates that are explicitly reported in the device tree: This
is used to determine whether a pstate reported by the PMSR is
out of bounds.
Both these assumptions are unwarranted and can change on future
platforms.
While this is a good thing, I wonder if it is worth the complexity. Pstates
are contiguous because they define transitions in incremental value
of change in frequency and I can't see how this can be broken in the
future?
In the future, we can have the OPAL firmware give us a smaller set of
pstates instead of expose every one of them. As it stands today, for
most of the workloads, we will need at best 20-30 pstates and not
beyond that.
I'm not sure about the status here.
Is this good to go as is or is it going to be updated?
I have no major objections, except some of the added complexity, but
Gautham makes a point that this is refactoring for the future
Balbir Singh.
From: Gautham R Shenoy <hidden> Date: 2018-01-10 08:55:57
Hi Rafael,
On Wed, Jan 03, 2018 at 11:47:58PM +1100, Balbir Singh wrote:
On Wed, Jan 3, 2018 at 11:07 PM, Rafael J. Wysocki [off-list ref] wrote:
quoted
On Monday, December 18, 2017 9:38:20 AM CET Gautham R Shenoy wrote:
quoted
Hi Balbir,
On Sun, Dec 17, 2017 at 02:15:25PM +1100, Balbir Singh wrote:
quoted
On Wed, Dec 13, 2017 at 5:57 PM, Gautham R. Shenoy
[off-list ref] wrote:
quoted
From: "Gautham R. Shenoy" <redacted>
The code in powernv-cpufreq, makes the following two assumptions which
are not guaranteed by the device-tree bindings:
1) Pstate ids are continguous: This is used in pstate_to_idx() to
obtain the reverse map from a pstate to it's corresponding
entry into the cpufreq frequency table.
2) Every Pstate should always lie between the max and the min
pstates that are explicitly reported in the device tree: This
is used to determine whether a pstate reported by the PMSR is
out of bounds.
Both these assumptions are unwarranted and can change on future
platforms.
While this is a good thing, I wonder if it is worth the complexity. Pstates
are contiguous because they define transitions in incremental value
of change in frequency and I can't see how this can be broken in the
future?
In the future, we can have the OPAL firmware give us a smaller set of
pstates instead of expose every one of them. As it stands today, for
most of the workloads, we will need at best 20-30 pstates and not
beyond that.
I'm not sure about the status here.
Is this good to go as is or is it going to be updated?
I have no major objections, except some of the added complexity, but
Gautham makes a point that this is refactoring for the future
I have tested this across POWER8 and POWER9. The additional complexity
introduced by the second patch is required for the future when we are
going to reduce the number of pstates.
From: Rafael J. Wysocki <hidden> Date: 2018-01-10 12:01:26
On Wednesday, January 10, 2018 9:55:45 AM CET Gautham R Shenoy wrote:
Hi Rafael,
On Wed, Jan 03, 2018 at 11:47:58PM +1100, Balbir Singh wrote:
quoted
On Wed, Jan 3, 2018 at 11:07 PM, Rafael J. Wysocki [off-list ref] wrote:
quoted
On Monday, December 18, 2017 9:38:20 AM CET Gautham R Shenoy wrote:
quoted
Hi Balbir,
On Sun, Dec 17, 2017 at 02:15:25PM +1100, Balbir Singh wrote:
quoted
On Wed, Dec 13, 2017 at 5:57 PM, Gautham R. Shenoy
[off-list ref] wrote:
quoted
From: "Gautham R. Shenoy" <redacted>
The code in powernv-cpufreq, makes the following two assumptions which
are not guaranteed by the device-tree bindings:
1) Pstate ids are continguous: This is used in pstate_to_idx() to
obtain the reverse map from a pstate to it's corresponding
entry into the cpufreq frequency table.
2) Every Pstate should always lie between the max and the min
pstates that are explicitly reported in the device tree: This
is used to determine whether a pstate reported by the PMSR is
out of bounds.
Both these assumptions are unwarranted and can change on future
platforms.
While this is a good thing, I wonder if it is worth the complexity. Pstates
are contiguous because they define transitions in incremental value
of change in frequency and I can't see how this can be broken in the
future?
In the future, we can have the OPAL firmware give us a smaller set of
pstates instead of expose every one of them. As it stands today, for
most of the workloads, we will need at best 20-30 pstates and not
beyond that.
I'm not sure about the status here.
Is this good to go as is or is it going to be updated?
I have no major objections, except some of the added complexity, but
Gautham makes a point that this is refactoring for the future
I have tested this across POWER8 and POWER9. The additional complexity
introduced by the second patch is required for the future when we are
going to reduce the number of pstates.