perf_event_intel_ds.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673
  1. #ifdef CONFIG_CPU_SUP_INTEL
  2. /* The maximal number of PEBS events: */
  3. #define MAX_PEBS_EVENTS 4
  4. /* The size of a BTS record in bytes: */
  5. #define BTS_RECORD_SIZE 24
  6. #define BTS_BUFFER_SIZE (PAGE_SIZE << 4)
  7. #define PEBS_BUFFER_SIZE PAGE_SIZE
  8. /*
  9. * pebs_record_32 for p4 and core not supported
  10. struct pebs_record_32 {
  11. u32 flags, ip;
  12. u32 ax, bc, cx, dx;
  13. u32 si, di, bp, sp;
  14. };
  15. */
  16. struct pebs_record_core {
  17. u64 flags, ip;
  18. u64 ax, bx, cx, dx;
  19. u64 si, di, bp, sp;
  20. u64 r8, r9, r10, r11;
  21. u64 r12, r13, r14, r15;
  22. };
  23. struct pebs_record_nhm {
  24. u64 flags, ip;
  25. u64 ax, bx, cx, dx;
  26. u64 si, di, bp, sp;
  27. u64 r8, r9, r10, r11;
  28. u64 r12, r13, r14, r15;
  29. u64 status, dla, dse, lat;
  30. };
  31. /*
  32. * Bits in the debugctlmsr controlling branch tracing.
  33. */
  34. #define X86_DEBUGCTL_TR (1 << 6)
  35. #define X86_DEBUGCTL_BTS (1 << 7)
  36. #define X86_DEBUGCTL_BTINT (1 << 8)
  37. #define X86_DEBUGCTL_BTS_OFF_OS (1 << 9)
  38. #define X86_DEBUGCTL_BTS_OFF_USR (1 << 10)
  39. /*
  40. * A debug store configuration.
  41. *
  42. * We only support architectures that use 64bit fields.
  43. */
  44. struct debug_store {
  45. u64 bts_buffer_base;
  46. u64 bts_index;
  47. u64 bts_absolute_maximum;
  48. u64 bts_interrupt_threshold;
  49. u64 pebs_buffer_base;
  50. u64 pebs_index;
  51. u64 pebs_absolute_maximum;
  52. u64 pebs_interrupt_threshold;
  53. u64 pebs_event_reset[MAX_PEBS_EVENTS];
  54. };
  55. static void init_debug_store_on_cpu(int cpu)
  56. {
  57. struct debug_store *ds = per_cpu(cpu_hw_events, cpu).ds;
  58. if (!ds)
  59. return;
  60. wrmsr_on_cpu(cpu, MSR_IA32_DS_AREA,
  61. (u32)((u64)(unsigned long)ds),
  62. (u32)((u64)(unsigned long)ds >> 32));
  63. }
  64. static void fini_debug_store_on_cpu(int cpu)
  65. {
  66. if (!per_cpu(cpu_hw_events, cpu).ds)
  67. return;
  68. wrmsr_on_cpu(cpu, MSR_IA32_DS_AREA, 0, 0);
  69. }
  70. static void release_ds_buffers(void)
  71. {
  72. int cpu;
  73. if (!x86_pmu.bts && !x86_pmu.pebs)
  74. return;
  75. get_online_cpus();
  76. for_each_online_cpu(cpu)
  77. fini_debug_store_on_cpu(cpu);
  78. for_each_possible_cpu(cpu) {
  79. struct debug_store *ds = per_cpu(cpu_hw_events, cpu).ds;
  80. if (!ds)
  81. continue;
  82. per_cpu(cpu_hw_events, cpu).ds = NULL;
  83. kfree((void *)(unsigned long)ds->pebs_buffer_base);
  84. kfree((void *)(unsigned long)ds->bts_buffer_base);
  85. kfree(ds);
  86. }
  87. put_online_cpus();
  88. }
  89. static int reserve_ds_buffers(void)
  90. {
  91. int cpu, err = 0;
  92. if (!x86_pmu.bts && !x86_pmu.pebs)
  93. return 0;
  94. get_online_cpus();
  95. for_each_possible_cpu(cpu) {
  96. struct debug_store *ds;
  97. void *buffer;
  98. int max, thresh;
  99. err = -ENOMEM;
  100. ds = kzalloc(sizeof(*ds), GFP_KERNEL);
  101. if (unlikely(!ds))
  102. break;
  103. per_cpu(cpu_hw_events, cpu).ds = ds;
  104. if (x86_pmu.bts) {
  105. buffer = kzalloc(BTS_BUFFER_SIZE, GFP_KERNEL);
  106. if (unlikely(!buffer))
  107. break;
  108. max = BTS_BUFFER_SIZE / BTS_RECORD_SIZE;
  109. thresh = max / 16;
  110. ds->bts_buffer_base = (u64)(unsigned long)buffer;
  111. ds->bts_index = ds->bts_buffer_base;
  112. ds->bts_absolute_maximum = ds->bts_buffer_base +
  113. max * BTS_RECORD_SIZE;
  114. ds->bts_interrupt_threshold = ds->bts_absolute_maximum -
  115. thresh * BTS_RECORD_SIZE;
  116. }
  117. if (x86_pmu.pebs) {
  118. buffer = kzalloc(PEBS_BUFFER_SIZE, GFP_KERNEL);
  119. if (unlikely(!buffer))
  120. break;
  121. max = PEBS_BUFFER_SIZE / x86_pmu.pebs_record_size;
  122. ds->pebs_buffer_base = (u64)(unsigned long)buffer;
  123. ds->pebs_index = ds->pebs_buffer_base;
  124. ds->pebs_absolute_maximum = ds->pebs_buffer_base +
  125. max * x86_pmu.pebs_record_size;
  126. /*
  127. * Always use single record PEBS
  128. */
  129. ds->pebs_interrupt_threshold = ds->pebs_buffer_base +
  130. x86_pmu.pebs_record_size;
  131. }
  132. err = 0;
  133. }
  134. if (err)
  135. release_ds_buffers();
  136. else {
  137. for_each_online_cpu(cpu)
  138. init_debug_store_on_cpu(cpu);
  139. }
  140. put_online_cpus();
  141. return err;
  142. }
  143. /*
  144. * BTS
  145. */
  146. static struct event_constraint bts_constraint =
  147. EVENT_CONSTRAINT(0, 1ULL << X86_PMC_IDX_FIXED_BTS, 0);
  148. static void intel_pmu_enable_bts(u64 config)
  149. {
  150. unsigned long debugctlmsr;
  151. debugctlmsr = get_debugctlmsr();
  152. debugctlmsr |= X86_DEBUGCTL_TR;
  153. debugctlmsr |= X86_DEBUGCTL_BTS;
  154. debugctlmsr |= X86_DEBUGCTL_BTINT;
  155. if (!(config & ARCH_PERFMON_EVENTSEL_OS))
  156. debugctlmsr |= X86_DEBUGCTL_BTS_OFF_OS;
  157. if (!(config & ARCH_PERFMON_EVENTSEL_USR))
  158. debugctlmsr |= X86_DEBUGCTL_BTS_OFF_USR;
  159. update_debugctlmsr(debugctlmsr);
  160. }
  161. static void intel_pmu_disable_bts(void)
  162. {
  163. struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
  164. unsigned long debugctlmsr;
  165. if (!cpuc->ds)
  166. return;
  167. debugctlmsr = get_debugctlmsr();
  168. debugctlmsr &=
  169. ~(X86_DEBUGCTL_TR | X86_DEBUGCTL_BTS | X86_DEBUGCTL_BTINT |
  170. X86_DEBUGCTL_BTS_OFF_OS | X86_DEBUGCTL_BTS_OFF_USR);
  171. update_debugctlmsr(debugctlmsr);
  172. }
  173. static void intel_pmu_drain_bts_buffer(void)
  174. {
  175. struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
  176. struct debug_store *ds = cpuc->ds;
  177. struct bts_record {
  178. u64 from;
  179. u64 to;
  180. u64 flags;
  181. };
  182. struct perf_event *event = cpuc->events[X86_PMC_IDX_FIXED_BTS];
  183. struct bts_record *at, *top;
  184. struct perf_output_handle handle;
  185. struct perf_event_header header;
  186. struct perf_sample_data data;
  187. struct pt_regs regs;
  188. if (!event)
  189. return;
  190. if (!ds)
  191. return;
  192. at = (struct bts_record *)(unsigned long)ds->bts_buffer_base;
  193. top = (struct bts_record *)(unsigned long)ds->bts_index;
  194. if (top <= at)
  195. return;
  196. ds->bts_index = ds->bts_buffer_base;
  197. perf_sample_data_init(&data, 0);
  198. data.period = event->hw.last_period;
  199. regs.ip = 0;
  200. /*
  201. * Prepare a generic sample, i.e. fill in the invariant fields.
  202. * We will overwrite the from and to address before we output
  203. * the sample.
  204. */
  205. perf_prepare_sample(&header, &data, event, &regs);
  206. if (perf_output_begin(&handle, event, header.size * (top - at), 1, 1))
  207. return;
  208. for (; at < top; at++) {
  209. data.ip = at->from;
  210. data.addr = at->to;
  211. perf_output_sample(&handle, &header, &data, event);
  212. }
  213. perf_output_end(&handle);
  214. /* There's new data available. */
  215. event->hw.interrupts++;
  216. event->pending_kill = POLL_IN;
  217. }
  218. /*
  219. * PEBS
  220. */
  221. static struct event_constraint intel_core_pebs_events[] = {
  222. PEBS_EVENT_CONSTRAINT(0x00c0, 0x1), /* INSTR_RETIRED.ANY */
  223. PEBS_EVENT_CONSTRAINT(0xfec1, 0x1), /* X87_OPS_RETIRED.ANY */
  224. PEBS_EVENT_CONSTRAINT(0x00c5, 0x1), /* BR_INST_RETIRED.MISPRED */
  225. PEBS_EVENT_CONSTRAINT(0x1fc7, 0x1), /* SIMD_INST_RETURED.ANY */
  226. PEBS_EVENT_CONSTRAINT(0x01cb, 0x1), /* MEM_LOAD_RETIRED.L1D_MISS */
  227. PEBS_EVENT_CONSTRAINT(0x02cb, 0x1), /* MEM_LOAD_RETIRED.L1D_LINE_MISS */
  228. PEBS_EVENT_CONSTRAINT(0x04cb, 0x1), /* MEM_LOAD_RETIRED.L2_MISS */
  229. PEBS_EVENT_CONSTRAINT(0x08cb, 0x1), /* MEM_LOAD_RETIRED.L2_LINE_MISS */
  230. PEBS_EVENT_CONSTRAINT(0x10cb, 0x1), /* MEM_LOAD_RETIRED.DTLB_MISS */
  231. EVENT_CONSTRAINT_END
  232. };
  233. static struct event_constraint intel_nehalem_pebs_events[] = {
  234. PEBS_EVENT_CONSTRAINT(0x00c0, 0xf), /* INSTR_RETIRED.ANY */
  235. PEBS_EVENT_CONSTRAINT(0xfec1, 0xf), /* X87_OPS_RETIRED.ANY */
  236. PEBS_EVENT_CONSTRAINT(0x00c5, 0xf), /* BR_INST_RETIRED.MISPRED */
  237. PEBS_EVENT_CONSTRAINT(0x1fc7, 0xf), /* SIMD_INST_RETURED.ANY */
  238. PEBS_EVENT_CONSTRAINT(0x01cb, 0xf), /* MEM_LOAD_RETIRED.L1D_MISS */
  239. PEBS_EVENT_CONSTRAINT(0x02cb, 0xf), /* MEM_LOAD_RETIRED.L1D_LINE_MISS */
  240. PEBS_EVENT_CONSTRAINT(0x04cb, 0xf), /* MEM_LOAD_RETIRED.L2_MISS */
  241. PEBS_EVENT_CONSTRAINT(0x08cb, 0xf), /* MEM_LOAD_RETIRED.L2_LINE_MISS */
  242. PEBS_EVENT_CONSTRAINT(0x10cb, 0xf), /* MEM_LOAD_RETIRED.DTLB_MISS */
  243. EVENT_CONSTRAINT_END
  244. };
  245. static struct event_constraint *
  246. intel_pebs_constraints(struct perf_event *event)
  247. {
  248. struct event_constraint *c;
  249. if (!event->attr.precise)
  250. return NULL;
  251. if (x86_pmu.pebs_constraints) {
  252. for_each_event_constraint(c, x86_pmu.pebs_constraints) {
  253. if ((event->hw.config & c->cmask) == c->code)
  254. return c;
  255. }
  256. }
  257. return &emptyconstraint;
  258. }
  259. static void intel_pmu_pebs_enable(struct perf_event *event)
  260. {
  261. struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
  262. struct hw_perf_event *hwc = &event->hw;
  263. hwc->config &= ~ARCH_PERFMON_EVENTSEL_INT;
  264. cpuc->pebs_enabled |= 1ULL << hwc->idx;
  265. WARN_ON_ONCE(cpuc->enabled);
  266. if (x86_pmu.intel_cap.pebs_trap)
  267. intel_pmu_lbr_enable(event);
  268. }
  269. static void intel_pmu_pebs_disable(struct perf_event *event)
  270. {
  271. struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
  272. struct hw_perf_event *hwc = &event->hw;
  273. cpuc->pebs_enabled &= ~(1ULL << hwc->idx);
  274. if (cpuc->enabled)
  275. wrmsrl(MSR_IA32_PEBS_ENABLE, cpuc->pebs_enabled);
  276. hwc->config |= ARCH_PERFMON_EVENTSEL_INT;
  277. if (x86_pmu.intel_cap.pebs_trap)
  278. intel_pmu_lbr_disable(event);
  279. }
  280. static void intel_pmu_pebs_enable_all(void)
  281. {
  282. struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
  283. if (cpuc->pebs_enabled)
  284. wrmsrl(MSR_IA32_PEBS_ENABLE, cpuc->pebs_enabled);
  285. }
  286. static void intel_pmu_pebs_disable_all(void)
  287. {
  288. struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
  289. if (cpuc->pebs_enabled)
  290. wrmsrl(MSR_IA32_PEBS_ENABLE, 0);
  291. }
  292. #include <asm/insn.h>
  293. static inline bool kernel_ip(unsigned long ip)
  294. {
  295. #ifdef CONFIG_X86_32
  296. return ip > PAGE_OFFSET;
  297. #else
  298. return (long)ip < 0;
  299. #endif
  300. }
  301. static int intel_pmu_pebs_fixup_ip(struct pt_regs *regs)
  302. {
  303. struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
  304. unsigned long from = cpuc->lbr_entries[0].from;
  305. unsigned long old_to, to = cpuc->lbr_entries[0].to;
  306. unsigned long ip = regs->ip;
  307. /*
  308. * We don't need to fixup if the PEBS assist is fault like
  309. */
  310. if (!x86_pmu.intel_cap.pebs_trap)
  311. return 1;
  312. /*
  313. * No LBR entry, no basic block, no rewinding
  314. */
  315. if (!cpuc->lbr_stack.nr || !from || !to)
  316. return 0;
  317. /*
  318. * Basic blocks should never cross user/kernel boundaries
  319. */
  320. if (kernel_ip(ip) != kernel_ip(to))
  321. return 0;
  322. /*
  323. * unsigned math, either ip is before the start (impossible) or
  324. * the basic block is larger than 1 page (sanity)
  325. */
  326. if ((ip - to) > PAGE_SIZE)
  327. return 0;
  328. /*
  329. * We sampled a branch insn, rewind using the LBR stack
  330. */
  331. if (ip == to) {
  332. regs->ip = from;
  333. return 1;
  334. }
  335. do {
  336. struct insn insn;
  337. u8 buf[MAX_INSN_SIZE];
  338. void *kaddr;
  339. old_to = to;
  340. if (!kernel_ip(ip)) {
  341. int bytes, size = MAX_INSN_SIZE;
  342. bytes = copy_from_user_nmi(buf, (void __user *)to, size);
  343. if (bytes != size)
  344. return 0;
  345. kaddr = buf;
  346. } else
  347. kaddr = (void *)to;
  348. kernel_insn_init(&insn, kaddr);
  349. insn_get_length(&insn);
  350. to += insn.length;
  351. } while (to < ip);
  352. if (to == ip) {
  353. regs->ip = old_to;
  354. return 1;
  355. }
  356. /*
  357. * Even though we decoded the basic block, the instruction stream
  358. * never matched the given IP, either the TO or the IP got corrupted.
  359. */
  360. return 0;
  361. }
  362. static int intel_pmu_save_and_restart(struct perf_event *event);
  363. static void intel_pmu_drain_pebs_core(struct pt_regs *iregs)
  364. {
  365. struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
  366. struct debug_store *ds = cpuc->ds;
  367. struct perf_event *event = cpuc->events[0]; /* PMC0 only */
  368. struct pebs_record_core *at, *top;
  369. struct perf_sample_data data;
  370. struct perf_raw_record raw;
  371. struct pt_regs regs;
  372. int n;
  373. if (!ds || !x86_pmu.pebs)
  374. return;
  375. at = (struct pebs_record_core *)(unsigned long)ds->pebs_buffer_base;
  376. top = (struct pebs_record_core *)(unsigned long)ds->pebs_index;
  377. /*
  378. * Whatever else happens, drain the thing
  379. */
  380. ds->pebs_index = ds->pebs_buffer_base;
  381. if (!test_bit(0, cpuc->active_mask))
  382. return;
  383. WARN_ON_ONCE(!event);
  384. if (!event->attr.precise)
  385. return;
  386. n = top - at;
  387. if (n <= 0)
  388. return;
  389. if (!intel_pmu_save_and_restart(event))
  390. return;
  391. /*
  392. * Should not happen, we program the threshold at 1 and do not
  393. * set a reset value.
  394. */
  395. WARN_ON_ONCE(n > 1);
  396. at += n - 1;
  397. perf_sample_data_init(&data, 0);
  398. data.period = event->hw.last_period;
  399. if (event->attr.sample_type & PERF_SAMPLE_RAW) {
  400. raw.size = x86_pmu.pebs_record_size;
  401. raw.data = at;
  402. data.raw = &raw;
  403. }
  404. /*
  405. * We use the interrupt regs as a base because the PEBS record
  406. * does not contain a full regs set, specifically it seems to
  407. * lack segment descriptors, which get used by things like
  408. * user_mode().
  409. *
  410. * In the simple case fix up only the IP and BP,SP regs, for
  411. * PERF_SAMPLE_IP and PERF_SAMPLE_CALLCHAIN to function properly.
  412. * A possible PERF_SAMPLE_REGS will have to transfer all regs.
  413. */
  414. regs = *iregs;
  415. regs.ip = at->ip;
  416. regs.bp = at->bp;
  417. regs.sp = at->sp;
  418. if (intel_pmu_pebs_fixup_ip(&regs))
  419. regs.flags |= PERF_EFLAGS_EXACT;
  420. else
  421. regs.flags &= ~PERF_EFLAGS_EXACT;
  422. if (perf_event_overflow(event, 1, &data, &regs))
  423. x86_pmu_stop(event);
  424. }
  425. static void intel_pmu_drain_pebs_nhm(struct pt_regs *iregs)
  426. {
  427. struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
  428. struct debug_store *ds = cpuc->ds;
  429. struct pebs_record_nhm *at, *top;
  430. struct perf_sample_data data;
  431. struct perf_event *event = NULL;
  432. struct perf_raw_record raw;
  433. struct pt_regs regs;
  434. u64 status = 0;
  435. int bit, n;
  436. if (!ds || !x86_pmu.pebs)
  437. return;
  438. at = (struct pebs_record_nhm *)(unsigned long)ds->pebs_buffer_base;
  439. top = (struct pebs_record_nhm *)(unsigned long)ds->pebs_index;
  440. ds->pebs_index = ds->pebs_buffer_base;
  441. n = top - at;
  442. if (n <= 0)
  443. return;
  444. /*
  445. * Should not happen, we program the threshold at 1 and do not
  446. * set a reset value.
  447. */
  448. WARN_ON_ONCE(n > MAX_PEBS_EVENTS);
  449. for ( ; at < top; at++) {
  450. for_each_bit(bit, (unsigned long *)&at->status, MAX_PEBS_EVENTS) {
  451. event = cpuc->events[bit];
  452. if (!test_bit(bit, cpuc->active_mask))
  453. continue;
  454. WARN_ON_ONCE(!event);
  455. if (!event->attr.precise)
  456. continue;
  457. if (__test_and_set_bit(bit, (unsigned long *)&status))
  458. continue;
  459. break;
  460. }
  461. if (!event || bit >= MAX_PEBS_EVENTS)
  462. continue;
  463. if (!intel_pmu_save_and_restart(event))
  464. continue;
  465. perf_sample_data_init(&data, 0);
  466. data.period = event->hw.last_period;
  467. if (event->attr.sample_type & PERF_SAMPLE_RAW) {
  468. raw.size = x86_pmu.pebs_record_size;
  469. raw.data = at;
  470. data.raw = &raw;
  471. }
  472. /*
  473. * See the comment in intel_pmu_drain_pebs_core()
  474. */
  475. regs = *iregs;
  476. regs.ip = at->ip;
  477. regs.bp = at->bp;
  478. regs.sp = at->sp;
  479. if (intel_pmu_pebs_fixup_ip(&regs))
  480. regs.flags |= PERF_EFLAGS_EXACT;
  481. else
  482. regs.flags &= ~PERF_EFLAGS_EXACT;
  483. if (perf_event_overflow(event, 1, &data, &regs))
  484. x86_pmu_stop(event);
  485. }
  486. }
  487. /*
  488. * BTS, PEBS probe and setup
  489. */
  490. static void intel_ds_init(void)
  491. {
  492. /*
  493. * No support for 32bit formats
  494. */
  495. if (!boot_cpu_has(X86_FEATURE_DTES64))
  496. return;
  497. x86_pmu.bts = boot_cpu_has(X86_FEATURE_BTS);
  498. x86_pmu.pebs = boot_cpu_has(X86_FEATURE_PEBS);
  499. if (x86_pmu.pebs) {
  500. char pebs_type = x86_pmu.intel_cap.pebs_trap ? '+' : '-';
  501. int format = x86_pmu.intel_cap.pebs_format;
  502. switch (format) {
  503. case 0:
  504. printk(KERN_CONT "PEBS fmt0%c, ", pebs_type);
  505. x86_pmu.pebs_record_size = sizeof(struct pebs_record_core);
  506. x86_pmu.drain_pebs = intel_pmu_drain_pebs_core;
  507. x86_pmu.pebs_constraints = intel_core_pebs_events;
  508. break;
  509. case 1:
  510. printk(KERN_CONT "PEBS fmt1%c, ", pebs_type);
  511. x86_pmu.pebs_record_size = sizeof(struct pebs_record_nhm);
  512. x86_pmu.drain_pebs = intel_pmu_drain_pebs_nhm;
  513. x86_pmu.pebs_constraints = intel_nehalem_pebs_events;
  514. break;
  515. default:
  516. printk(KERN_CONT "no PEBS fmt%d%c, ", format, pebs_type);
  517. x86_pmu.pebs = 0;
  518. break;
  519. }
  520. }
  521. }
  522. #else /* CONFIG_CPU_SUP_INTEL */
  523. static int reserve_ds_buffers(void)
  524. {
  525. return 0;
  526. }
  527. static void release_ds_buffers(void)
  528. {
  529. }
  530. #endif /* CONFIG_CPU_SUP_INTEL */