cpumf/lshwc: Fix missing CPU list invocation

When lshwc is invoked with
 # ./lshwc -a :P
 lshwc: ioctl S390_HWCTR_START: Invalid argument
 #
it returns an error instead of listing all problem state counters
of all online CPUs. The reason is an empty CPU list when it is
omitted and only a counter set is specified. Fix this.

Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
Acked-by: Sumanth Korikkar <sumanthk@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Thomas Richter
2022-02-14 13:16:39 +01:00
committed by Jan Höppner
parent a8579a0727
commit 40dd63e2ac

View File

@@ -245,12 +245,12 @@ static void parse_cpulist(char *parm, struct s390_hwctr_start *start)
start->counter_sets = parse_ctrset(++cp);
}
if (strlen(parm) > 0) { /* Handle CPU list */
if (strlen(parm) > 0) /* Handle CPU list */
rc = libcpumf_cpuset(parm, &cpulist);
if (rc)
errx(EXIT_FAILURE, "Cannot use CPU list %s",
parm);
}
else
rc = libcpumf_cpuset_fn(S390_CPUS_ONLINE, &cpulist);
if (rc)
errx(EXIT_FAILURE, "Cannot use CPU list %s", parm);
} else { /* No CPU list and no counter sets */
rc = libcpumf_cpuset_fn(S390_CPUS_ONLINE, &cpulist);
if (rc)