]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
perf stat: Fix case where guest/host monitoring is not supported by kernel
authorStephane Eranian <eranian@google.com>
Fri, 27 Apr 2012 12:45:38 +0000 (14:45 +0200)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Tue, 1 May 2012 17:20:00 +0000 (14:20 -0300)
commit5622c07b4741e0afd7607bce6e850b76eeb23210
treebbd2aa4459baf10ef88aef17fc5b55abaf451ce0
parentafda0f94483f46a4caddb529b8f95e0aaf015de6
perf stat: Fix case where guest/host monitoring is not supported by kernel

By default, perf stat sets exclude_guest = 1. But when you run perf on a
kernel which does not support  host/guest filtering, then you get an
error saying the event in unsupported. This comes from the fact that
when the perf_event_attr struct passed by the user is larger than the
one known to the kernel there is safety check which ensures that all
unknown bits are zero. But here, exclude_guest is 1 (part of the unknown
bits) and thus the perf_event_open() syscall return EINVAL.

To my surprise, running perf record on the same kernel did not exhibit
the problem. The reason is that perf record handles the problem by
catching the error and retrying with guest/host excludes set to zero.
For some reason, this was not done with perf stat. This patch fixes this
problem.

Signed-off-by: Stephane Eranian <eranian@google.com>
Cc: Gleb Natapov <gleb@redhat.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Joerg Roedel <joro@8bytes.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Robert Richter <robert.richter@amd.com>
Link: http://lkml.kernel.org/r/20120427124538.GA7230@quad
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/builtin-stat.c