perf evsel: Handle ENODEV on default cycles event
authorDavid Ahern <[email protected]>
Thu, 18 Jul 2013 23:27:59 +0000 (17:27 -0600)
committerArnaldo Carvalho de Melo <[email protected]>
Mon, 22 Jul 2013 15:03:57 +0000 (12:03 -0300)
Some systems (e.g., VMs on qemu-0.13 with the default vcpu model) report
an unsupported CPU model:

Performance Events: unsupported p6 CPU model 2 no PMU driver, software events only.

Subsequent invocations of perf fail with:

The sys_perf_event_open() syscall returned with 19 (No such device) for event (cycles).
/bin/dmesg may provide additional information.
No CONFIG_PERF_EVENTS=y kernel support configured?

Add ENODEV to the list of errno's to fallback to cpu-clock.

Signed-off-by: David Ahern <[email protected]>
Cc: Frederic Weisbecker <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
tools/perf/util/evsel.c

index a6354619fa5daf2b289be16a4fa8ffa2a6af805e..8bed0c1a1399c4dabbb4efc52595927c1425a5ee 100644 (file)
@@ -1482,7 +1482,7 @@ out:
 bool perf_evsel__fallback(struct perf_evsel *evsel, int err,
                          char *msg, size_t msgsize)
 {
-       if ((err == ENOENT || err == ENXIO) &&
+       if ((err == ENOENT || err == ENXIO || err == ENODEV) &&
            evsel->attr.type   == PERF_TYPE_HARDWARE &&
            evsel->attr.config == PERF_COUNT_HW_CPU_CYCLES) {
                /*