diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-03-05 19:23:12 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-03-05 19:23:12 -0500 |
commit | f3969bf78f140f437f51787dfc2751943ba454d1 (patch) | |
tree | 291ffc7e38d987e8b6fbcbc38dd055818dc34a05 | |
parent | 98e990afa659769fe7ca1f2408fc7d2e946d5e50 (diff) | |
parent | b7c924274c456499264d1cfa3d44063bb11eb5db (diff) |
Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull perf fixes from Ingo Molnar:
"It contains three cherry-picked fixes from perf/core, which turned out
to be more urgent than we originally thought."
* 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
perf tools: Handle kernels that don't support attr.exclude_{guest,host}
perf tools: Change perf_guest default back to false
perf record: No build id option fails
-rw-r--r-- | tools/perf/builtin-record.c | 33 | ||||
-rw-r--r-- | tools/perf/builtin-top.c | 23 | ||||
-rw-r--r-- | tools/perf/perf.h | 1 | ||||
-rw-r--r-- | tools/perf/util/top.h | 1 | ||||
-rw-r--r-- | tools/perf/util/util.c | 2 |
5 files changed, 42 insertions, 18 deletions
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index 0abfb18b911f..227b6ae99785 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c | |||
@@ -204,6 +204,9 @@ static void perf_record__open(struct perf_record *rec) | |||
204 | 204 | ||
205 | if (opts->group && pos != first) | 205 | if (opts->group && pos != first) |
206 | group_fd = first->fd; | 206 | group_fd = first->fd; |
207 | fallback_missing_features: | ||
208 | if (opts->exclude_guest_missing) | ||
209 | attr->exclude_guest = attr->exclude_host = 0; | ||
207 | retry_sample_id: | 210 | retry_sample_id: |
208 | attr->sample_id_all = opts->sample_id_all_avail ? 1 : 0; | 211 | attr->sample_id_all = opts->sample_id_all_avail ? 1 : 0; |
209 | try_again: | 212 | try_again: |
@@ -217,15 +220,23 @@ try_again: | |||
217 | } else if (err == ENODEV && opts->cpu_list) { | 220 | } else if (err == ENODEV && opts->cpu_list) { |
218 | die("No such device - did you specify" | 221 | die("No such device - did you specify" |
219 | " an out-of-range profile CPU?\n"); | 222 | " an out-of-range profile CPU?\n"); |
220 | } else if (err == EINVAL && opts->sample_id_all_avail) { | 223 | } else if (err == EINVAL) { |
221 | /* | 224 | if (!opts->exclude_guest_missing && |
222 | * Old kernel, no attr->sample_id_type_all field | 225 | (attr->exclude_guest || attr->exclude_host)) { |
223 | */ | 226 | pr_debug("Old kernel, cannot exclude " |
224 | opts->sample_id_all_avail = false; | 227 | "guest or host samples.\n"); |
225 | if (!opts->sample_time && !opts->raw_samples && !time_needed) | 228 | opts->exclude_guest_missing = true; |
226 | attr->sample_type &= ~PERF_SAMPLE_TIME; | 229 | goto fallback_missing_features; |
227 | 230 | } else if (opts->sample_id_all_avail) { | |
228 | goto retry_sample_id; | 231 | /* |
232 | * Old kernel, no attr->sample_id_type_all field | ||
233 | */ | ||
234 | opts->sample_id_all_avail = false; | ||
235 | if (!opts->sample_time && !opts->raw_samples && !time_needed) | ||
236 | attr->sample_type &= ~PERF_SAMPLE_TIME; | ||
237 | |||
238 | goto retry_sample_id; | ||
239 | } | ||
229 | } | 240 | } |
230 | 241 | ||
231 | /* | 242 | /* |
@@ -503,9 +514,9 @@ static int __cmd_record(struct perf_record *rec, int argc, const char **argv) | |||
503 | return err; | 514 | return err; |
504 | } | 515 | } |
505 | 516 | ||
506 | if (!!rec->no_buildid | 517 | if (!rec->no_buildid |
507 | && !perf_header__has_feat(&session->header, HEADER_BUILD_ID)) { | 518 | && !perf_header__has_feat(&session->header, HEADER_BUILD_ID)) { |
508 | pr_err("Couldn't generating buildids. " | 519 | pr_err("Couldn't generate buildids. " |
509 | "Use --no-buildid to profile anyway.\n"); | 520 | "Use --no-buildid to profile anyway.\n"); |
510 | return -1; | 521 | return -1; |
511 | } | 522 | } |
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 |
diff --git a/tools/perf/perf.h b/tools/perf/perf.h index 64f8bee31ced..16e7d20eee83 100644 --- a/tools/perf/perf.h +++ b/tools/perf/perf.h | |||
@@ -199,6 +199,7 @@ struct perf_record_opts { | |||
199 | bool sample_address; | 199 | bool sample_address; |
200 | bool sample_time; | 200 | bool sample_time; |
201 | bool sample_id_all_avail; | 201 | bool sample_id_all_avail; |
202 | bool exclude_guest_missing; | ||
202 | bool system_wide; | 203 | bool system_wide; |
203 | bool period; | 204 | bool period; |
204 | unsigned int freq; | 205 | unsigned int freq; |
diff --git a/tools/perf/util/top.h b/tools/perf/util/top.h index a248f3c2c60d..f2eab81435ae 100644 --- a/tools/perf/util/top.h +++ b/tools/perf/util/top.h | |||
@@ -34,6 +34,7 @@ struct perf_top { | |||
34 | bool inherit; | 34 | bool inherit; |
35 | bool group; | 35 | bool group; |
36 | bool sample_id_all_avail; | 36 | bool sample_id_all_avail; |
37 | bool exclude_guest_missing; | ||
37 | bool dump_symtab; | 38 | bool dump_symtab; |
38 | const char *cpu_list; | 39 | const char *cpu_list; |
39 | struct hist_entry *sym_filter_entry; | 40 | struct hist_entry *sym_filter_entry; |
diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c index 813141047fc2..fb25d1329218 100644 --- a/tools/perf/util/util.c +++ b/tools/perf/util/util.c | |||
@@ -6,7 +6,7 @@ | |||
6 | * XXX We need to find a better place for these things... | 6 | * XXX We need to find a better place for these things... |
7 | */ | 7 | */ |
8 | bool perf_host = true; | 8 | bool perf_host = true; |
9 | bool perf_guest = true; | 9 | bool perf_guest = false; |
10 | 10 | ||
11 | void event_attr_init(struct perf_event_attr *attr) | 11 | void event_attr_init(struct perf_event_attr *attr) |
12 | { | 12 | { |