Skip to content

Commit 0d0b608

Browse files
committed
perf/x86/intel: Expose existence of callback support to KVM
Add a "has_callstack" field to the x86_pmu_lbr structure used to pass information to KVM, and set it accordingly in x86_perf_get_lbr(). KVM will use has_callstack to avoid trying to create perf LBR events with PERF_SAMPLE_BRANCH_CALL_STACK on CPUs that don't support callstacks. Reviewed-by: Mingwei Zhang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Sean Christopherson <[email protected]>
1 parent 447112d commit 0d0b608

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

arch/x86/events/intel/lbr.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1693,6 +1693,7 @@ void x86_perf_get_lbr(struct x86_pmu_lbr *lbr)
16931693
lbr->from = x86_pmu.lbr_from;
16941694
lbr->to = x86_pmu.lbr_to;
16951695
lbr->info = x86_pmu.lbr_info;
1696+
lbr->has_callstack = x86_pmu_has_lbr_callstack();
16961697
}
16971698
EXPORT_SYMBOL_GPL(x86_perf_get_lbr);
16981699

arch/x86/include/asm/perf_event.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -555,6 +555,7 @@ struct x86_pmu_lbr {
555555
unsigned int from;
556556
unsigned int to;
557557
unsigned int info;
558+
bool has_callstack;
558559
};
559560

560561
extern void perf_get_x86_pmu_capability(struct x86_pmu_capability *cap);

0 commit comments

Comments
 (0)