Commit e18bf526 authored by Yan, Zheng's avatar Yan, Zheng Committed by Ingo Molnar

perf/x86/intel: Allocate space for storing LBR stack

When the LBR call stack is enabled, it is necessary to save/restore
the LBR stack on context switch. We can use pmu specific data to
store LBR stack when task is scheduled out. This patch adds code
that allocates the pmu specific data.
Signed-off-by: default avatarYan, Zheng <>
Signed-off-by: default avatarKan Liang <>
Signed-off-by: default avatarPeter Zijlstra (Intel) <>
Reviewed-by: default avatarStephane Eranian <>
Cc: Andy Lutomirski <>
Cc: Arnaldo Carvalho de Melo <>
Cc: Linus Torvalds <>
Cc: Paul Mackerras <>
Cc: Vince Weaver <>
Link: Ingo Molnar's avatarIngo Molnar <>
parent 5a158c3c
......@@ -432,6 +432,9 @@ int x86_pmu_hw_config(struct perf_event *event)
if (event->attr.branch_sample_type & PERF_SAMPLE_BRANCH_CALL_STACK)
event->attach_state |= PERF_ATTACH_TASK_DATA;
* Generate PMC IRQs:
* (keep 'enabled' bit clear for now)
......@@ -1950,6 +1953,7 @@ static struct pmu pmu = {
.event_idx = x86_pmu_event_idx,
.sched_task = x86_pmu_sched_task,
.task_ctx_size = sizeof(struct x86_perf_task_context),
void arch_perf_update_userpage(struct perf_event *event,
......@@ -516,6 +516,13 @@ struct x86_pmu {
struct perf_guest_switch_msr *(*guest_get_msrs)(int *nr);
struct x86_perf_task_context {
u64 lbr_from[MAX_LBR_ENTRIES];
u64 lbr_to[MAX_LBR_ENTRIES];
int lbr_callstack_users;
int lbr_stack_state;
enum {
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment