]> Pileus Git - ~andy/linux/commitdiff
perf tools: Give user better message if precise is not supported
authorDavid Ahern <dsahern@gmail.com>
Thu, 13 Sep 2012 20:59:15 +0000 (14:59 -0600)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 24 Oct 2012 16:20:11 +0000 (14:20 -0200)
Platforms (e.g., VM's) without support for precise mode get a confusing
error message. e.g.,
$ perf record -e cycles:p -a -- sleep 1

  Error: sys_perf_event_open() syscall returned with 95 (Operation not
  supported).  /bin/dmesg may provide additional information.

  No hardware sampling interrupt available. No APIC? If so then you can
  boot the kernel with the "lapic" boot parameter to force-enable it.
  sleep: Terminated

which is not clear that precise mode might be the root problem. With this
patch:

$ perf record -e cycles:p -fo /tmp/perf.data -- sleep 1
  Error:
  'precise' request may not be supported. Try removing 'p' modifier
  sleep: Terminated

v2: softened message to 'may not be' supported per Robert's suggestion

Signed-off-by: David Ahern <dsahern@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Robert Richter <robert.richter@amd.com>
Link: http://lkml.kernel.org/r/1347569955-54626-4-git-send-email-dsahern@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/builtin-record.c
tools/perf/builtin-top.c

index 73b5d7f9119482759be56761f17f01c21226e297..53c9892e96dd038ec3aa355db6fc00514dd75291 100644 (file)
@@ -317,6 +317,11 @@ try_again:
                                          perf_evsel__name(pos));
                                rc = -err;
                                goto out;
+                       } else if ((err == EOPNOTSUPP) && (attr->precise_ip)) {
+                               ui__error("\'precise\' request may not be supported. "
+                                         "Try removing 'p' modifier\n");
+                               rc = -err;
+                               goto out;
                        }
 
                        printf("\n");
index fb9da71eba1f63fdcd9e4a8fcbb20ac62f7ed107..f2ecd498c72da95df18661fdbf4a5457151f4ebd 100644 (file)
@@ -977,6 +977,10 @@ try_again:
                                ui__error("Too many events are opened.\n"
                                            "Try again after reducing the number of events\n");
                                goto out_err;
+                       } else if ((err == EOPNOTSUPP) && (attr->precise_ip)) {
+                               ui__error("\'precise\' request may not be supported. "
+                                         "Try removing 'p' modifier\n");
+                               goto out_err;
                        }
 
                        ui__error("The sys_perf_event_open() syscall "