forked from luck/tmp_suning_uos_patched
tools/power/x86/intel-speed-select: Improve error display for turbo-freq feature
This change adds improved error display and handling for commands related to turbo-freq feature. The changes include: - Replace perror/fprintf with helpful error message - Error for not specifying TDP level when required - Show error for invalid bucket number - Show message to enable core-power before enabling turbo-freq feature Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
This commit is contained in:
parent
39bae0fce4
commit
a9fd6ae739
|
@ -1712,12 +1712,15 @@ static void dump_fact_config_for_cpu(int cpu, void *arg1, void *arg2,
|
|||
struct isst_fact_info fact_info;
|
||||
int ret;
|
||||
|
||||
ret = isst_get_fact_info(cpu, tdp_level, &fact_info);
|
||||
if (ret)
|
||||
perror("isst_get_fact_bucket_info");
|
||||
else
|
||||
ret = isst_get_fact_info(cpu, tdp_level, fact_bucket, &fact_info);
|
||||
if (ret) {
|
||||
isst_display_error_info_message(1, "Failed to get turbo-freq info at this level", 1, tdp_level);
|
||||
isst_ctdp_display_information_end(outf);
|
||||
exit(1);
|
||||
} else {
|
||||
isst_fact_display_information(cpu, outf, tdp_level, fact_bucket,
|
||||
fact_avx, &fact_info);
|
||||
}
|
||||
}
|
||||
|
||||
static void dump_fact_config(int arg)
|
||||
|
@ -1735,7 +1738,7 @@ static void dump_fact_config(int arg)
|
|||
}
|
||||
|
||||
if (tdp_level == 0xff) {
|
||||
fprintf(outf, "Invalid command: specify tdp_level\n");
|
||||
isst_display_error_info_message(1, "Invalid command: specify tdp_level\n", 0, 0);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
@ -1763,7 +1766,7 @@ static void set_fact_for_cpu(int cpu, void *arg1, void *arg2, void *arg3,
|
|||
|
||||
ret = isst_set_pbf_fact_status(cpu, 0, status);
|
||||
if (ret) {
|
||||
perror("isst_set_fact");
|
||||
debug_printf("isst_set_pbf_fact_status failed");
|
||||
if (auto_mode)
|
||||
isst_pm_qos_config(cpu, 0, 0);
|
||||
|
||||
|
|
|
@ -516,7 +516,7 @@ int isst_set_pbf_fact_status(int cpu, int pbf, int enable)
|
|||
} else {
|
||||
|
||||
if (enable && !ctdp_level.sst_cp_enabled)
|
||||
fprintf(stderr, "Make sure to execute before: core-power enable\n");
|
||||
isst_display_error_info_message(0, "Make sure to execute before: core-power enable", 0, 0);
|
||||
|
||||
if (ctdp_level.pbf_enabled)
|
||||
req = BIT(17);
|
||||
|
@ -603,18 +603,30 @@ int isst_get_fact_bucket_info(int cpu, int level,
|
|||
return 0;
|
||||
}
|
||||
|
||||
int isst_get_fact_info(int cpu, int level, struct isst_fact_info *fact_info)
|
||||
int isst_get_fact_info(int cpu, int level, int fact_bucket, struct isst_fact_info *fact_info)
|
||||
{
|
||||
struct isst_pkg_ctdp_level_info ctdp_level;
|
||||
struct isst_pkg_ctdp pkg_dev;
|
||||
unsigned int resp;
|
||||
int ret;
|
||||
int j, ret, print;
|
||||
|
||||
ret = isst_get_ctdp_levels(cpu, &pkg_dev);
|
||||
if (ret) {
|
||||
isst_display_error_info_message(1, "Failed to get number of levels", 0, 0);
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (level > pkg_dev.levels) {
|
||||
isst_display_error_info_message(1, "Invalid level", 1, level);
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = isst_get_ctdp_control(cpu, level, &ctdp_level);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
if (!ctdp_level.fact_support) {
|
||||
fprintf(stderr, "turbo-freq feature is not present at this level:%d\n", level);
|
||||
isst_display_error_info_message(1, "turbo-freq feature is not present at this level", 1, level);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -632,8 +644,25 @@ int isst_get_fact_info(int cpu, int level, struct isst_fact_info *fact_info)
|
|||
fact_info->lp_clipping_ratio_license_avx512 = (resp >> 16) & 0xff;
|
||||
|
||||
ret = isst_get_fact_bucket_info(cpu, level, fact_info->bucket_info);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return ret;
|
||||
print = 0;
|
||||
for (j = 0; j < ISST_FACT_MAX_BUCKETS; ++j) {
|
||||
if (fact_bucket != 0xff && fact_bucket != j)
|
||||
continue;
|
||||
|
||||
if (!fact_info->bucket_info[j].high_priority_cores_count)
|
||||
break;
|
||||
|
||||
print = 1;
|
||||
}
|
||||
if (!print) {
|
||||
isst_display_error_info_message(1, "Invalid bucket", 0, 0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int isst_set_trl(int cpu, unsigned long long trl)
|
||||
|
@ -769,7 +798,7 @@ int isst_get_process_ctdp(int cpu, int tdp_level, struct isst_pkg_ctdp *pkg_dev)
|
|||
}
|
||||
|
||||
if (ctdp_level->fact_support) {
|
||||
ret = isst_get_fact_info(cpu, i,
|
||||
ret = isst_get_fact_info(cpu, i, 0xff,
|
||||
&ctdp_level->fact_info);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
|
|
@ -222,7 +222,21 @@ static void _isst_fact_display_information(int cpu, FILE *outf, int level,
|
|||
struct isst_fact_bucket_info *bucket_info = fact_info->bucket_info;
|
||||
char header[256];
|
||||
char value[256];
|
||||
int j;
|
||||
int print = 0, j;
|
||||
|
||||
for (j = 0; j < ISST_FACT_MAX_BUCKETS; ++j) {
|
||||
if (fact_bucket != 0xff && fact_bucket != j)
|
||||
continue;
|
||||
|
||||
if (!bucket_info[j].high_priority_cores_count)
|
||||
break;
|
||||
|
||||
print = 1;
|
||||
}
|
||||
if (!print) {
|
||||
fprintf(stderr, "Invalid bucket\n");
|
||||
return;
|
||||
}
|
||||
|
||||
snprintf(header, sizeof(header), "speed-select-turbo-freq-properties");
|
||||
format_and_print(outf, base_level, header, NULL);
|
||||
|
|
|
@ -219,7 +219,7 @@ extern int isst_set_pbf_fact_status(int cpu, int pbf, int enable);
|
|||
extern int isst_get_pbf_info(int cpu, int level,
|
||||
struct isst_pbf_info *pbf_info);
|
||||
extern void isst_get_pbf_info_complete(struct isst_pbf_info *pbf_info);
|
||||
extern int isst_get_fact_info(int cpu, int level,
|
||||
extern int isst_get_fact_info(int cpu, int level, int fact_bucket,
|
||||
struct isst_fact_info *fact_info);
|
||||
extern int isst_get_fact_bucket_info(int cpu, int level,
|
||||
struct isst_fact_bucket_info *bucket_info);
|
||||
|
|
Loading…
Reference in New Issue
Block a user