lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Sun, 19 Oct 2014 17:55:08 -0400 From: Kan Liang <kan.liang@...el.com> To: a.p.zijlstra@...llo.nl, eranian@...gle.com Cc: linux-kernel@...r.kernel.org, mingo@...hat.com, paulus@...ba.org, acme@...nel.org, jolsa@...hat.com, ak@...ux.intel.com, Kan Liang <kan.liang@...el.com>, "Yan, Zheng" <zheng.z.yan@...el.com> Subject: [PATCH V6 13/17] perf, x86: enable LBR callstack when recording callchain Only enable LBR callstack when user requires fp callgraph. The feature is not available when PERF_SAMPLE_BRANCH_STACK or PERF_SAMPLE_STACK_USER is required. Also, this feature only affects how to get user callchain. The kernel callchain is always got by frame pointers. Signed-off-by: Yan, Zheng <zheng.z.yan@...el.com> Signed-off-by: Kan Liang <kan.liang@...el.com> --- arch/x86/kernel/cpu/perf_event.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c index 9656b9e..b3256a3 100644 --- a/arch/x86/kernel/cpu/perf_event.c +++ b/arch/x86/kernel/cpu/perf_event.c @@ -424,10 +424,24 @@ int x86_pmu_hw_config(struct perf_event *event) if (!event->attr.exclude_kernel) *br_type |= PERF_SAMPLE_BRANCH_KERNEL; } - } + } else if (x86_pmu_has_lbr_callstack() && + (event->attr.sample_type & PERF_SAMPLE_CALLCHAIN) && + !(event->attr.sample_type & PERF_SAMPLE_STACK_USER) && + !has_branch_stack(event) && + !event->attr.exclude_user && + (event->attach_state & PERF_ATTACH_TASK)) { + /* + * user did not specify branch_sample_type, + * try using the LBR call stack facility to + * record call chains of user program. + */ + event->attr.branch_sample_type = + PERF_SAMPLE_BRANCH_USER | + PERF_SAMPLE_BRANCH_CALL_STACK; - if (event->attr.branch_sample_type & PERF_SAMPLE_BRANCH_CALL_STACK) + /* needs PMU specific data to save LBR stack */ event->attach_state |= PERF_ATTACH_TASK_DATA; + } /* * Generate PMC IRQs: -- 1.8.3.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@...r.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists