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:
@@ -283,6 +283,8 @@ static int create_perf_stat_counter(struct perf_evsel *evsel,
|
|||||||
{
|
{
|
||||||
struct perf_event_attr *attr = &evsel->attr;
|
struct perf_event_attr *attr = &evsel->attr;
|
||||||
struct xyarray *group_fd = NULL;
|
struct xyarray *group_fd = NULL;
|
||||||
|
bool exclude_guest_missing = false;
|
||||||
|
int ret;
|
||||||
|
|
||||||
if (group && evsel != first)
|
if (group && evsel != first)
|
||||||
group_fd = first->fd;
|
group_fd = first->fd;
|
||||||
@@ -293,16 +295,39 @@ static int create_perf_stat_counter(struct perf_evsel *evsel,
|
|||||||
|
|
||||||
attr->inherit = !no_inherit;
|
attr->inherit = !no_inherit;
|
||||||
|
|
||||||
if (system_wide)
|
retry:
|
||||||
return perf_evsel__open_per_cpu(evsel, evsel_list->cpus,
|
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);
|
group, group_fd);
|
||||||
|
if (ret)
|
||||||
|
goto check_ret;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (!target_pid && !target_tid && (!group || evsel == first)) {
|
if (!target_pid && !target_tid && (!group || evsel == first)) {
|
||||||
attr->disabled = 1;
|
attr->disabled = 1;
|
||||||
attr->enable_on_exec = 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);
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@@ -296,7 +296,7 @@ int build_id_cache__add_s(const char *sbuild_id, const char *debugdir,
|
|||||||
if (mkdir_p(filename, 0755))
|
if (mkdir_p(filename, 0755))
|
||||||
goto out_free;
|
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 (access(filename, F_OK)) {
|
||||||
if (is_kallsyms) {
|
if (is_kallsyms) {
|
||||||
|
Reference in New Issue
Block a user