aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorYan, Zheng <zheng.z.yan@intel.com>2014-11-04 21:56:06 -0500
committerIngo Molnar <mingo@kernel.org>2015-02-18 11:16:11 -0500
commita46a23000198d929391aa9dac8de68734efa2703 (patch)
tree667ff791575984b15e3e6c430668125141497758 /kernel
parent76cb2c617f12a4dd53c0e899972813b805ad6cc2 (diff)
perf: Simplify the branch stack check
Use event->attr.branch_sample_type to replace intel_pmu_needs_lbr_smpl() for avoiding duplicated code that implicitly enables the LBR. Currently, branch stack can be enabled by user explicitly requesting branch sampling or implicit branch sampling to correct PEBS skid. For user explicitly requested branch sampling, the branch_sample_type is explicitly set by user. For PEBS case, the branch_sample_type is also implicitly set to PERF_SAMPLE_BRANCH_ANY in x86_pmu_hw_config. Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com> Signed-off-by: Kan Liang <kan.liang@intel.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: Arnaldo Carvalho de Melo <acme@kernel.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Paul Mackerras <paulus@samba.org> Cc: eranian@google.com Cc: jolsa@redhat.com Link: http://lkml.kernel.org/r/1415156173-10035-11-git-send-email-kan.liang@intel.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/events/core.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/kernel/events/core.c b/kernel/events/core.c
index 84451c0debba..257eccf9afd4 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -7232,6 +7232,9 @@ perf_event_alloc(struct perf_event_attr *attr, int cpu,
7232 if (attr->inherit && (attr->read_format & PERF_FORMAT_GROUP)) 7232 if (attr->inherit && (attr->read_format & PERF_FORMAT_GROUP))
7233 goto err_ns; 7233 goto err_ns;
7234 7234
7235 if (!has_branch_stack(event))
7236 event->attr.branch_sample_type = 0;
7237
7235 pmu = perf_init_event(event); 7238 pmu = perf_init_event(event);
7236 if (!pmu) 7239 if (!pmu)
7237 goto err_ns; 7240 goto err_ns;