Cherry picked fixes from perf/core, together with the kernel fix (1018faa),

the sampling tools (top, record) are back working on AMD systems.
 
 Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.14 (GNU/Linux)
 
 iQIcBAABAgAGBQJPUmaEAAoJENZQFvNTUqpA12IP/1JyMC7jtS6PUTKYOnTfwe51
 hTdFBUCAquj2cFJNWOe9AidBe1eOUFMgdNBW3hEhvZA3arOJVO+eAyUb72y24yQm
 mbn1GMIYEj3MR+nESo7HqQ4J9byE1ngNp8IYZk3wmTit+6k8XaF2dN4o+3ZPdY6S
 zkOT4bjzG8C4Y614S/qXdulS42EJUG/oyhB0Fhom2LEFt+WCCB/b0Z2XIZuh2dEt
 E1oEzy5wcQZMhIFpl4LWrS/zPJ8+NBAJdBmuNvHoF5IFZxIqcK4/vUWxMVVzMc3f
 xVO6rzzcpENHF/qVXztDzeIfVcnMIKBY2cEzsZI17e+gH+Mdda0ByQXwbbG4ccxF
 DIxy6gwQkUpTX8tvxv1E2LTFl7qAEQ+2Ryv3yY54jjJ/UwayesEFZk0yPnnOauV6
 3wHKqVmyz0We+0zsh5C7UWUiA2DI+dR1xxONd7c1FoXNRpFxCwd1DGBhG5sWTjOi
 9Loh0Zq2SyD1r5f6nDbdKw1e9LaK25DLZrlkQUcGyB+sZcyQL4oYDAZK9dJHdUNj
 fzaQb7e+3fFZP0hcVhUy17tTWR67pg6BGljrerVD75AKZjPpsGCj4t36yv80y+fK
 yIgLyTcbGHFubqc2EvxJ9BMhSKjla/s5sqvsrQv/5OYPNrtBVaHBU5Xg+xbF+ni0
 hG0MiE02CAxCau6Yxh56
 =sbHZ
 -----END PGP SIGNATURE-----

Merge tag 'perf-urgent-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent

Cherry picked fixes from perf/core, together with the kernel fix (1018faa),
the sampling tools (top, record) are back working on AMD systems.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
Ingo Molnar 2012-03-05 09:05:44 +01:00
commit b7c924274c
5 changed files with 41 additions and 17 deletions

View file

@ -204,6 +204,9 @@ static void perf_record__open(struct perf_record *rec)
if (opts->group && pos != first)
group_fd = first->fd;
fallback_missing_features:
if (opts->exclude_guest_missing)
attr->exclude_guest = attr->exclude_host = 0;
retry_sample_id:
attr->sample_id_all = opts->sample_id_all_avail ? 1 : 0;
try_again:
@ -217,15 +220,23 @@ try_again:
} else if (err == ENODEV && opts->cpu_list) {
die("No such device - did you specify"
" an out-of-range profile CPU?\n");
} else if (err == EINVAL && opts->sample_id_all_avail) {
/*
* 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;
} else if (err == EINVAL) {
if (!opts->exclude_guest_missing &&
(attr->exclude_guest || attr->exclude_host)) {
pr_debug("Old kernel, cannot exclude "
"guest or host samples.\n");
opts->exclude_guest_missing = true;
goto fallback_missing_features;
} else if (opts->sample_id_all_avail) {
/*
* 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;
goto retry_sample_id;
}
}
/*
@ -503,9 +514,9 @@ static int __cmd_record(struct perf_record *rec, int argc, const char **argv)
return err;
}
if (!!rec->no_buildid
if (!rec->no_buildid
&& !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");
return -1;
}

View file

@ -857,6 +857,9 @@ static void perf_top__start_counters(struct perf_top *top)
attr->mmap = 1;
attr->comm = 1;
attr->inherit = top->inherit;
fallback_missing_features:
if (top->exclude_guest_missing)
attr->exclude_guest = attr->exclude_host = 0;
retry_sample_id:
attr->sample_id_all = top->sample_id_all_avail ? 1 : 0;
try_again:
@ -868,12 +871,20 @@ try_again:
if (err == EPERM || err == EACCES) {
ui__error_paranoid();
goto out_err;
} else if (err == EINVAL && top->sample_id_all_avail) {
/*
* Old kernel, no attr->sample_id_type_all field
*/
top->sample_id_all_avail = false;
goto retry_sample_id;
} else if (err == EINVAL) {
if (!top->exclude_guest_missing &&
(attr->exclude_guest || attr->exclude_host)) {
pr_debug("Old kernel, cannot exclude "
"guest or host samples.\n");
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

View file

@ -199,6 +199,7 @@ struct perf_record_opts {
bool sample_address;
bool sample_time;
bool sample_id_all_avail;
bool exclude_guest_missing;
bool system_wide;
bool period;
unsigned int freq;

View file

@ -34,6 +34,7 @@ struct perf_top {
bool inherit;
bool group;
bool sample_id_all_avail;
bool exclude_guest_missing;
bool dump_symtab;
const char *cpu_list;
struct hist_entry *sym_filter_entry;

View file

@ -6,7 +6,7 @@
* XXX We need to find a better place for these things...
*/
bool perf_host = true;
bool perf_guest = true;
bool perf_guest = false;
void event_attr_init(struct perf_event_attr *attr)
{