aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-top.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2012-02-14 11:05:30 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2012-02-14 11:05:30 -0500
commit0c9781280fb672ca09c997df3f14ba506bbdb977 (patch)
treec69f428b2717025d5afb2a8997d82ff9a4b8aea1 /tools/perf/builtin-top.c
parent7e1ccd3804281fc0755eb726b654469c40a96d89 (diff)
perf tools: Handle kernels that don't support attr.exclude_{guest,host}
Just fall back to resetting those fields, if set, warning the user that that feature is not available. If guest samples appear they will just be discarded because no struct machine will be found and thus the event will be accounted as not handled and dropped, see 0c09571. Reported-by: Namhyung Kim <namhyung@gmail.com> Tested-by: Joerg Roedel <joerg.roedel@amd.com> Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Joerg Roedel <joerg.roedel@amd.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/n/tip-vuwxig36mzprl5n7nzvnxxsh@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/builtin-top.c')
-rw-r--r--tools/perf/builtin-top.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 5a88c0dadf15..02e11ff5a729 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -872,6 +872,9 @@ static void perf_top__start_counters(struct perf_top *top)
872 attr->mmap = 1; 872 attr->mmap = 1;
873 attr->comm = 1; 873 attr->comm = 1;
874 attr->inherit = top->inherit; 874 attr->inherit = top->inherit;
875fallback_missing_features:
876 if (top->exclude_guest_missing)
877 attr->exclude_guest = attr->exclude_host = 0;
875retry_sample_id: 878retry_sample_id:
876 attr->sample_id_all = top->sample_id_all_avail ? 1 : 0; 879 attr->sample_id_all = top->sample_id_all_avail ? 1 : 0;
877try_again: 880try_again:
@@ -883,12 +886,20 @@ try_again:
883 if (err == EPERM || err == EACCES) { 886 if (err == EPERM || err == EACCES) {
884 ui__error_paranoid(); 887 ui__error_paranoid();
885 goto out_err; 888 goto out_err;
886 } else if (err == EINVAL && top->sample_id_all_avail) { 889 } else if (err == EINVAL) {
887 /* 890 if (!top->exclude_guest_missing &&
888 * Old kernel, no attr->sample_id_type_all field 891 (attr->exclude_guest || attr->exclude_host)) {
889 */ 892 pr_debug("Old kernel, cannot exclude "
890 top->sample_id_all_avail = false; 893 "guest or host samples.\n");
891 goto retry_sample_id; 894 top->exclude_guest_missing = true;
895 goto fallback_missing_features;
896 } else if (top->sample_id_all_avail) {
897 /*
898 * Old kernel, no attr->sample_id_type_all field
899 */
900 top->sample_id_all_avail = false;
901 goto retry_sample_id;
902 }
892 } 903 }
893 /* 904 /*
894 * If it's cycles then fall back to hrtimer 905 * If it's cycles then fall back to hrtimer