Fixes for perf/urgent:

. Add fallback in 'perf stat' for kernels that don't support
   perf_event_attr.exclude_guest, from Stephane Eranian.
 
 . Fix build id cache add routine to take the size of the buffer and not of a
   pointer, from Namhyung Kim.
 
 Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.14 (GNU/Linux)
 
 iQIcBAABAgAGBQJPoU1uAAoJENZQFvNTUqpABnwP/j4rbDJ+3Ck+L5npAWCKbBCn
 g2ubvySCDEbwNBQCUDRUdk7I8Man1NJwKgf/zojpYT/9891pH6ADdWWtxhNjfinl
 QcjrbZDyHflO8BlcXRs0JpVCiSei4FSFXTPPjWPgSu0iCj8xlob3+/OKnrYQvwOQ
 8niRXzh5CWngFfpG3nT0kIehlvAYpvwAOcZz6X0fFXpuv/Ws8HY3NdMOYkYVvMjg
 KRMqjPz80tESM4gDw3V/MmX2M8TBDwrRlH0FZVX1tM790UxcxMHrXoeuUej+Y3ka
 qNzWv2zuv4LcpAyeCCwLvTTcjQ1Cd08LHve46enxjNZESrHZJjs+Bs/TXiQqemYe
 p6qkoDK590PYxA8C/cTVgN5Di9ELEES7bDllaTcezZrLFztnONMXwwWEPiHRCkMz
 +YOBJoCKJ7YX7rGREpn/H52wp5Dc8YFGJKXyO4+1NjbX2irOYFNXuD/YM8W2Rxp0
 H99gwwKgJ5BK3ggxI+XJl8n/4nrEMRysnbwonEmeouffoK85aG7Oo4WUWdx2ZXn7
 I5EJajXLSWzjOvIqoxqbmcWgwpr20fTdl0d5+ML+M1KYB/A4xb0HBk2R9u91nHXi
 QTO1jt2YLlq49jqnjAj1O+X5sRLsJOpxhqQ94AU/gujgkktRHXdzeIJ6oUbTiDT0
 zKH1qEhGTJV8KePgu+ph
 =ixC8
 -----END PGP SIGNATURE-----

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

Fixes for perf/urgent:

- Add fallback in 'perf stat' for kernels that don't support
  perf_event_attr.exclude_guest, from Stephane Eranian.

- Fix build id cache add routine to take the size of the buffer and not of a
  pointer, from Namhyung Kim.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
This commit is contained in:
Ingo Molnar 2012-05-02 19:33:34 +02:00
commit 4c85703626
2 changed files with 30 additions and 5 deletions

View File

@ -283,6 +283,8 @@ static int create_perf_stat_counter(struct perf_evsel *evsel,
{
struct perf_event_attr *attr = &evsel->attr;
struct xyarray *group_fd = NULL;
bool exclude_guest_missing = false;
int ret;
if (group && evsel != first)
group_fd = first->fd;
@ -293,16 +295,39 @@ static int create_perf_stat_counter(struct perf_evsel *evsel,
attr->inherit = !no_inherit;
if (system_wide)
return perf_evsel__open_per_cpu(evsel, evsel_list->cpus,
retry:
if (exclude_guest_missing)
evsel->attr.exclude_guest = evsel->attr.exclude_host = 0;
if (system_wide) {
ret = perf_evsel__open_per_cpu(evsel, evsel_list->cpus,
group, group_fd);
if (ret)
goto check_ret;
return 0;
}
if (!target_pid && !target_tid && (!group || evsel == first)) {
attr->disabled = 1;
attr->enable_on_exec = 1;
}
return perf_evsel__open_per_thread(evsel, evsel_list->threads,
ret = perf_evsel__open_per_thread(evsel, evsel_list->threads,
group, group_fd);
if (!ret)
return 0;
/* fall through */
check_ret:
if (ret && errno == EINVAL) {
if (!exclude_guest_missing &&
(evsel->attr.exclude_guest || evsel->attr.exclude_host)) {
pr_debug("Old kernel, cannot exclude "
"guest or host samples.\n");
exclude_guest_missing = true;
goto retry;
}
}
return ret;
}
/*

View File

@ -296,7 +296,7 @@ int build_id_cache__add_s(const char *sbuild_id, const char *debugdir,
if (mkdir_p(filename, 0755))
goto out_free;
snprintf(filename + len, sizeof(filename) - len, "/%s", sbuild_id);
snprintf(filename + len, size - len, "/%s", sbuild_id);
if (access(filename, F_OK)) {
if (is_kallsyms) {