Commit f3969bf7 authored by Linus Torvalds's avatar Linus Torvalds

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
parents 98e990af b7c92427
...@@ -204,6 +204,9 @@ static void perf_record__open(struct perf_record *rec) ...@@ -204,6 +204,9 @@ static void perf_record__open(struct perf_record *rec)
if (opts->group && pos != first) if (opts->group && pos != first)
group_fd = first->fd; group_fd = first->fd;
fallback_missing_features:
if (opts->exclude_guest_missing)
attr->exclude_guest = attr->exclude_host = 0;
retry_sample_id: retry_sample_id:
attr->sample_id_all = opts->sample_id_all_avail ? 1 : 0; attr->sample_id_all = opts->sample_id_all_avail ? 1 : 0;
try_again: try_again:
...@@ -217,15 +220,23 @@ static void perf_record__open(struct perf_record *rec) ...@@ -217,15 +220,23 @@ static void perf_record__open(struct perf_record *rec)
} else if (err == ENODEV && opts->cpu_list) { } else if (err == ENODEV && opts->cpu_list) {
die("No such device - did you specify" die("No such device - did you specify"
" an out-of-range profile CPU?\n"); " an out-of-range profile CPU?\n");
} else if (err == EINVAL && opts->sample_id_all_avail) { } else if (err == EINVAL) {
/* if (!opts->exclude_guest_missing &&
* Old kernel, no attr->sample_id_type_all field (attr->exclude_guest || attr->exclude_host)) {
*/ pr_debug("Old kernel, cannot exclude "
opts->sample_id_all_avail = false; "guest or host samples.\n");
if (!opts->sample_time && !opts->raw_samples && !time_needed) opts->exclude_guest_missing = true;
attr->sample_type &= ~PERF_SAMPLE_TIME; goto fallback_missing_features;
} else if (opts->sample_id_all_avail) {
goto retry_sample_id; /*
* Old kernel, no attr->sample_id_type_all field
*/
opts->sample_id_all_avail = false;
if (!opts->sample_time && !opts->raw_samples && !time_needed)
attr->sample_type &= ~PERF_SAMPLE_TIME;
goto retry_sample_id;
}
} }
/* /*
...@@ -503,9 +514,9 @@ static int __cmd_record(struct perf_record *rec, int argc, const char **argv) ...@@ -503,9 +514,9 @@ static int __cmd_record(struct perf_record *rec, int argc, const char **argv)
return err; return err;
} }
if (!!rec->no_buildid if (!rec->no_buildid
&& !perf_header__has_feat(&session->header, HEADER_BUILD_ID)) { && !perf_header__has_feat(&session->header, HEADER_BUILD_ID)) {
pr_err("Couldn't generating buildids. " pr_err("Couldn't generate buildids. "
"Use --no-buildid to profile anyway.\n"); "Use --no-buildid to profile anyway.\n");
return -1; return -1;
} }
......
...@@ -857,6 +857,9 @@ static void perf_top__start_counters(struct perf_top *top) ...@@ -857,6 +857,9 @@ static void perf_top__start_counters(struct perf_top *top)
attr->mmap = 1; attr->mmap = 1;
attr->comm = 1; attr->comm = 1;
attr->inherit = top->inherit; attr->inherit = top->inherit;
fallback_missing_features:
if (top->exclude_guest_missing)
attr->exclude_guest = attr->exclude_host = 0;
retry_sample_id: retry_sample_id:
attr->sample_id_all = top->sample_id_all_avail ? 1 : 0; attr->sample_id_all = top->sample_id_all_avail ? 1 : 0;
try_again: try_again:
...@@ -868,12 +871,20 @@ static void perf_top__start_counters(struct perf_top *top) ...@@ -868,12 +871,20 @@ static void perf_top__start_counters(struct perf_top *top)
if (err == EPERM || err == EACCES) { if (err == EPERM || err == EACCES) {
ui__error_paranoid(); ui__error_paranoid();
goto out_err; goto out_err;
} else if (err == EINVAL && top->sample_id_all_avail) { } else if (err == EINVAL) {
/* if (!top->exclude_guest_missing &&
* Old kernel, no attr->sample_id_type_all field (attr->exclude_guest || attr->exclude_host)) {
*/ pr_debug("Old kernel, cannot exclude "
top->sample_id_all_avail = false; "guest or host samples.\n");
goto retry_sample_id; top->exclude_guest_missing = true;
goto fallback_missing_features;
} else if (top->sample_id_all_avail) {
/*
* Old kernel, no attr->sample_id_type_all field
*/
top->sample_id_all_avail = false;
goto retry_sample_id;
}
} }
/* /*
* If it's cycles then fall back to hrtimer * If it's cycles then fall back to hrtimer
......
...@@ -199,6 +199,7 @@ struct perf_record_opts { ...@@ -199,6 +199,7 @@ struct perf_record_opts {
bool sample_address; bool sample_address;
bool sample_time; bool sample_time;
bool sample_id_all_avail; bool sample_id_all_avail;
bool exclude_guest_missing;
bool system_wide; bool system_wide;
bool period; bool period;
unsigned int freq; unsigned int freq;
......
...@@ -34,6 +34,7 @@ struct perf_top { ...@@ -34,6 +34,7 @@ struct perf_top {
bool inherit; bool inherit;
bool group; bool group;
bool sample_id_all_avail; bool sample_id_all_avail;
bool exclude_guest_missing;
bool dump_symtab; bool dump_symtab;
const char *cpu_list; const char *cpu_list;
struct hist_entry *sym_filter_entry; struct hist_entry *sym_filter_entry;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* XXX We need to find a better place for these things... * XXX We need to find a better place for these things...
*/ */
bool perf_host = true; bool perf_host = true;
bool perf_guest = true; bool perf_guest = false;
void event_attr_init(struct perf_event_attr *attr) void event_attr_init(struct perf_event_attr *attr)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment