From 40dd63e2ac7466009e7b7614b48c054ba4c6315f Mon Sep 17 00:00:00 2001 From: Thomas Richter Date: Mon, 14 Feb 2022 13:16:39 +0100 Subject: [PATCH] cpumf/lshwc: Fix missing CPU list invocation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Acked-by: Sumanth Korikkar Signed-off-by: Jan Höppner --- cpumf/lshwc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cpumf/lshwc.c b/cpumf/lshwc.c index d4cd6265..e6faf509 100644 --- a/cpumf/lshwc.c +++ b/cpumf/lshwc.c @@ -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)