All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] perf iostat: Use system-wide mode if the target cpu_list is unspecified
@ 2021-09-27  8:11 Like Xu
  2021-09-27  8:11 ` [PATCH 2/2] perf iostat: Fix Segmentation fault from NULL 'struct perf_counts_values *' Like Xu
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Like Xu @ 2021-09-27  8:11 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo, Ian Rogers
  Cc: Alexander Antonov, Jiri Olsa, Alexander Shishkin, Namhyung Kim,
	Mark Rutland, Stephane Eranian, Peter Zijlstra, Ingo Molnar,
	linux-perf-users, linux-kernel

From: Like Xu <likexu@tencent.com>

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.

Signed-off-by: Like Xu <likexu@tencent.com>
---
 tools/perf/builtin-stat.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index f6e87b7be5fa..f0ecfda34ece 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -2408,6 +2408,8 @@ int cmd_stat(int argc, const char **argv)
 			goto out;
 		} else if (verbose)
 			iostat_list(evsel_list, &stat_config);
+		if (iostat_mode == IOSTAT_RUN && !target__has_cpu(&target))
+			target.system_wide = true;
 	}
 
 	if (add_default_attributes())
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-09-28  9:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-27  8:11 [PATCH 1/2] perf iostat: Use system-wide mode if the target cpu_list is unspecified Like Xu
2021-09-27  8:11 ` [PATCH 2/2] perf iostat: Fix Segmentation fault from NULL 'struct perf_counts_values *' Like Xu
2021-09-27 12:42   ` Arnaldo Carvalho de Melo
2021-09-27 12:40 ` [PATCH 1/2] perf iostat: Use system-wide mode if the target cpu_list is unspecified Arnaldo Carvalho de Melo
2021-09-28  9:06 ` Alexander Antonov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.