Commit 05418157 authored by Kan Liang's avatar Kan Liang Committed by Yunying Sun
Browse files

perf/x86: Add PERF_X86_EVENT_NEEDS_BRANCH_STACK flag

mainline inclusion
from mainline-v6.8-rc1
commit 85846b27072defc7ab3dcee7ff36563a040079dc
category: feature
bugzilla: https://gitee.com/openeuler/intel-kernel/issues/I8XR3G
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=85846b27072defc7ab3dcee7ff36563a040079dc



-------------------------------------

Currently, branch_sample_type !=0 is used to check whether a branch
stack setup is required. But it doesn't check the sample type,
unnecessary branch stack setup may be done for a counting event. E.g.,
perf record -e "{branch-instructions,branch-misses}:S" -j any
Also, the event only with the new PERF_SAMPLE_BRANCH_COUNTERS branch
sample type may not require a branch stack setup either.

Add a new flag NEEDS_BRANCH_STACK to indicate whether the event requires
a branch stack setup. Replace the needs_branch_stack() by checking the
new flag.

The counting event check is implemented here. The later patch will take
the new PERF_SAMPLE_BRANCH_COUNTERS into account.

Intel-SIG: commit 85846b27072d perf/x86: Add PERF_X86_EVENT_NEEDS_BRANCH_STACK flag
Backport LBR branch counter support to kernel v6.6.

Signed-off-by: default avatarKan Liang <kan.liang@linux.intel.com>
Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20231025201626.3000228-2-kan.liang@linux.intel.com


Signed-off-by: default avatarYunying Sun <yunying.sun@intel.com>
parent 1c36084b
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment