Skip to content

Commit c22497f

Browse files
Kan LiangIngo Molnar
authored andcommitted
perf/x86/intel: Support adaptive PEBS v4
Adaptive PEBS is a new way to report PEBS sampling information. Instead of a fixed size record for all PEBS events it allows to configure the PEBS record to only include the information needed. Events can then opt in to use such an extended record, or stay with a basic record which only contains the IP. The major new feature is to support LBRs in PEBS record. Besides normal LBR, this allows (much faster) large PEBS, while still supporting callstacks through callstack LBR. So essentially a lot of profiling can now be done without frequent interrupts, dropping the overhead significantly. The main requirement still is to use a period, and not use frequency mode, because frequency mode requires reevaluating the frequency on each overflow. The floating point state (XMM) is also supported, which allows efficient profiling of FP function arguments. Introduce specific drain function to handle variable length records. Use a new callback to parse the new record format, and also handle the STATUS field now being at a different offset. Add code to set up the configuration register. Since there is only a single register, all events either get the full super set of all events, or only the basic record. Originally-by: Andi Kleen <[email protected]> Signed-off-by: Kan Liang <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Arnaldo Carvalho de Melo <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Stephane Eranian <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Vince Weaver <[email protected]> Cc: [email protected] Cc: [email protected] Link: https://lkml.kernel.org/r/[email protected] [ Renamed GPRS => GP. ] Signed-off-by: Ingo Molnar <[email protected]>
1 parent 477f00f commit c22497f

File tree

6 files changed

+438
-26
lines changed

6 files changed

+438
-26
lines changed

arch/x86/events/intel/core.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2145,6 +2145,11 @@ static void intel_pmu_enable_fixed(struct perf_event *event)
21452145
bits <<= (idx * 4);
21462146
mask = 0xfULL << (idx * 4);
21472147

2148+
if (x86_pmu.intel_cap.pebs_baseline && event->attr.precise_ip) {
2149+
bits |= ICL_FIXED_0_ADAPTIVE << (idx * 4);
2150+
mask |= ICL_FIXED_0_ADAPTIVE << (idx * 4);
2151+
}
2152+
21482153
rdmsrl(hwc->config_base, ctrl_val);
21492154
ctrl_val &= ~mask;
21502155
ctrl_val |= bits;
@@ -3510,6 +3515,8 @@ static struct intel_excl_cntrs *allocate_excl_cntrs(int cpu)
35103515

35113516
int intel_cpuc_prepare(struct cpu_hw_events *cpuc, int cpu)
35123517
{
3518+
cpuc->pebs_record_size = x86_pmu.pebs_record_size;
3519+
35133520
if (x86_pmu.extra_regs || x86_pmu.lbr_sel_map) {
35143521
cpuc->shared_regs = allocate_shared_regs(cpu);
35153522
if (!cpuc->shared_regs)

0 commit comments

Comments
 (0)