perf iostat: Use system-wide mode if the target cpu_list is unspecified
authorLike Xu <likexu@tencent.com>
Mon, 27 Sep 2021 08:11:14 +0000 (16:11 +0800)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 27 Sep 2021 12:39:30 +0000 (09:39 -0300)
commite4fe5d7349e0b1c0d3da5b6b3e1efce591e85bd2
tree4937e31c1bae37192f4c6343bcaf9ede41bd899b
parenta827c007c75be4f6038f3d879045fb1ab6385d6b
perf iostat: Use system-wide mode if the target cpu_list is unspecified

An iostate use case like "perf iostat 0000:16,0000:97 -- ls" should be
implemented to work in system-wide mode to ensure that the output from
print_header() is consistent with the user documentation perf-iostat.txt,
rather than incorrectly assuming that the kernel does not support it:

 Error:
 The sys_perf_event_open() syscall returned with 22 (Invalid argument) \
 for event (uncore_iio_0/event=0x83,umask=0x04,ch_mask=0xF,fc_mask=0x07/).
 /bin/dmesg | grep -i perf may provide additional information.

This error is easily fixed by assigning system-wide mode by default
for IOSTAT_RUN only when the target cpu_list is unspecified.

Fixes: f07952b179697771 ("perf stat: Basic support for iostat in perf")
Signed-off-by: Like Xu <likexu@tencent.com>
Cc: Alexander Antonov <alexander.antonov@linux.intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lore.kernel.org/lkml/20210927081115.39568-1-likexu@tencent.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/builtin-stat.c