Path: blob/master/arch/x86/kernel/cpu/perf_event_intel_ds.c
10699 views
#ifdef CONFIG_CPU_SUP_INTEL12/* The maximal number of PEBS events: */3#define MAX_PEBS_EVENTS 445/* The size of a BTS record in bytes: */6#define BTS_RECORD_SIZE 2478#define BTS_BUFFER_SIZE (PAGE_SIZE << 4)9#define PEBS_BUFFER_SIZE PAGE_SIZE1011/*12* pebs_record_32 for p4 and core not supported1314struct pebs_record_32 {15u32 flags, ip;16u32 ax, bc, cx, dx;17u32 si, di, bp, sp;18};1920*/2122struct pebs_record_core {23u64 flags, ip;24u64 ax, bx, cx, dx;25u64 si, di, bp, sp;26u64 r8, r9, r10, r11;27u64 r12, r13, r14, r15;28};2930struct pebs_record_nhm {31u64 flags, ip;32u64 ax, bx, cx, dx;33u64 si, di, bp, sp;34u64 r8, r9, r10, r11;35u64 r12, r13, r14, r15;36u64 status, dla, dse, lat;37};3839/*40* A debug store configuration.41*42* We only support architectures that use 64bit fields.43*/44struct debug_store {45u64 bts_buffer_base;46u64 bts_index;47u64 bts_absolute_maximum;48u64 bts_interrupt_threshold;49u64 pebs_buffer_base;50u64 pebs_index;51u64 pebs_absolute_maximum;52u64 pebs_interrupt_threshold;53u64 pebs_event_reset[MAX_PEBS_EVENTS];54};5556static void init_debug_store_on_cpu(int cpu)57{58struct debug_store *ds = per_cpu(cpu_hw_events, cpu).ds;5960if (!ds)61return;6263wrmsr_on_cpu(cpu, MSR_IA32_DS_AREA,64(u32)((u64)(unsigned long)ds),65(u32)((u64)(unsigned long)ds >> 32));66}6768static void fini_debug_store_on_cpu(int cpu)69{70if (!per_cpu(cpu_hw_events, cpu).ds)71return;7273wrmsr_on_cpu(cpu, MSR_IA32_DS_AREA, 0, 0);74}7576static int alloc_pebs_buffer(int cpu)77{78struct debug_store *ds = per_cpu(cpu_hw_events, cpu).ds;79int node = cpu_to_node(cpu);80int max, thresh = 1; /* always use a single PEBS record */81void *buffer;8283if (!x86_pmu.pebs)84return 0;8586buffer = kmalloc_node(PEBS_BUFFER_SIZE, GFP_KERNEL | __GFP_ZERO, node);87if (unlikely(!buffer))88return -ENOMEM;8990max = PEBS_BUFFER_SIZE / x86_pmu.pebs_record_size;9192ds->pebs_buffer_base = (u64)(unsigned long)buffer;93ds->pebs_index = ds->pebs_buffer_base;94ds->pebs_absolute_maximum = ds->pebs_buffer_base +95max * x86_pmu.pebs_record_size;9697ds->pebs_interrupt_threshold = ds->pebs_buffer_base +98thresh * x86_pmu.pebs_record_size;99100return 0;101}102103static void release_pebs_buffer(int cpu)104{105struct debug_store *ds = per_cpu(cpu_hw_events, cpu).ds;106107if (!ds || !x86_pmu.pebs)108return;109110kfree((void *)(unsigned long)ds->pebs_buffer_base);111ds->pebs_buffer_base = 0;112}113114static int alloc_bts_buffer(int cpu)115{116struct debug_store *ds = per_cpu(cpu_hw_events, cpu).ds;117int node = cpu_to_node(cpu);118int max, thresh;119void *buffer;120121if (!x86_pmu.bts)122return 0;123124buffer = kmalloc_node(BTS_BUFFER_SIZE, GFP_KERNEL | __GFP_ZERO, node);125if (unlikely(!buffer))126return -ENOMEM;127128max = BTS_BUFFER_SIZE / BTS_RECORD_SIZE;129thresh = max / 16;130131ds->bts_buffer_base = (u64)(unsigned long)buffer;132ds->bts_index = ds->bts_buffer_base;133ds->bts_absolute_maximum = ds->bts_buffer_base +134max * BTS_RECORD_SIZE;135ds->bts_interrupt_threshold = ds->bts_absolute_maximum -136thresh * BTS_RECORD_SIZE;137138return 0;139}140141static void release_bts_buffer(int cpu)142{143struct debug_store *ds = per_cpu(cpu_hw_events, cpu).ds;144145if (!ds || !x86_pmu.bts)146return;147148kfree((void *)(unsigned long)ds->bts_buffer_base);149ds->bts_buffer_base = 0;150}151152static int alloc_ds_buffer(int cpu)153{154int node = cpu_to_node(cpu);155struct debug_store *ds;156157ds = kmalloc_node(sizeof(*ds), GFP_KERNEL | __GFP_ZERO, node);158if (unlikely(!ds))159return -ENOMEM;160161per_cpu(cpu_hw_events, cpu).ds = ds;162163return 0;164}165166static void release_ds_buffer(int cpu)167{168struct debug_store *ds = per_cpu(cpu_hw_events, cpu).ds;169170if (!ds)171return;172173per_cpu(cpu_hw_events, cpu).ds = NULL;174kfree(ds);175}176177static void release_ds_buffers(void)178{179int cpu;180181if (!x86_pmu.bts && !x86_pmu.pebs)182return;183184get_online_cpus();185for_each_online_cpu(cpu)186fini_debug_store_on_cpu(cpu);187188for_each_possible_cpu(cpu) {189release_pebs_buffer(cpu);190release_bts_buffer(cpu);191release_ds_buffer(cpu);192}193put_online_cpus();194}195196static void reserve_ds_buffers(void)197{198int bts_err = 0, pebs_err = 0;199int cpu;200201x86_pmu.bts_active = 0;202x86_pmu.pebs_active = 0;203204if (!x86_pmu.bts && !x86_pmu.pebs)205return;206207if (!x86_pmu.bts)208bts_err = 1;209210if (!x86_pmu.pebs)211pebs_err = 1;212213get_online_cpus();214215for_each_possible_cpu(cpu) {216if (alloc_ds_buffer(cpu)) {217bts_err = 1;218pebs_err = 1;219}220221if (!bts_err && alloc_bts_buffer(cpu))222bts_err = 1;223224if (!pebs_err && alloc_pebs_buffer(cpu))225pebs_err = 1;226227if (bts_err && pebs_err)228break;229}230231if (bts_err) {232for_each_possible_cpu(cpu)233release_bts_buffer(cpu);234}235236if (pebs_err) {237for_each_possible_cpu(cpu)238release_pebs_buffer(cpu);239}240241if (bts_err && pebs_err) {242for_each_possible_cpu(cpu)243release_ds_buffer(cpu);244} else {245if (x86_pmu.bts && !bts_err)246x86_pmu.bts_active = 1;247248if (x86_pmu.pebs && !pebs_err)249x86_pmu.pebs_active = 1;250251for_each_online_cpu(cpu)252init_debug_store_on_cpu(cpu);253}254255put_online_cpus();256}257258/*259* BTS260*/261262static struct event_constraint bts_constraint =263EVENT_CONSTRAINT(0, 1ULL << X86_PMC_IDX_FIXED_BTS, 0);264265static void intel_pmu_enable_bts(u64 config)266{267unsigned long debugctlmsr;268269debugctlmsr = get_debugctlmsr();270271debugctlmsr |= DEBUGCTLMSR_TR;272debugctlmsr |= DEBUGCTLMSR_BTS;273debugctlmsr |= DEBUGCTLMSR_BTINT;274275if (!(config & ARCH_PERFMON_EVENTSEL_OS))276debugctlmsr |= DEBUGCTLMSR_BTS_OFF_OS;277278if (!(config & ARCH_PERFMON_EVENTSEL_USR))279debugctlmsr |= DEBUGCTLMSR_BTS_OFF_USR;280281update_debugctlmsr(debugctlmsr);282}283284static void intel_pmu_disable_bts(void)285{286struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);287unsigned long debugctlmsr;288289if (!cpuc->ds)290return;291292debugctlmsr = get_debugctlmsr();293294debugctlmsr &=295~(DEBUGCTLMSR_TR | DEBUGCTLMSR_BTS | DEBUGCTLMSR_BTINT |296DEBUGCTLMSR_BTS_OFF_OS | DEBUGCTLMSR_BTS_OFF_USR);297298update_debugctlmsr(debugctlmsr);299}300301static int intel_pmu_drain_bts_buffer(void)302{303struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);304struct debug_store *ds = cpuc->ds;305struct bts_record {306u64 from;307u64 to;308u64 flags;309};310struct perf_event *event = cpuc->events[X86_PMC_IDX_FIXED_BTS];311struct bts_record *at, *top;312struct perf_output_handle handle;313struct perf_event_header header;314struct perf_sample_data data;315struct pt_regs regs;316317if (!event)318return 0;319320if (!x86_pmu.bts_active)321return 0;322323at = (struct bts_record *)(unsigned long)ds->bts_buffer_base;324top = (struct bts_record *)(unsigned long)ds->bts_index;325326if (top <= at)327return 0;328329ds->bts_index = ds->bts_buffer_base;330331perf_sample_data_init(&data, 0);332data.period = event->hw.last_period;333regs.ip = 0;334335/*336* Prepare a generic sample, i.e. fill in the invariant fields.337* We will overwrite the from and to address before we output338* the sample.339*/340perf_prepare_sample(&header, &data, event, ®s);341342if (perf_output_begin(&handle, event, header.size * (top - at), 1, 1))343return 1;344345for (; at < top; at++) {346data.ip = at->from;347data.addr = at->to;348349perf_output_sample(&handle, &header, &data, event);350}351352perf_output_end(&handle);353354/* There's new data available. */355event->hw.interrupts++;356event->pending_kill = POLL_IN;357return 1;358}359360/*361* PEBS362*/363static struct event_constraint intel_core2_pebs_event_constraints[] = {364INTEL_UEVENT_CONSTRAINT(0x00c0, 0x1), /* INST_RETIRED.ANY */365INTEL_UEVENT_CONSTRAINT(0xfec1, 0x1), /* X87_OPS_RETIRED.ANY */366INTEL_UEVENT_CONSTRAINT(0x00c5, 0x1), /* BR_INST_RETIRED.MISPRED */367INTEL_UEVENT_CONSTRAINT(0x1fc7, 0x1), /* SIMD_INST_RETURED.ANY */368INTEL_EVENT_CONSTRAINT(0xcb, 0x1), /* MEM_LOAD_RETIRED.* */369EVENT_CONSTRAINT_END370};371372static struct event_constraint intel_atom_pebs_event_constraints[] = {373INTEL_UEVENT_CONSTRAINT(0x00c0, 0x1), /* INST_RETIRED.ANY */374INTEL_UEVENT_CONSTRAINT(0x00c5, 0x1), /* MISPREDICTED_BRANCH_RETIRED */375INTEL_EVENT_CONSTRAINT(0xcb, 0x1), /* MEM_LOAD_RETIRED.* */376EVENT_CONSTRAINT_END377};378379static struct event_constraint intel_nehalem_pebs_event_constraints[] = {380INTEL_EVENT_CONSTRAINT(0x0b, 0xf), /* MEM_INST_RETIRED.* */381INTEL_EVENT_CONSTRAINT(0x0f, 0xf), /* MEM_UNCORE_RETIRED.* */382INTEL_UEVENT_CONSTRAINT(0x010c, 0xf), /* MEM_STORE_RETIRED.DTLB_MISS */383INTEL_EVENT_CONSTRAINT(0xc0, 0xf), /* INST_RETIRED.ANY */384INTEL_EVENT_CONSTRAINT(0xc2, 0xf), /* UOPS_RETIRED.* */385INTEL_EVENT_CONSTRAINT(0xc4, 0xf), /* BR_INST_RETIRED.* */386INTEL_UEVENT_CONSTRAINT(0x02c5, 0xf), /* BR_MISP_RETIRED.NEAR_CALL */387INTEL_EVENT_CONSTRAINT(0xc7, 0xf), /* SSEX_UOPS_RETIRED.* */388INTEL_UEVENT_CONSTRAINT(0x20c8, 0xf), /* ITLB_MISS_RETIRED */389INTEL_EVENT_CONSTRAINT(0xcb, 0xf), /* MEM_LOAD_RETIRED.* */390INTEL_EVENT_CONSTRAINT(0xf7, 0xf), /* FP_ASSIST.* */391EVENT_CONSTRAINT_END392};393394static struct event_constraint intel_westmere_pebs_event_constraints[] = {395INTEL_EVENT_CONSTRAINT(0x0b, 0xf), /* MEM_INST_RETIRED.* */396INTEL_EVENT_CONSTRAINT(0x0f, 0xf), /* MEM_UNCORE_RETIRED.* */397INTEL_UEVENT_CONSTRAINT(0x010c, 0xf), /* MEM_STORE_RETIRED.DTLB_MISS */398INTEL_EVENT_CONSTRAINT(0xc0, 0xf), /* INSTR_RETIRED.* */399INTEL_EVENT_CONSTRAINT(0xc2, 0xf), /* UOPS_RETIRED.* */400INTEL_EVENT_CONSTRAINT(0xc4, 0xf), /* BR_INST_RETIRED.* */401INTEL_EVENT_CONSTRAINT(0xc5, 0xf), /* BR_MISP_RETIRED.* */402INTEL_EVENT_CONSTRAINT(0xc7, 0xf), /* SSEX_UOPS_RETIRED.* */403INTEL_UEVENT_CONSTRAINT(0x20c8, 0xf), /* ITLB_MISS_RETIRED */404INTEL_EVENT_CONSTRAINT(0xcb, 0xf), /* MEM_LOAD_RETIRED.* */405INTEL_EVENT_CONSTRAINT(0xf7, 0xf), /* FP_ASSIST.* */406EVENT_CONSTRAINT_END407};408409static struct event_constraint intel_snb_pebs_events[] = {410INTEL_UEVENT_CONSTRAINT(0x01c0, 0x2), /* INST_RETIRED.PRECDIST */411INTEL_UEVENT_CONSTRAINT(0x01c2, 0xf), /* UOPS_RETIRED.ALL */412INTEL_UEVENT_CONSTRAINT(0x02c2, 0xf), /* UOPS_RETIRED.RETIRE_SLOTS */413INTEL_EVENT_CONSTRAINT(0xc4, 0xf), /* BR_INST_RETIRED.* */414INTEL_EVENT_CONSTRAINT(0xc5, 0xf), /* BR_MISP_RETIRED.* */415INTEL_EVENT_CONSTRAINT(0xcd, 0x8), /* MEM_TRANS_RETIRED.* */416INTEL_UEVENT_CONSTRAINT(0x11d0, 0xf), /* MEM_UOP_RETIRED.STLB_MISS_LOADS */417INTEL_UEVENT_CONSTRAINT(0x12d0, 0xf), /* MEM_UOP_RETIRED.STLB_MISS_STORES */418INTEL_UEVENT_CONSTRAINT(0x21d0, 0xf), /* MEM_UOP_RETIRED.LOCK_LOADS */419INTEL_UEVENT_CONSTRAINT(0x22d0, 0xf), /* MEM_UOP_RETIRED.LOCK_STORES */420INTEL_UEVENT_CONSTRAINT(0x41d0, 0xf), /* MEM_UOP_RETIRED.SPLIT_LOADS */421INTEL_UEVENT_CONSTRAINT(0x42d0, 0xf), /* MEM_UOP_RETIRED.SPLIT_STORES */422INTEL_UEVENT_CONSTRAINT(0x81d0, 0xf), /* MEM_UOP_RETIRED.ANY_LOADS */423INTEL_UEVENT_CONSTRAINT(0x82d0, 0xf), /* MEM_UOP_RETIRED.ANY_STORES */424INTEL_EVENT_CONSTRAINT(0xd1, 0xf), /* MEM_LOAD_UOPS_RETIRED.* */425INTEL_EVENT_CONSTRAINT(0xd2, 0xf), /* MEM_LOAD_UOPS_LLC_HIT_RETIRED.* */426INTEL_UEVENT_CONSTRAINT(0x02d4, 0xf), /* MEM_LOAD_UOPS_MISC_RETIRED.LLC_MISS */427EVENT_CONSTRAINT_END428};429430static struct event_constraint *431intel_pebs_constraints(struct perf_event *event)432{433struct event_constraint *c;434435if (!event->attr.precise_ip)436return NULL;437438if (x86_pmu.pebs_constraints) {439for_each_event_constraint(c, x86_pmu.pebs_constraints) {440if ((event->hw.config & c->cmask) == c->code)441return c;442}443}444445return &emptyconstraint;446}447448static void intel_pmu_pebs_enable(struct perf_event *event)449{450struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);451struct hw_perf_event *hwc = &event->hw;452453hwc->config &= ~ARCH_PERFMON_EVENTSEL_INT;454455cpuc->pebs_enabled |= 1ULL << hwc->idx;456WARN_ON_ONCE(cpuc->enabled);457458if (x86_pmu.intel_cap.pebs_trap && event->attr.precise_ip > 1)459intel_pmu_lbr_enable(event);460}461462static void intel_pmu_pebs_disable(struct perf_event *event)463{464struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);465struct hw_perf_event *hwc = &event->hw;466467cpuc->pebs_enabled &= ~(1ULL << hwc->idx);468if (cpuc->enabled)469wrmsrl(MSR_IA32_PEBS_ENABLE, cpuc->pebs_enabled);470471hwc->config |= ARCH_PERFMON_EVENTSEL_INT;472473if (x86_pmu.intel_cap.pebs_trap && event->attr.precise_ip > 1)474intel_pmu_lbr_disable(event);475}476477static void intel_pmu_pebs_enable_all(void)478{479struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);480481if (cpuc->pebs_enabled)482wrmsrl(MSR_IA32_PEBS_ENABLE, cpuc->pebs_enabled);483}484485static void intel_pmu_pebs_disable_all(void)486{487struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);488489if (cpuc->pebs_enabled)490wrmsrl(MSR_IA32_PEBS_ENABLE, 0);491}492493#include <asm/insn.h>494495static inline bool kernel_ip(unsigned long ip)496{497#ifdef CONFIG_X86_32498return ip > PAGE_OFFSET;499#else500return (long)ip < 0;501#endif502}503504static int intel_pmu_pebs_fixup_ip(struct pt_regs *regs)505{506struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);507unsigned long from = cpuc->lbr_entries[0].from;508unsigned long old_to, to = cpuc->lbr_entries[0].to;509unsigned long ip = regs->ip;510511/*512* We don't need to fixup if the PEBS assist is fault like513*/514if (!x86_pmu.intel_cap.pebs_trap)515return 1;516517/*518* No LBR entry, no basic block, no rewinding519*/520if (!cpuc->lbr_stack.nr || !from || !to)521return 0;522523/*524* Basic blocks should never cross user/kernel boundaries525*/526if (kernel_ip(ip) != kernel_ip(to))527return 0;528529/*530* unsigned math, either ip is before the start (impossible) or531* the basic block is larger than 1 page (sanity)532*/533if ((ip - to) > PAGE_SIZE)534return 0;535536/*537* We sampled a branch insn, rewind using the LBR stack538*/539if (ip == to) {540regs->ip = from;541return 1;542}543544do {545struct insn insn;546u8 buf[MAX_INSN_SIZE];547void *kaddr;548549old_to = to;550if (!kernel_ip(ip)) {551int bytes, size = MAX_INSN_SIZE;552553bytes = copy_from_user_nmi(buf, (void __user *)to, size);554if (bytes != size)555return 0;556557kaddr = buf;558} else559kaddr = (void *)to;560561kernel_insn_init(&insn, kaddr);562insn_get_length(&insn);563to += insn.length;564} while (to < ip);565566if (to == ip) {567regs->ip = old_to;568return 1;569}570571/*572* Even though we decoded the basic block, the instruction stream573* never matched the given IP, either the TO or the IP got corrupted.574*/575return 0;576}577578static int intel_pmu_save_and_restart(struct perf_event *event);579580static void __intel_pmu_pebs_event(struct perf_event *event,581struct pt_regs *iregs, void *__pebs)582{583/*584* We cast to pebs_record_core since that is a subset of585* both formats and we don't use the other fields in this586* routine.587*/588struct pebs_record_core *pebs = __pebs;589struct perf_sample_data data;590struct pt_regs regs;591592if (!intel_pmu_save_and_restart(event))593return;594595perf_sample_data_init(&data, 0);596data.period = event->hw.last_period;597598/*599* We use the interrupt regs as a base because the PEBS record600* does not contain a full regs set, specifically it seems to601* lack segment descriptors, which get used by things like602* user_mode().603*604* In the simple case fix up only the IP and BP,SP regs, for605* PERF_SAMPLE_IP and PERF_SAMPLE_CALLCHAIN to function properly.606* A possible PERF_SAMPLE_REGS will have to transfer all regs.607*/608regs = *iregs;609regs.ip = pebs->ip;610regs.bp = pebs->bp;611regs.sp = pebs->sp;612613if (event->attr.precise_ip > 1 && intel_pmu_pebs_fixup_ip(®s))614regs.flags |= PERF_EFLAGS_EXACT;615else616regs.flags &= ~PERF_EFLAGS_EXACT;617618if (perf_event_overflow(event, 1, &data, ®s))619x86_pmu_stop(event, 0);620}621622static void intel_pmu_drain_pebs_core(struct pt_regs *iregs)623{624struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);625struct debug_store *ds = cpuc->ds;626struct perf_event *event = cpuc->events[0]; /* PMC0 only */627struct pebs_record_core *at, *top;628int n;629630if (!x86_pmu.pebs_active)631return;632633at = (struct pebs_record_core *)(unsigned long)ds->pebs_buffer_base;634top = (struct pebs_record_core *)(unsigned long)ds->pebs_index;635636/*637* Whatever else happens, drain the thing638*/639ds->pebs_index = ds->pebs_buffer_base;640641if (!test_bit(0, cpuc->active_mask))642return;643644WARN_ON_ONCE(!event);645646if (!event->attr.precise_ip)647return;648649n = top - at;650if (n <= 0)651return;652653/*654* Should not happen, we program the threshold at 1 and do not655* set a reset value.656*/657WARN_ON_ONCE(n > 1);658at += n - 1;659660__intel_pmu_pebs_event(event, iregs, at);661}662663static void intel_pmu_drain_pebs_nhm(struct pt_regs *iregs)664{665struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);666struct debug_store *ds = cpuc->ds;667struct pebs_record_nhm *at, *top;668struct perf_event *event = NULL;669u64 status = 0;670int bit, n;671672if (!x86_pmu.pebs_active)673return;674675at = (struct pebs_record_nhm *)(unsigned long)ds->pebs_buffer_base;676top = (struct pebs_record_nhm *)(unsigned long)ds->pebs_index;677678ds->pebs_index = ds->pebs_buffer_base;679680n = top - at;681if (n <= 0)682return;683684/*685* Should not happen, we program the threshold at 1 and do not686* set a reset value.687*/688WARN_ON_ONCE(n > MAX_PEBS_EVENTS);689690for ( ; at < top; at++) {691for_each_set_bit(bit, (unsigned long *)&at->status, MAX_PEBS_EVENTS) {692event = cpuc->events[bit];693if (!test_bit(bit, cpuc->active_mask))694continue;695696WARN_ON_ONCE(!event);697698if (!event->attr.precise_ip)699continue;700701if (__test_and_set_bit(bit, (unsigned long *)&status))702continue;703704break;705}706707if (!event || bit >= MAX_PEBS_EVENTS)708continue;709710__intel_pmu_pebs_event(event, iregs, at);711}712}713714/*715* BTS, PEBS probe and setup716*/717718static void intel_ds_init(void)719{720/*721* No support for 32bit formats722*/723if (!boot_cpu_has(X86_FEATURE_DTES64))724return;725726x86_pmu.bts = boot_cpu_has(X86_FEATURE_BTS);727x86_pmu.pebs = boot_cpu_has(X86_FEATURE_PEBS);728if (x86_pmu.pebs) {729char pebs_type = x86_pmu.intel_cap.pebs_trap ? '+' : '-';730int format = x86_pmu.intel_cap.pebs_format;731732switch (format) {733case 0:734printk(KERN_CONT "PEBS fmt0%c, ", pebs_type);735x86_pmu.pebs_record_size = sizeof(struct pebs_record_core);736x86_pmu.drain_pebs = intel_pmu_drain_pebs_core;737break;738739case 1:740printk(KERN_CONT "PEBS fmt1%c, ", pebs_type);741x86_pmu.pebs_record_size = sizeof(struct pebs_record_nhm);742x86_pmu.drain_pebs = intel_pmu_drain_pebs_nhm;743break;744745default:746printk(KERN_CONT "no PEBS fmt%d%c, ", format, pebs_type);747x86_pmu.pebs = 0;748}749}750}751752#else /* CONFIG_CPU_SUP_INTEL */753754static void reserve_ds_buffers(void)755{756}757758static void release_ds_buffers(void)759{760}761762#endif /* CONFIG_CPU_SUP_INTEL */763764765