summaryrefslogtreecommitdiffstats
path: root/tools/power
diff options
context:
space:
mode:
authorSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>2023-08-08 13:08:03 -0700
committerSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>2023-08-08 15:16:40 -0700
commite67b6ed2bbd1516f949202503207f44b3066bdec (patch)
tree330b047cc4a73a02ee17c6af846a93112c879ac0 /tools/power
parent06bbebdb6da5e816f206c09ce20321237e5910e9 (diff)
downloadlinux-e67b6ed2bbd1516f949202503207f44b3066bdec.tar.gz
linux-e67b6ed2bbd1516f949202503207f44b3066bdec.tar.bz2
linux-e67b6ed2bbd1516f949202503207f44b3066bdec.zip
tools/power/x86/intel-speed-select: Error on CPU count exceed in request
There is a limit on number of CPUs in one request. This is set to 256. Currently tool silently ignores request for count over 256. Give an error message to indicate this. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Diffstat (limited to 'tools/power')
-rw-r--r--tools/power/x86/intel-speed-select/isst-config.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/tools/power/x86/intel-speed-select/isst-config.c b/tools/power/x86/intel-speed-select/isst-config.c
index f70a710e5dc6..b4864f3477da 100644
--- a/tools/power/x86/intel-speed-select/isst-config.c
+++ b/tools/power/x86/intel-speed-select/isst-config.c
@@ -2622,10 +2622,11 @@ static struct process_cmd_struct isst_cmds[] = {
*/
void parse_cpu_command(char *optarg)
{
- unsigned int start, end;
+ unsigned int start, end, invalid_count;
char *next;
next = optarg;
+ invalid_count = 0;
while (next && *next) {
if (*next == '-') /* no negative cpu numbers */
@@ -2635,6 +2636,8 @@ void parse_cpu_command(char *optarg)
if (max_target_cpus < MAX_CPUS_IN_ONE_REQ)
target_cpus[max_target_cpus++] = start;
+ else
+ invalid_count = 1;
if (*next == '\0')
break;
@@ -2661,6 +2664,8 @@ void parse_cpu_command(char *optarg)
while (++start <= end) {
if (max_target_cpus < MAX_CPUS_IN_ONE_REQ)
target_cpus[max_target_cpus++] = start;
+ else
+ invalid_count = 1;
}
if (*next == ',')
@@ -2669,6 +2674,13 @@ void parse_cpu_command(char *optarg)
goto error;
}
+ if (invalid_count) {
+ isst_ctdp_display_information_start(outf);
+ isst_display_error_info_message(1, "Too many CPUs in one request: max is", 1, MAX_CPUS_IN_ONE_REQ - 1);
+ isst_ctdp_display_information_end(outf);
+ exit(-1);
+ }
+
#ifdef DEBUG
{
int i;