diff options
Diffstat (limited to 'tools/perf/builtin-top.c')
-rw-r--r-- | tools/perf/builtin-top.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index dd162aa24baa..ecff31257eb3 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c | |||
@@ -857,6 +857,9 @@ static void perf_top__start_counters(struct perf_top *top) | |||
857 | attr->mmap = 1; | 857 | attr->mmap = 1; |
858 | attr->comm = 1; | 858 | attr->comm = 1; |
859 | attr->inherit = top->inherit; | 859 | attr->inherit = top->inherit; |
860 | fallback_missing_features: | ||
861 | if (top->exclude_guest_missing) | ||
862 | attr->exclude_guest = attr->exclude_host = 0; | ||
860 | retry_sample_id: | 863 | retry_sample_id: |
861 | attr->sample_id_all = top->sample_id_all_avail ? 1 : 0; | 864 | attr->sample_id_all = top->sample_id_all_avail ? 1 : 0; |
862 | try_again: | 865 | try_again: |
@@ -868,12 +871,20 @@ try_again: | |||
868 | if (err == EPERM || err == EACCES) { | 871 | if (err == EPERM || err == EACCES) { |
869 | ui__error_paranoid(); | 872 | ui__error_paranoid(); |
870 | goto out_err; | 873 | goto out_err; |
871 | } else if (err == EINVAL && top->sample_id_all_avail) { | 874 | } else if (err == EINVAL) { |
872 | /* | 875 | if (!top->exclude_guest_missing && |
873 | * Old kernel, no attr->sample_id_type_all field | 876 | (attr->exclude_guest || attr->exclude_host)) { |
874 | */ | 877 | pr_debug("Old kernel, cannot exclude " |
875 | top->sample_id_all_avail = false; | 878 | "guest or host samples.\n"); |
876 | goto retry_sample_id; | 879 | top->exclude_guest_missing = true; |
880 | goto fallback_missing_features; | ||
881 | } else if (top->sample_id_all_avail) { | ||
882 | /* | ||
883 | * Old kernel, no attr->sample_id_type_all field | ||
884 | */ | ||
885 | top->sample_id_all_avail = false; | ||
886 | goto retry_sample_id; | ||
887 | } | ||
877 | } | 888 | } |
878 | /* | 889 | /* |
879 | * If it's cycles then fall back to hrtimer | 890 | * If it's cycles then fall back to hrtimer |