tools/power/x86/intel-speed-select: New version
Subsystems (2)
Srinivas Pandruvada
maintainercover tools/power/x86/intel-speed-select: New version
This adds support for the new version of Intel(R) Speed select implementation. Also some fixes for CLX-N platform.
Srinivas Pandruvada (10):
tools/power/x86/intel-speed-select: Extend command set for
perf-profile
tools/power/x86/intel-speed-select: Change display of "avx" to "avx2" tools/power/x86/intel-speed-select: Correct CLX-N frequency units tools/power/x86/intel-speed-select: Auto mode for CLX tools/power/x86/intel-speed-select: Use mailbox for CLOS_PM_QOS_CONFIG tools/power/x86/intel-speed-select: Make CLOS frequency in MHz tools/power/x86/intel-speed-select: Use Frequency weight for CLOS tools/power/x86/intel-speed-select: Support platform with limited
Intel(R) Speed Select
tools/power/x86/intel-speed-select: Use core count for base-freq mask tools/power/x86/intel-speed-select: Increment version
.../x86/intel-speed-select/isst-config.c | 178 ++++++++++++++---- .../power/x86/intel-speed-select/isst-core.c | 146 ++++++++++++-- .../x86/intel-speed-select/isst-display.c | 139 +++++++++----- tools/power/x86/intel-speed-select/isst.h | 2 + 4 files changed, 366 insertions(+), 99 deletions(-)
Signature · 1 line
2.17.2
Srinivas Pandruvada
maintainerPATCH 1/10 tools/power/x86/intel-speed-select: Extend command set for perf-profile
Add support for uncore P0, uncore P1, P1 for base and AVX levels and memory frequency. These commands are optional, so continue on failure.
--- .../power/x86/intel-speed-select/isst-core.c | 67 +++++++++++++++++++ .../x86/intel-speed-select/isst-display.c | 39 ++++++++++- 2 files changed, 105 insertions(+), 1 deletion(-)
tools/power/x86/intel-speed-select/isst-core.c +67 -0
@@ -95,6 +95,69 @@ int isst_get_pwr_info(int cpu, int config_index,return 0 ; } +void isst_get_uncore_p0_p1_info (int cpu,int config_index, +struct isst_pkg_ctdp_level_info *ctdp_level) +{ +unsigned int resp; +int ret; + ret =isst_send_mbox_command (cpu,CONFIG_TDP , +CONFIG_TDP_GET_UNCORE_P0_P1_INFO ,0 , + config_index, &resp); +if (ret) { + ctdp_level->uncore_p0 =0 ; + ctdp_level->uncore_p1 =0 ; +return ; + } + + ctdp_level->uncore_p0 = resp &GENMASK (7 ,0 ); + ctdp_level->uncore_p1 = (resp &GENMASK (15 ,8 )) >>8 ; +debug_printf ( +"cpu:%d ctdp:%d CONFIG_TDP_GET_UNCORE_P0_P1_INFO resp:%x uncore p0:%d uncore p1:%d\n" , + cpu, config_index, resp, ctdp_level->uncore_p0, + ctdp_level->uncore_p1); +} + +void isst_get_p1_info (int cpu,int config_index, +struct isst_pkg_ctdp_level_info *ctdp_level) +{ +unsigned int resp; +int ret; + ret =isst_send_mbox_command (cpu,CONFIG_TDP ,CONFIG_TDP_GET_P1_INFO ,0 , + config_index, &resp); +if (ret) { + ctdp_level->sse_p1 =0 ; + ctdp_level->avx2_p1 =0 ; + ctdp_level->avx512_p1 =0 ; +return ; + } + + ctdp_level->sse_p1 = resp &GENMASK (7 ,0 ); + ctdp_level->avx2_p1 = (resp &GENMASK (15 ,8 )) >>8 ; + ctdp_level->avx512_p1 = (resp &GENMASK (23 ,16 )) >>16 ; +debug_printf ( +"cpu:%d ctdp:%d CONFIG_TDP_GET_P1_INFO resp:%x sse_p1:%d avx2_p1:%d avx512_p1:%d\n" , + cpu, config_index, resp, ctdp_level->sse_p1, + ctdp_level->avx2_p1, ctdp_level->avx512_p1); +} + +void isst_get_uncore_mem_freq (int cpu,int config_index, +struct isst_pkg_ctdp_level_info *ctdp_level) +{ +unsigned int resp; +int ret; + ret =isst_send_mbox_command (cpu,CONFIG_TDP ,CONFIG_TDP_GET_MEM_FREQ , +0 , config_index, &resp); +if (ret) { + ctdp_level->mem_freq =0 ; +return ; + } + + ctdp_level->mem_freq = resp &GENMASK (7 ,0 ); +debug_printf ( +"cpu:%d ctdp:%d CONFIG_TDP_GET_MEM_FREQ resp:%x uncore mem_freq:%d\n" , + cpu, config_index, resp, ctdp_level->mem_freq); +} +int isst_get_tjmax_info (int cpu,int config_index,struct isst_pkg_ctdp_level_info *ctdp_level) {
@@ -600,6 +663,10 @@ int isst_get_process_ctdp(int cpu, int tdp_level, struct isst_pkg_ctdp *pkg_dev)if (ret)return ret; +isst_get_uncore_p0_p1_info (cpu, i, ctdp_level); +isst_get_p1_info (cpu, i, ctdp_level); +isst_get_uncore_mem_freq (cpu, i, ctdp_level); +if (ctdp_level->pbf_support) { ret =isst_get_pbf_info (cpu, i, &ctdp_level->pbf_info);if (!ret)
tools/power/x86/intel-speed-select/isst-display.c +38 -1
@@ -352,10 +352,47 @@ void isst_ctdp_display_information(int cpu, FILE *outf, int tdp_level,format_and_print (outf, base_level +4 , header, value);snprintf (header,sizeof (header),"base-frequency(MHz)" ); +if (!ctdp_level->sse_p1) + ctdp_level->sse_p1 = ctdp_level->tdp_ratio;snprintf (value,sizeof (value),"%d" , - ctdp_level->tdp_ratio *DISP_FREQ_MULTIPLIER ); + ctdp_level->sse_p1 *DISP_FREQ_MULTIPLIER );format_and_print (outf, base_level +4 , header, value); +if (ctdp_level->avx2_p1) { +snprintf (header,sizeof (header),"base-frequency-avx2(MHz)" ); +snprintf (value,sizeof (value),"%d" , + ctdp_level->avx2_p1 *DISP_FREQ_MULTIPLIER ); +format_and_print (outf, base_level +4 , header, value); + } + +if (ctdp_level->avx512_p1) { +snprintf (header,sizeof (header),"base-frequency-avx512(MHz)" ); +snprintf (value,sizeof (value),"%d" , + ctdp_level->avx512_p1 *DISP_FREQ_MULTIPLIER ); +format_and_print (outf, base_level +4 , header, value); + } + +if (ctdp_level->uncore_p1) { +snprintf (header,sizeof (header),"uncore-frequency-min(MHz)" ); +snprintf (value,sizeof (value),"%d" , + ctdp_level->uncore_p1 *DISP_FREQ_MULTIPLIER ); +format_and_print (outf, base_level +4 , header, value); + } + +if (ctdp_level->uncore_p0) { +snprintf (header,sizeof (header),"uncore-frequency-max(MHz)" ); +snprintf (value,sizeof (value),"%d" , + ctdp_level->uncore_p0 *DISP_FREQ_MULTIPLIER ); +format_and_print (outf, base_level +4 , header, value); + } + +if (ctdp_level->mem_freq) { +snprintf (header,sizeof (header),"mem-frequency(MHz)" ); +snprintf (value,sizeof (value),"%d" , + ctdp_level->mem_freq *DISP_FREQ_MULTIPLIER ); +format_and_print (outf, base_level +4 , header, value); + } +snprintf (header,sizeof (header),"speed-select-turbo-freq" );if (ctdp_level->fact_support) {
Signature · 1 line
2.17.2
Srinivas Pandruvada
maintainerPATCH 2/10 tools/power/x86/intel-speed-select: Change display of "avx" to "avx2"
In reply to Srinivas PandruvadaMake the avx level display consistent. Except for "turbo-ratio-limits-avx", everywhere else it is avx2. So change "turbo-ratio-limits-avx" to "turbo-ratio-limits-avx2".
--- tools/power/x86/intel-speed-select/isst-display.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/power/x86/intel-speed-select/isst-display.c +1 -1
@@ -449,7 +449,7 @@ void isst_ctdp_display_information(int cpu, FILE *outf, int tdp_level, DISP_FREQ_MULTIPLIER);format_and_print (outf, base_level +6 , header, value); } -snprintf (header,sizeof (header),"turbo-ratio-limits-avx" ); +snprintf (header,sizeof (header),"turbo-ratio-limits-avx2" );format_and_print (outf, base_level +4 , header,NULL );for (j =0 ; j <8 ; ++j) {snprintf (header,sizeof (header),"bucket-%d" , j);
Signature · 1 line
2.17.2
Srinivas Pandruvada
maintainerPATCH 3/10 tools/power/x86/intel-speed-select: Correct CLX-N frequency units
In reply to Srinivas PandruvadaIn CLX_N base_frequency is read from cpufreq sysfs, where units are in KHz. The internal units in the code matches the real ratios which are in 100MHz scale. So when storing units for CLX-N frequencies, convert to 100MHz scale.
--- tools/power/x86/intel-speed-select/isst-config.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
tools/power/x86/intel-speed-select/isst-config.c +3 -3
@@ -840,8 +840,8 @@ static int clx_n_config(int cpu) }/* convert frequencies back to ratios */ - pbf_info->p1_high = pbf_info->p1_high /DISP_FREQ_MULTIPLIER ; - pbf_info->p1_low = pbf_info->p1_low /DISP_FREQ_MULTIPLIER ; + pbf_info->p1_high = pbf_info->p1_high /100000 ; + pbf_info->p1_low = pbf_info->p1_low /100000 ;/* create high priority cpu mask */ pbf_info->core_cpumask_size =alloc_cpu_set (&pbf_info->core_cpumask);
@@ -856,7 +856,7 @@ static int clx_n_config(int cpu) cpu_bf =parse_int_file (1 ,"/sys/devices/system/cpu/cpu%d/cpufreq/base_frequency" , i); - cpu_bf = cpu_bf /DISP_FREQ_MULTIPLIER ; + cpu_bf = cpu_bf /100000 ;if (cpu_bf == pbf_info->p1_high)CPU_SET_S (i, pbf_info->core_cpumask_size, pbf_info->core_cpumask);
Signature · 1 line
2.17.2
Srinivas Pandruvada
maintainerPATCH 4/10 tools/power/x86/intel-speed-select: Auto mode for CLX
In reply to Srinivas PandruvadaThere is an expectation in the CLX platform for SST base-freq feature that Scaling min frequency be different for high and low priority cores. This is the way the firmware will understand the priority.
So this change will look at high priority and low priority cores, and set scaling_min_freq to P1High for high priority cores and P1Low to low priority cores.
--- .../x86/intel-speed-select/isst-config.c | 112 ++++++++++++++++-- 1 file changed, 100 insertions(+), 12 deletions(-)
tools/power/x86/intel-speed-select/isst-config.c +100 -12
@@ -1095,7 +1095,73 @@ static int set_clos_param(int cpu, int clos, int epp, int wt, int min, int max)return 0 ; } -static int set_cpufreq_cpuinfo_scaling_min (int cpu,int max) +static int set_cpufreq_scaling_min_max (int cpu,int max,int freq) +{ +char buffer[128 ], freq_str[16 ]; +int fd, ret, len; + +if (max) +snprintf (buffer,sizeof (buffer), +"/sys/devices/system/cpu/cpu%d/cpufreq/scaling_max_freq" , cpu); +else +snprintf (buffer,sizeof (buffer), +"/sys/devices/system/cpu/cpu%d/cpufreq/scaling_min_freq" , cpu); + + fd =open (buffer,O_WRONLY ); +if (fd <0 ) +return fd; + +snprintf (freq_str,sizeof (freq_str),"%d" , freq); + len =strlen (freq_str); + ret =write (fd, freq_str, len); +if (ret ==-1 ) { +close (fd); +return ret; + } +close (fd); + +return 0 ; +} + +static int set_clx_pbf_cpufreq_scaling_min_max (int cpu) +{ +struct isst_pkg_ctdp_level_info *ctdp_level; +struct isst_pbf_info *pbf_info; +int i, pkg_id, die_id, freq, freq_high, freq_low; +int ret; + + ret =clx_n_config (cpu); +if (ret) { +perror ("set_clx_pbf_cpufreq_scaling_min_max" ); +return ret; + } + + ctdp_level = &clx_n_pkg_dev.ctdp_level[0 ]; + pbf_info = &ctdp_level->pbf_info; + freq_high = pbf_info->p1_high *100000 ; + freq_low = pbf_info->p1_low *100000 ; + + pkg_id =get_physical_package_id (cpu); + die_id =get_physical_die_id (cpu); +for (i =0 ; i <get_topo_max_cpus (); ++i) { +if (pkg_id !=get_physical_package_id (i) || + die_id !=get_physical_die_id (i)) +continue ; + +if (CPU_ISSET_S (i, pbf_info->core_cpumask_size, + pbf_info->core_cpumask)) + freq = freq_high; +else + freq = freq_low; + +set_cpufreq_scaling_min_max (i,1 , freq); +set_cpufreq_scaling_min_max (i,0 , freq); + } + +return 0 ; +} + +static int set_cpufreq_scaling_min_max_from_cpuinfo (int cpu,int cpuinfo_max,int scaling_max) {char buffer[128 ], min_freq[16 ];int fd, ret, len;
@@ -1103,7 +1169,7 @@ static int set_cpufreq_cpuinfo_scaling_min(int cpu, int max)if (!CPU_ISSET_S (cpu, present_cpumask_size, present_cpumask))return -1 ; -if (max) +if (cpuinfo_max)snprintf (buffer,sizeof (buffer),"/sys/devices/system/cpu/cpu%d/cpufreq/cpuinfo_max_freq" , cpu);else
@@ -1120,8 +1186,12 @@ static int set_cpufreq_cpuinfo_scaling_min(int cpu, int max)if (len <0 )return len; -snprintf (buffer,sizeof (buffer), -"/sys/devices/system/cpu/cpu%d/cpufreq/scaling_min_freq" , cpu); +if (scaling_max) +snprintf (buffer,sizeof (buffer), +"/sys/devices/system/cpu/cpu%d/cpufreq/scaling_max_freq" , cpu); +else +snprintf (buffer,sizeof (buffer), +"/sys/devices/system/cpu/cpu%d/cpufreq/scaling_min_freq" , cpu); fd =open (buffer,O_WRONLY );if (fd <0 )
@@ -1149,7 +1219,7 @@ static void set_scaling_min_to_cpuinfo_max(int cpu) die_id != get_physical_die_id(i))continue ; -set_cpufreq_cpuinfo_scaling_min (i,1 ); +set_cpufreq_scaling_min_max_from_cpuinfo (i,1 ,0 ); } }
@@ -1164,7 +1234,22 @@ static void set_scaling_min_to_cpuinfo_min(int cpu) die_id != get_physical_die_id(i))continue ; -set_cpufreq_cpuinfo_scaling_min (i,0 ); +set_cpufreq_scaling_min_max_from_cpuinfo (i,0 ,0 ); + } +} + +static void set_scaling_max_to_cpuinfo_max (int cpu) +{ +int i, pkg_id, die_id; + + pkg_id =get_physical_package_id (cpu); + die_id =get_physical_die_id (cpu); +for (i =0 ; i <get_topo_max_cpus (); ++i) { +if (pkg_id !=get_physical_package_id (i) || + die_id !=get_physical_die_id (i)) +continue ; + +set_cpufreq_scaling_min_max_from_cpuinfo (i,1 ,1 ); } }
@@ -1263,14 +1348,17 @@ static void set_pbf_for_cpu(int cpu, void *arg1, void *arg2, void *arg3,int status = *(int *)arg4;if (is_clx_n_platform ()) { -if (status ==0 ) { - ret =-1 ; -if (auto_mode) -set_scaling_min_to_cpuinfo_min (cpu); - }else { +if (status) { ret =0 ;if (auto_mode) -set_scaling_min_to_cpuinfo_max (cpu); +set_clx_pbf_cpufreq_scaling_min_max (cpu); + + }else { + ret =-1 ; +if (auto_mode) { +set_scaling_max_to_cpuinfo_max (cpu); +set_scaling_min_to_cpuinfo_min (cpu); + } } goto disp_result; }
Signature · 1 line
2.17.2
Srinivas Pandruvada
maintainerPATCH 5/10 tools/power/x86/intel-speed-select: Use mailbox for CLOS_PM_QOS_CONFIG
In reply to Srinivas PandruvadaUse mailbox to read/write CLOS_PM_QOS_CONFIG instead of read/write to MMIO offset.
--- tools/power/x86/intel-speed-select/isst-config.c | 6 ------ 1 file changed, 6 deletions(-)
tools/power/x86/intel-speed-select/isst-config.c +0 -6
@@ -574,12 +574,6 @@ int isst_send_mbox_command(unsigned int cpu, unsigned char command,if (!ret && !write) *resp = value;break ; -case CLOS_PM_QOS_CONFIG : - ret =isst_send_mmio_command (cpu,PM_QOS_CONFIG_OFFSET , - write, &value); -if (!ret && !write) - *resp = value; -break ;case CLOS_STATUS :break ;default :
Signature · 1 line
2.17.2
Srinivas Pandruvada
maintainerPATCH 6/10 tools/power/x86/intel-speed-select: Make CLOS frequency in MHz
In reply to Srinivas PandruvadaTo be consistant with the other frequency units, change the CLOS unit to MHz instead of ratios.
--- tools/power/x86/intel-speed-select/isst-config.c | 11 +++++++---- tools/power/x86/intel-speed-select/isst-display.c | 6 +++--- 2 files changed, 10 insertions(+), 7 deletions(-)
tools/power/x86/intel-speed-select/isst-config.c +7 -4
@@ -1775,9 +1775,9 @@ static void set_clos_config(int arg)fprintf (stderr,"\tSpecify clos EPP with [--epp|-e]\n" );fprintf (stderr,"\tSpecify clos Proportional Priority [--weight|-w]\n" ); -fprintf (stderr,"\tSpecify clos min with [--min|-n]\n" ); -fprintf (stderr,"\tSpecify clos max with [--max|-m]\n" ); -fprintf (stderr,"\tSpecify clos desired with [--desired|-d]\n" ); +fprintf (stderr,"\tSpecify clos min in MHz with [--min|-n]\n" ); +fprintf (stderr,"\tSpecify clos max in MHz with [--max|-m]\n" ); +fprintf (stderr,"\tSpecify clos desired in MHz with [--desired|-d]\n" );exit (0 ); }
@@ -1799,7 +1799,7 @@ static void set_clos_config(int arg) clos_min =0 ; }if (clos_max <0 ) { -fprintf (stderr,"clos max is not specified, default: 0xff\n" ); +fprintf (stderr,"clos max is not specified, default: 25500 MHz\n" ); clos_max =0xff ; }if (clos_desired <0 ) {
@@ -2049,15 +2049,18 @@ static void parse_cmd_args(int argc, int start, char **argv)break ;case 'd' : clos_desired =atoi (optarg); + clos_desired /=DISP_FREQ_MULTIPLIER ;break ;case 'e' : clos_epp =atoi (optarg);break ;case 'n' : clos_min =atoi (optarg); + clos_min /=DISP_FREQ_MULTIPLIER ;break ;case 'm' : clos_max =atoi (optarg); + clos_max /=DISP_FREQ_MULTIPLIER ;break ;case 'p' : clos_priority_type =atoi (optarg);
tools/power/x86/intel-speed-select/isst-display.c +3 -3
@@ -556,15 +556,15 @@ void isst_clos_display_information(int cpu, FILE *outf, int clos,format_and_print (outf,5 , header, value);snprintf (header,sizeof (header),"clos-min" ); -snprintf (value,sizeof (value),"%d" , clos_config->clos_min); +snprintf (value,sizeof (value),"%d MHz" , clos_config->clos_min *DISP_FREQ_MULTIPLIER );format_and_print (outf,5 , header, value);snprintf (header,sizeof (header),"clos-max" ); -snprintf (value,sizeof (value),"%d" , clos_config->clos_max); +snprintf (value,sizeof (value),"%d MHz" , clos_config->clos_max *DISP_FREQ_MULTIPLIER );format_and_print (outf,5 , header, value);snprintf (header,sizeof (header),"clos-desired" ); -snprintf (value,sizeof (value),"%d" , clos_config->clos_desired); +snprintf (value,sizeof (value),"%d MHz" , clos_config->clos_desired *DISP_FREQ_MULTIPLIER );format_and_print (outf,5 , header, value);format_and_print (outf,1 ,NULL ,NULL );
Signature · 1 line
2.17.2
Srinivas Pandruvada
maintainerPATCH 7/10 tools/power/x86/intel-speed-select: Use Frequency weight for CLOS
In reply to Srinivas PandruvadaUse different frequency weights for CLOS 0 and and CLOS1-3, to define relative priority for power budgeting. This will be used for --auto mode to enable base-freq and turbo-freq feature.
--- tools/power/x86/intel-speed-select/isst-config.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
tools/power/x86/intel-speed-select/isst-config.c +6 -6
@@ -1260,15 +1260,15 @@ static int set_core_priority_and_min(int cpu, int mask_size,if (ret)return ret; - ret =set_clos_param (cpu,1 ,15 ,0 , min_low,0xff ); + ret =set_clos_param (cpu,1 ,15 ,15 , min_low,0xff );if (ret)return ret; - ret =set_clos_param (cpu,2 ,15 ,0 , min_low,0xff ); + ret =set_clos_param (cpu,2 ,15 ,15 , min_low,0xff );if (ret)return ret; - ret =set_clos_param (cpu,3 ,15 ,0 , min_low,0xff ); + ret =set_clos_param (cpu,3 ,15 ,15 , min_low,0xff );if (ret)return ret;
@@ -1589,15 +1589,15 @@ static void set_fact_enable(int arg)if (ret) goto error_disp; - ret =set_clos_param (i,1 ,15 ,0 ,0 ,0xff ); + ret =set_clos_param (i,1 ,15 ,15 ,0 ,0xff );if (ret) goto error_disp; - ret =set_clos_param (i,2 ,15 ,0 ,0 ,0xff ); + ret =set_clos_param (i,2 ,15 ,15 ,0 ,0xff );if (ret) goto error_disp; - ret =set_clos_param (i,3 ,15 ,0 ,0 ,0xff ); + ret =set_clos_param (i,3 ,15 ,15 ,0 ,0xff );if (ret) goto error_disp;
Signature · 1 line
2.17.2
Srinivas Pandruvada
maintainerPATCH 8/10 tools/power/x86/intel-speed-select: Support platform with limited Intel(R) Speed Select
In reply to Srinivas PandruvadaThere are some platforms, where there limited support of Intel(R) SST features. Here perf-profile has only one base configuration and limited support of commands. But still has support for discovery of base-freq and turbo-freq features. So it is important to show minimum features to use base-freq and turbo-freq features.
Here the change are:
- When there is no support of CONFIG_TDP_GET_LEVELS_INFO, then instead of treating this as fatal error, treat this with number of config levels = 0, that means only base level 0 is present.
- There is no support of mail box commands to get base frequencies or turbo frequencies. Here present base frequency by reading cpufreq base freq and turbo frequency by reading MSR 0x1AD.
- Don't display any field, which has value == 0.
--- .../x86/intel-speed-select/isst-config.c | 6 ++ .../power/x86/intel-speed-select/isst-core.c | 74 +++++++++++---- .../x86/intel-speed-select/isst-display.c | 92 ++++++++++--------- tools/power/x86/intel-speed-select/isst.h | 1 + 4 files changed, 113 insertions(+), 60 deletions(-)
tools/power/x86/intel-speed-select/isst-config.c +6 -0
@@ -200,6 +200,11 @@ int get_physical_die_id(int cpu)return ret; } +int get_cpufreq_base_freq (int cpu) +{ +return parse_int_file (0 ,"/sys/devices/system/cpu/cpu%d/cpufreq/base_frequency" , cpu); +} +int get_topo_max_cpus (void ) {return topo_max_cpus;
@@ -598,6 +603,7 @@ int isst_send_mbox_command(unsigned int cpu, unsigned char command,fprintf (outf,"Error: mbox_cmd cpu:%d command:%x sub_command:%x parameter:%x req_data:%x\n" , cpu, command, sub_command, parameter, req_data); +return -1 ; }else { *resp = mbox_cmds.mbox_cmd[0 ].resp_data; debug_printf(
tools/power/x86/intel-speed-select/isst-core.c +57 -17
110 lines not on this page · raw message
tools/power/x86/intel-speed-select/isst-display.c +49 -43
120 lines not on this page · raw message
tools/power/x86/intel-speed-select/isst.h +1 -0
@@ -240,4 +240,5 @@ extern int isst_clos_get_clos_information(int cpu, int *enable, int *type);extern void isst_clos_display_clos_information (int cpu,FILE *outf,int clos_enable,int type);extern int is_clx_n_platform (void ); +extern int get_cpufreq_base_freq (int cpu);#endif
Signature · 1 line
2.17.2
Srinivas Pandruvada
maintainerPATCH 9/10 tools/power/x86/intel-speed-select: Use core count for base-freq mask
In reply to Srinivas PandruvadaSome firmware implementation gives error when a command is sent get mask for core count 32-61. So use core count to decide.
But there is no function to get core count. So introduce one function to get core count.
--- .../x86/intel-speed-select/isst-config.c | 23 ++++++++++++++++++- .../power/x86/intel-speed-select/isst-core.c | 7 ++++-- tools/power/x86/intel-speed-select/isst.h | 1 + 3 files changed, 28 insertions(+), 3 deletions(-)
tools/power/x86/intel-speed-select/isst-config.c +22 -1
@@ -338,6 +338,7 @@ void free_cpu_set(cpu_set_t *cpu_set) }static int cpu_cnt[MAX_PACKAGE_COUNT ][MAX_DIE_PER_PACKAGE ]; +static long long core_mask[MAX_PACKAGE_COUNT ][MAX_DIE_PER_PACKAGE ];static void set_cpu_present_cpu_mask (void ) {size_t size;
@@ -362,13 +363,33 @@ static void set_cpu_present_cpu_mask(void) pkg_id =get_physical_package_id (i);if (pkg_id <MAX_PACKAGE_COUNT && - die_id <MAX_DIE_PER_PACKAGE ) + die_id <MAX_DIE_PER_PACKAGE ) { +int core_id =get_physical_core_id (i); + cpu_cnt[pkg_id][die_id]++; + core_mask[pkg_id][die_id] |= (1ULL << core_id); + } }closedir (dir); } } +int get_core_count (int pkg_id,int die_id) +{ +int cnt =0 ; + +if (pkg_id <MAX_PACKAGE_COUNT && die_id <MAX_DIE_PER_PACKAGE ) { +int i; + +for (i =0 ; i <sizeof (long long ) *8 ; ++i) { +if (core_mask[pkg_id][die_id] & (1ULL << i)) + cnt++; + } + } + +return cnt; +} +int get_cpu_count (int pkg_id,int die_id) {if (pkg_id <MAX_PACKAGE_COUNT && die_id <MAX_DIE_PER_PACKAGE )
tools/power/x86/intel-speed-select/isst-core.c +5 -2
@@ -335,12 +335,15 @@ int isst_set_tdp_level(int cpu, int tdp_level)int isst_get_pbf_info (int cpu,int level,struct isst_pbf_info *pbf_info) { +int i, ret, core_cnt, max;unsigned int req, resp; -int i, ret; pbf_info->core_cpumask_size =alloc_cpu_set (&pbf_info->core_cpumask); -for (i =0 ; i <2 ; ++i) { + core_cnt =get_core_count (get_physical_package_id (cpu),get_physical_die_id (cpu)); + max = core_cnt >32 ?2 :1 ; + +for (i =0 ; i < max; ++i) {unsigned long long mask;int count;
tools/power/x86/intel-speed-select/isst.h +1 -0
@@ -163,6 +163,7 @@ struct isst_pkg_ctdp {extern int get_topo_max_cpus (void );extern int get_cpu_count (int pkg_id,int die_id); +extern int get_core_count (int pkg_id,int die_id);/* Common interfaces */ extern void debug_printf (const char *format, ...);
Signature · 1 line
2.17.2
Srinivas Pandruvada
maintainerPATCH 10/10 tools/power/x86/intel-speed-select: Increment version
In reply to Srinivas PandruvadaSince the tool now adds support for another Intel SST implementation, increment version number.
--- tools/power/x86/intel-speed-select/isst-config.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/power/x86/intel-speed-select/isst-config.c +1 -1
@@ -15,7 +15,7 @@ struct process_cmd_struct {int arg; }; -static const char *version_str ="v1.0" ; +static const char *version_str ="v1.1" ;static const int supported_api_ver =1 ;static struct isst_if_platform_info isst_platform_info;static char *progname;
Signature · 1 line
2.17.2