perf_event_p4.c 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858
  1. /*
  2. * Netburst Perfomance Events (P4, old Xeon)
  3. *
  4. * Copyright (C) 2010 Parallels, Inc., Cyrill Gorcunov <gorcunov@openvz.org>
  5. * Copyright (C) 2010 Intel Corporation, Lin Ming <ming.m.lin@intel.com>
  6. *
  7. * For licencing details see kernel-base/COPYING
  8. */
  9. #ifdef CONFIG_CPU_SUP_INTEL
  10. #include <asm/perf_event_p4.h>
  11. #define P4_CNTR_LIMIT 3
  12. /*
  13. * array indices: 0,1 - HT threads, used with HT enabled cpu
  14. */
  15. struct p4_event_bind {
  16. unsigned int opcode; /* Event code and ESCR selector */
  17. unsigned int escr_msr[2]; /* ESCR MSR for this event */
  18. char cntr[2][P4_CNTR_LIMIT]; /* counter index (offset), -1 on abscence */
  19. };
  20. struct p4_cache_event_bind {
  21. unsigned int metric_pebs;
  22. unsigned int metric_vert;
  23. };
  24. #define P4_GEN_CACHE_EVENT_BIND(name) \
  25. [P4_CACHE__##name] = { \
  26. .metric_pebs = P4_PEBS__##name, \
  27. .metric_vert = P4_VERT__##name, \
  28. }
  29. static struct p4_cache_event_bind p4_cache_event_bind_map[] = {
  30. P4_GEN_CACHE_EVENT_BIND(1stl_cache_load_miss_retired),
  31. P4_GEN_CACHE_EVENT_BIND(2ndl_cache_load_miss_retired),
  32. P4_GEN_CACHE_EVENT_BIND(dtlb_load_miss_retired),
  33. P4_GEN_CACHE_EVENT_BIND(dtlb_store_miss_retired),
  34. };
  35. /*
  36. * Note that we don't use CCCR1 here, there is an
  37. * exception for P4_BSQ_ALLOCATION but we just have
  38. * no workaround
  39. *
  40. * consider this binding as resources which particular
  41. * event may borrow, it doesn't contain EventMask,
  42. * Tags and friends -- they are left to a caller
  43. */
  44. static struct p4_event_bind p4_event_bind_map[] = {
  45. [P4_EVENT_TC_DELIVER_MODE] = {
  46. .opcode = P4_OPCODE(P4_EVENT_TC_DELIVER_MODE),
  47. .escr_msr = { MSR_P4_TC_ESCR0, MSR_P4_TC_ESCR1 },
  48. .cntr = { {4, 5, -1}, {6, 7, -1} },
  49. },
  50. [P4_EVENT_BPU_FETCH_REQUEST] = {
  51. .opcode = P4_OPCODE(P4_EVENT_BPU_FETCH_REQUEST),
  52. .escr_msr = { MSR_P4_BPU_ESCR0, MSR_P4_BPU_ESCR1 },
  53. .cntr = { {0, -1, -1}, {2, -1, -1} },
  54. },
  55. [P4_EVENT_ITLB_REFERENCE] = {
  56. .opcode = P4_OPCODE(P4_EVENT_ITLB_REFERENCE),
  57. .escr_msr = { MSR_P4_ITLB_ESCR0, MSR_P4_ITLB_ESCR1 },
  58. .cntr = { {0, -1, -1}, {2, -1, -1} },
  59. },
  60. [P4_EVENT_MEMORY_CANCEL] = {
  61. .opcode = P4_OPCODE(P4_EVENT_MEMORY_CANCEL),
  62. .escr_msr = { MSR_P4_DAC_ESCR0, MSR_P4_DAC_ESCR1 },
  63. .cntr = { {8, 9, -1}, {10, 11, -1} },
  64. },
  65. [P4_EVENT_MEMORY_COMPLETE] = {
  66. .opcode = P4_OPCODE(P4_EVENT_MEMORY_COMPLETE),
  67. .escr_msr = { MSR_P4_SAAT_ESCR0 , MSR_P4_SAAT_ESCR1 },
  68. .cntr = { {8, 9, -1}, {10, 11, -1} },
  69. },
  70. [P4_EVENT_LOAD_PORT_REPLAY] = {
  71. .opcode = P4_OPCODE(P4_EVENT_LOAD_PORT_REPLAY),
  72. .escr_msr = { MSR_P4_SAAT_ESCR0, MSR_P4_SAAT_ESCR1 },
  73. .cntr = { {8, 9, -1}, {10, 11, -1} },
  74. },
  75. [P4_EVENT_STORE_PORT_REPLAY] = {
  76. .opcode = P4_OPCODE(P4_EVENT_STORE_PORT_REPLAY),
  77. .escr_msr = { MSR_P4_SAAT_ESCR0 , MSR_P4_SAAT_ESCR1 },
  78. .cntr = { {8, 9, -1}, {10, 11, -1} },
  79. },
  80. [P4_EVENT_MOB_LOAD_REPLAY] = {
  81. .opcode = P4_OPCODE(P4_EVENT_MOB_LOAD_REPLAY),
  82. .escr_msr = { MSR_P4_MOB_ESCR0, MSR_P4_MOB_ESCR1 },
  83. .cntr = { {0, -1, -1}, {2, -1, -1} },
  84. },
  85. [P4_EVENT_PAGE_WALK_TYPE] = {
  86. .opcode = P4_OPCODE(P4_EVENT_PAGE_WALK_TYPE),
  87. .escr_msr = { MSR_P4_PMH_ESCR0, MSR_P4_PMH_ESCR1 },
  88. .cntr = { {0, -1, -1}, {2, -1, -1} },
  89. },
  90. [P4_EVENT_BSQ_CACHE_REFERENCE] = {
  91. .opcode = P4_OPCODE(P4_EVENT_BSQ_CACHE_REFERENCE),
  92. .escr_msr = { MSR_P4_BSU_ESCR0, MSR_P4_BSU_ESCR1 },
  93. .cntr = { {0, -1, -1}, {2, -1, -1} },
  94. },
  95. [P4_EVENT_IOQ_ALLOCATION] = {
  96. .opcode = P4_OPCODE(P4_EVENT_IOQ_ALLOCATION),
  97. .escr_msr = { MSR_P4_FSB_ESCR0, MSR_P4_FSB_ESCR1 },
  98. .cntr = { {0, -1, -1}, {2, -1, -1} },
  99. },
  100. [P4_EVENT_IOQ_ACTIVE_ENTRIES] = { /* shared ESCR */
  101. .opcode = P4_OPCODE(P4_EVENT_IOQ_ACTIVE_ENTRIES),
  102. .escr_msr = { MSR_P4_FSB_ESCR1, MSR_P4_FSB_ESCR1 },
  103. .cntr = { {2, -1, -1}, {3, -1, -1} },
  104. },
  105. [P4_EVENT_FSB_DATA_ACTIVITY] = {
  106. .opcode = P4_OPCODE(P4_EVENT_FSB_DATA_ACTIVITY),
  107. .escr_msr = { MSR_P4_FSB_ESCR0, MSR_P4_FSB_ESCR1 },
  108. .cntr = { {0, -1, -1}, {2, -1, -1} },
  109. },
  110. [P4_EVENT_BSQ_ALLOCATION] = { /* shared ESCR, broken CCCR1 */
  111. .opcode = P4_OPCODE(P4_EVENT_BSQ_ALLOCATION),
  112. .escr_msr = { MSR_P4_BSU_ESCR0, MSR_P4_BSU_ESCR0 },
  113. .cntr = { {0, -1, -1}, {1, -1, -1} },
  114. },
  115. [P4_EVENT_BSQ_ACTIVE_ENTRIES] = { /* shared ESCR */
  116. .opcode = P4_OPCODE(P4_EVENT_BSQ_ACTIVE_ENTRIES),
  117. .escr_msr = { MSR_P4_BSU_ESCR1 , MSR_P4_BSU_ESCR1 },
  118. .cntr = { {2, -1, -1}, {3, -1, -1} },
  119. },
  120. [P4_EVENT_SSE_INPUT_ASSIST] = {
  121. .opcode = P4_OPCODE(P4_EVENT_SSE_INPUT_ASSIST),
  122. .escr_msr = { MSR_P4_FIRM_ESCR0, MSR_P4_FIRM_ESCR1 },
  123. .cntr = { {8, 9, -1}, {10, 11, -1} },
  124. },
  125. [P4_EVENT_PACKED_SP_UOP] = {
  126. .opcode = P4_OPCODE(P4_EVENT_PACKED_SP_UOP),
  127. .escr_msr = { MSR_P4_FIRM_ESCR0, MSR_P4_FIRM_ESCR1 },
  128. .cntr = { {8, 9, -1}, {10, 11, -1} },
  129. },
  130. [P4_EVENT_PACKED_DP_UOP] = {
  131. .opcode = P4_OPCODE(P4_EVENT_PACKED_DP_UOP),
  132. .escr_msr = { MSR_P4_FIRM_ESCR0, MSR_P4_FIRM_ESCR1 },
  133. .cntr = { {8, 9, -1}, {10, 11, -1} },
  134. },
  135. [P4_EVENT_SCALAR_SP_UOP] = {
  136. .opcode = P4_OPCODE(P4_EVENT_SCALAR_SP_UOP),
  137. .escr_msr = { MSR_P4_FIRM_ESCR0, MSR_P4_FIRM_ESCR1 },
  138. .cntr = { {8, 9, -1}, {10, 11, -1} },
  139. },
  140. [P4_EVENT_SCALAR_DP_UOP] = {
  141. .opcode = P4_OPCODE(P4_EVENT_SCALAR_DP_UOP),
  142. .escr_msr = { MSR_P4_FIRM_ESCR0, MSR_P4_FIRM_ESCR1 },
  143. .cntr = { {8, 9, -1}, {10, 11, -1} },
  144. },
  145. [P4_EVENT_64BIT_MMX_UOP] = {
  146. .opcode = P4_OPCODE(P4_EVENT_64BIT_MMX_UOP),
  147. .escr_msr = { MSR_P4_FIRM_ESCR0, MSR_P4_FIRM_ESCR1 },
  148. .cntr = { {8, 9, -1}, {10, 11, -1} },
  149. },
  150. [P4_EVENT_128BIT_MMX_UOP] = {
  151. .opcode = P4_OPCODE(P4_EVENT_128BIT_MMX_UOP),
  152. .escr_msr = { MSR_P4_FIRM_ESCR0, MSR_P4_FIRM_ESCR1 },
  153. .cntr = { {8, 9, -1}, {10, 11, -1} },
  154. },
  155. [P4_EVENT_X87_FP_UOP] = {
  156. .opcode = P4_OPCODE(P4_EVENT_X87_FP_UOP),
  157. .escr_msr = { MSR_P4_FIRM_ESCR0, MSR_P4_FIRM_ESCR1 },
  158. .cntr = { {8, 9, -1}, {10, 11, -1} },
  159. },
  160. [P4_EVENT_TC_MISC] = {
  161. .opcode = P4_OPCODE(P4_EVENT_TC_MISC),
  162. .escr_msr = { MSR_P4_TC_ESCR0, MSR_P4_TC_ESCR1 },
  163. .cntr = { {4, 5, -1}, {6, 7, -1} },
  164. },
  165. [P4_EVENT_GLOBAL_POWER_EVENTS] = {
  166. .opcode = P4_OPCODE(P4_EVENT_GLOBAL_POWER_EVENTS),
  167. .escr_msr = { MSR_P4_FSB_ESCR0, MSR_P4_FSB_ESCR1 },
  168. .cntr = { {0, -1, -1}, {2, -1, -1} },
  169. },
  170. [P4_EVENT_TC_MS_XFER] = {
  171. .opcode = P4_OPCODE(P4_EVENT_TC_MS_XFER),
  172. .escr_msr = { MSR_P4_MS_ESCR0, MSR_P4_MS_ESCR1 },
  173. .cntr = { {4, 5, -1}, {6, 7, -1} },
  174. },
  175. [P4_EVENT_UOP_QUEUE_WRITES] = {
  176. .opcode = P4_OPCODE(P4_EVENT_UOP_QUEUE_WRITES),
  177. .escr_msr = { MSR_P4_MS_ESCR0, MSR_P4_MS_ESCR1 },
  178. .cntr = { {4, 5, -1}, {6, 7, -1} },
  179. },
  180. [P4_EVENT_RETIRED_MISPRED_BRANCH_TYPE] = {
  181. .opcode = P4_OPCODE(P4_EVENT_RETIRED_MISPRED_BRANCH_TYPE),
  182. .escr_msr = { MSR_P4_TBPU_ESCR0 , MSR_P4_TBPU_ESCR0 },
  183. .cntr = { {4, 5, -1}, {6, 7, -1} },
  184. },
  185. [P4_EVENT_RETIRED_BRANCH_TYPE] = {
  186. .opcode = P4_OPCODE(P4_EVENT_RETIRED_BRANCH_TYPE),
  187. .escr_msr = { MSR_P4_TBPU_ESCR0 , MSR_P4_TBPU_ESCR1 },
  188. .cntr = { {4, 5, -1}, {6, 7, -1} },
  189. },
  190. [P4_EVENT_RESOURCE_STALL] = {
  191. .opcode = P4_OPCODE(P4_EVENT_RESOURCE_STALL),
  192. .escr_msr = { MSR_P4_ALF_ESCR0, MSR_P4_ALF_ESCR1 },
  193. .cntr = { {12, 13, 16}, {14, 15, 17} },
  194. },
  195. [P4_EVENT_WC_BUFFER] = {
  196. .opcode = P4_OPCODE(P4_EVENT_WC_BUFFER),
  197. .escr_msr = { MSR_P4_DAC_ESCR0, MSR_P4_DAC_ESCR1 },
  198. .cntr = { {8, 9, -1}, {10, 11, -1} },
  199. },
  200. [P4_EVENT_B2B_CYCLES] = {
  201. .opcode = P4_OPCODE(P4_EVENT_B2B_CYCLES),
  202. .escr_msr = { MSR_P4_FSB_ESCR0, MSR_P4_FSB_ESCR1 },
  203. .cntr = { {0, -1, -1}, {2, -1, -1} },
  204. },
  205. [P4_EVENT_BNR] = {
  206. .opcode = P4_OPCODE(P4_EVENT_BNR),
  207. .escr_msr = { MSR_P4_FSB_ESCR0, MSR_P4_FSB_ESCR1 },
  208. .cntr = { {0, -1, -1}, {2, -1, -1} },
  209. },
  210. [P4_EVENT_SNOOP] = {
  211. .opcode = P4_OPCODE(P4_EVENT_SNOOP),
  212. .escr_msr = { MSR_P4_FSB_ESCR0, MSR_P4_FSB_ESCR1 },
  213. .cntr = { {0, -1, -1}, {2, -1, -1} },
  214. },
  215. [P4_EVENT_RESPONSE] = {
  216. .opcode = P4_OPCODE(P4_EVENT_RESPONSE),
  217. .escr_msr = { MSR_P4_FSB_ESCR0, MSR_P4_FSB_ESCR1 },
  218. .cntr = { {0, -1, -1}, {2, -1, -1} },
  219. },
  220. [P4_EVENT_FRONT_END_EVENT] = {
  221. .opcode = P4_OPCODE(P4_EVENT_FRONT_END_EVENT),
  222. .escr_msr = { MSR_P4_CRU_ESCR2, MSR_P4_CRU_ESCR3 },
  223. .cntr = { {12, 13, 16}, {14, 15, 17} },
  224. },
  225. [P4_EVENT_EXECUTION_EVENT] = {
  226. .opcode = P4_OPCODE(P4_EVENT_EXECUTION_EVENT),
  227. .escr_msr = { MSR_P4_CRU_ESCR2, MSR_P4_CRU_ESCR3 },
  228. .cntr = { {12, 13, 16}, {14, 15, 17} },
  229. },
  230. [P4_EVENT_REPLAY_EVENT] = {
  231. .opcode = P4_OPCODE(P4_EVENT_REPLAY_EVENT),
  232. .escr_msr = { MSR_P4_CRU_ESCR2, MSR_P4_CRU_ESCR3 },
  233. .cntr = { {12, 13, 16}, {14, 15, 17} },
  234. },
  235. [P4_EVENT_INSTR_RETIRED] = {
  236. .opcode = P4_OPCODE(P4_EVENT_INSTR_RETIRED),
  237. .escr_msr = { MSR_P4_CRU_ESCR0, MSR_P4_CRU_ESCR1 },
  238. .cntr = { {12, 13, 16}, {14, 15, 17} },
  239. },
  240. [P4_EVENT_UOPS_RETIRED] = {
  241. .opcode = P4_OPCODE(P4_EVENT_UOPS_RETIRED),
  242. .escr_msr = { MSR_P4_CRU_ESCR0, MSR_P4_CRU_ESCR1 },
  243. .cntr = { {12, 13, 16}, {14, 15, 17} },
  244. },
  245. [P4_EVENT_UOP_TYPE] = {
  246. .opcode = P4_OPCODE(P4_EVENT_UOP_TYPE),
  247. .escr_msr = { MSR_P4_RAT_ESCR0, MSR_P4_RAT_ESCR1 },
  248. .cntr = { {12, 13, 16}, {14, 15, 17} },
  249. },
  250. [P4_EVENT_BRANCH_RETIRED] = {
  251. .opcode = P4_OPCODE(P4_EVENT_BRANCH_RETIRED),
  252. .escr_msr = { MSR_P4_CRU_ESCR2, MSR_P4_CRU_ESCR3 },
  253. .cntr = { {12, 13, 16}, {14, 15, 17} },
  254. },
  255. [P4_EVENT_MISPRED_BRANCH_RETIRED] = {
  256. .opcode = P4_OPCODE(P4_EVENT_MISPRED_BRANCH_RETIRED),
  257. .escr_msr = { MSR_P4_CRU_ESCR0, MSR_P4_CRU_ESCR1 },
  258. .cntr = { {12, 13, 16}, {14, 15, 17} },
  259. },
  260. [P4_EVENT_X87_ASSIST] = {
  261. .opcode = P4_OPCODE(P4_EVENT_X87_ASSIST),
  262. .escr_msr = { MSR_P4_CRU_ESCR2, MSR_P4_CRU_ESCR3 },
  263. .cntr = { {12, 13, 16}, {14, 15, 17} },
  264. },
  265. [P4_EVENT_MACHINE_CLEAR] = {
  266. .opcode = P4_OPCODE(P4_EVENT_MACHINE_CLEAR),
  267. .escr_msr = { MSR_P4_CRU_ESCR2, MSR_P4_CRU_ESCR3 },
  268. .cntr = { {12, 13, 16}, {14, 15, 17} },
  269. },
  270. [P4_EVENT_INSTR_COMPLETED] = {
  271. .opcode = P4_OPCODE(P4_EVENT_INSTR_COMPLETED),
  272. .escr_msr = { MSR_P4_CRU_ESCR0, MSR_P4_CRU_ESCR1 },
  273. .cntr = { {12, 13, 16}, {14, 15, 17} },
  274. },
  275. };
  276. #define P4_GEN_CACHE_EVENT(event, bit, cache_event) \
  277. p4_config_pack_escr(P4_ESCR_EVENT(event) | \
  278. P4_ESCR_EMASK_BIT(event, bit)) | \
  279. p4_config_pack_cccr(cache_event | \
  280. P4_CCCR_ESEL(P4_OPCODE_ESEL(P4_OPCODE(event))))
  281. static __initconst const u64 p4_hw_cache_event_ids
  282. [PERF_COUNT_HW_CACHE_MAX]
  283. [PERF_COUNT_HW_CACHE_OP_MAX]
  284. [PERF_COUNT_HW_CACHE_RESULT_MAX] =
  285. {
  286. [ C(L1D ) ] = {
  287. [ C(OP_READ) ] = {
  288. [ C(RESULT_ACCESS) ] = 0x0,
  289. [ C(RESULT_MISS) ] = P4_GEN_CACHE_EVENT(P4_EVENT_REPLAY_EVENT, NBOGUS,
  290. P4_CACHE__1stl_cache_load_miss_retired),
  291. },
  292. },
  293. [ C(LL ) ] = {
  294. [ C(OP_READ) ] = {
  295. [ C(RESULT_ACCESS) ] = 0x0,
  296. [ C(RESULT_MISS) ] = P4_GEN_CACHE_EVENT(P4_EVENT_REPLAY_EVENT, NBOGUS,
  297. P4_CACHE__2ndl_cache_load_miss_retired),
  298. },
  299. },
  300. [ C(DTLB) ] = {
  301. [ C(OP_READ) ] = {
  302. [ C(RESULT_ACCESS) ] = 0x0,
  303. [ C(RESULT_MISS) ] = P4_GEN_CACHE_EVENT(P4_EVENT_REPLAY_EVENT, NBOGUS,
  304. P4_CACHE__dtlb_load_miss_retired),
  305. },
  306. [ C(OP_WRITE) ] = {
  307. [ C(RESULT_ACCESS) ] = 0x0,
  308. [ C(RESULT_MISS) ] = P4_GEN_CACHE_EVENT(P4_EVENT_REPLAY_EVENT, NBOGUS,
  309. P4_CACHE__dtlb_store_miss_retired),
  310. },
  311. },
  312. [ C(ITLB) ] = {
  313. [ C(OP_READ) ] = {
  314. [ C(RESULT_ACCESS) ] = P4_GEN_CACHE_EVENT(P4_EVENT_ITLB_REFERENCE, HIT,
  315. P4_CACHE__itlb_reference_hit),
  316. [ C(RESULT_MISS) ] = P4_GEN_CACHE_EVENT(P4_EVENT_ITLB_REFERENCE, MISS,
  317. P4_CACHE__itlb_reference_miss),
  318. },
  319. [ C(OP_WRITE) ] = {
  320. [ C(RESULT_ACCESS) ] = -1,
  321. [ C(RESULT_MISS) ] = -1,
  322. },
  323. [ C(OP_PREFETCH) ] = {
  324. [ C(RESULT_ACCESS) ] = -1,
  325. [ C(RESULT_MISS) ] = -1,
  326. },
  327. },
  328. };
  329. static u64 p4_general_events[PERF_COUNT_HW_MAX] = {
  330. /* non-halted CPU clocks */
  331. [PERF_COUNT_HW_CPU_CYCLES] =
  332. p4_config_pack_escr(P4_ESCR_EVENT(P4_EVENT_GLOBAL_POWER_EVENTS) |
  333. P4_ESCR_EMASK_BIT(P4_EVENT_GLOBAL_POWER_EVENTS, RUNNING)),
  334. /*
  335. * retired instructions
  336. * in a sake of simplicity we don't use the FSB tagging
  337. */
  338. [PERF_COUNT_HW_INSTRUCTIONS] =
  339. p4_config_pack_escr(P4_ESCR_EVENT(P4_EVENT_INSTR_RETIRED) |
  340. P4_ESCR_EMASK_BIT(P4_EVENT_INSTR_RETIRED, NBOGUSNTAG) |
  341. P4_ESCR_EMASK_BIT(P4_EVENT_INSTR_RETIRED, BOGUSNTAG)),
  342. /* cache hits */
  343. [PERF_COUNT_HW_CACHE_REFERENCES] =
  344. p4_config_pack_escr(P4_ESCR_EVENT(P4_EVENT_BSQ_CACHE_REFERENCE) |
  345. P4_ESCR_EMASK_BIT(P4_EVENT_BSQ_CACHE_REFERENCE, RD_2ndL_HITS) |
  346. P4_ESCR_EMASK_BIT(P4_EVENT_BSQ_CACHE_REFERENCE, RD_2ndL_HITE) |
  347. P4_ESCR_EMASK_BIT(P4_EVENT_BSQ_CACHE_REFERENCE, RD_2ndL_HITM) |
  348. P4_ESCR_EMASK_BIT(P4_EVENT_BSQ_CACHE_REFERENCE, RD_3rdL_HITS) |
  349. P4_ESCR_EMASK_BIT(P4_EVENT_BSQ_CACHE_REFERENCE, RD_3rdL_HITE) |
  350. P4_ESCR_EMASK_BIT(P4_EVENT_BSQ_CACHE_REFERENCE, RD_3rdL_HITM)),
  351. /* cache misses */
  352. [PERF_COUNT_HW_CACHE_MISSES] =
  353. p4_config_pack_escr(P4_ESCR_EVENT(P4_EVENT_BSQ_CACHE_REFERENCE) |
  354. P4_ESCR_EMASK_BIT(P4_EVENT_BSQ_CACHE_REFERENCE, RD_2ndL_MISS) |
  355. P4_ESCR_EMASK_BIT(P4_EVENT_BSQ_CACHE_REFERENCE, RD_3rdL_MISS) |
  356. P4_ESCR_EMASK_BIT(P4_EVENT_BSQ_CACHE_REFERENCE, WR_2ndL_MISS)),
  357. /* branch instructions retired */
  358. [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] =
  359. p4_config_pack_escr(P4_ESCR_EVENT(P4_EVENT_RETIRED_BRANCH_TYPE) |
  360. P4_ESCR_EMASK_BIT(P4_EVENT_RETIRED_BRANCH_TYPE, CONDITIONAL) |
  361. P4_ESCR_EMASK_BIT(P4_EVENT_RETIRED_BRANCH_TYPE, CALL) |
  362. P4_ESCR_EMASK_BIT(P4_EVENT_RETIRED_BRANCH_TYPE, RETURN) |
  363. P4_ESCR_EMASK_BIT(P4_EVENT_RETIRED_BRANCH_TYPE, INDIRECT)),
  364. /* mispredicted branches retired */
  365. [PERF_COUNT_HW_BRANCH_MISSES] =
  366. p4_config_pack_escr(P4_ESCR_EVENT(P4_EVENT_MISPRED_BRANCH_RETIRED) |
  367. P4_ESCR_EMASK_BIT(P4_EVENT_MISPRED_BRANCH_RETIRED, NBOGUS)),
  368. /* bus ready clocks (cpu is driving #DRDY_DRV\#DRDY_OWN): */
  369. [PERF_COUNT_HW_BUS_CYCLES] =
  370. p4_config_pack_escr(P4_ESCR_EVENT(P4_EVENT_FSB_DATA_ACTIVITY) |
  371. P4_ESCR_EMASK_BIT(P4_EVENT_FSB_DATA_ACTIVITY, DRDY_DRV) |
  372. P4_ESCR_EMASK_BIT(P4_EVENT_FSB_DATA_ACTIVITY, DRDY_OWN)) |
  373. p4_config_pack_cccr(P4_CCCR_EDGE | P4_CCCR_COMPARE),
  374. };
  375. static struct p4_event_bind *p4_config_get_bind(u64 config)
  376. {
  377. unsigned int evnt = p4_config_unpack_event(config);
  378. struct p4_event_bind *bind = NULL;
  379. if (evnt < ARRAY_SIZE(p4_event_bind_map))
  380. bind = &p4_event_bind_map[evnt];
  381. return bind;
  382. }
  383. static u64 p4_pmu_event_map(int hw_event)
  384. {
  385. struct p4_event_bind *bind;
  386. unsigned int esel;
  387. u64 config;
  388. config = p4_general_events[hw_event];
  389. bind = p4_config_get_bind(config);
  390. esel = P4_OPCODE_ESEL(bind->opcode);
  391. config |= p4_config_pack_cccr(P4_CCCR_ESEL(esel));
  392. return config;
  393. }
  394. static int p4_hw_config(struct perf_event *event)
  395. {
  396. int cpu = get_cpu();
  397. int rc = 0;
  398. unsigned int evnt;
  399. u32 escr, cccr;
  400. /*
  401. * the reason we use cpu that early is that: if we get scheduled
  402. * first time on the same cpu -- we will not need swap thread
  403. * specific flags in config (and will save some cpu cycles)
  404. */
  405. cccr = p4_default_cccr_conf(cpu);
  406. escr = p4_default_escr_conf(cpu, event->attr.exclude_kernel,
  407. event->attr.exclude_user);
  408. event->hw.config = p4_config_pack_escr(escr) |
  409. p4_config_pack_cccr(cccr);
  410. if (p4_ht_active() && p4_ht_thread(cpu))
  411. event->hw.config = p4_set_ht_bit(event->hw.config);
  412. if (event->attr.type == PERF_TYPE_RAW) {
  413. /* user data may have out-of-bound event index */
  414. evnt = p4_config_unpack_event(event->attr.config);
  415. if (evnt >= ARRAY_SIZE(p4_event_bind_map)) {
  416. rc = -EINVAL;
  417. goto out;
  418. }
  419. /*
  420. * We don't control raw events so it's up to the caller
  421. * to pass sane values (and we don't count the thread number
  422. * on HT machine but allow HT-compatible specifics to be
  423. * passed on)
  424. *
  425. * XXX: HT wide things should check perf_paranoid_cpu() &&
  426. * CAP_SYS_ADMIN
  427. */
  428. event->hw.config |= event->attr.config &
  429. (p4_config_pack_escr(P4_ESCR_MASK_HT) |
  430. p4_config_pack_cccr(P4_CCCR_MASK_HT));
  431. }
  432. rc = x86_setup_perfctr(event);
  433. out:
  434. put_cpu();
  435. return rc;
  436. }
  437. static inline int p4_pmu_clear_cccr_ovf(struct hw_perf_event *hwc)
  438. {
  439. int overflow = 0;
  440. u32 low, high;
  441. rdmsr(hwc->config_base + hwc->idx, low, high);
  442. /* we need to check high bit for unflagged overflows */
  443. if ((low & P4_CCCR_OVF) || !(high & (1 << 31))) {
  444. overflow = 1;
  445. (void)checking_wrmsrl(hwc->config_base + hwc->idx,
  446. ((u64)low) & ~P4_CCCR_OVF);
  447. }
  448. return overflow;
  449. }
  450. static inline void p4_pmu_disable_event(struct perf_event *event)
  451. {
  452. struct hw_perf_event *hwc = &event->hw;
  453. /*
  454. * If event gets disabled while counter is in overflowed
  455. * state we need to clear P4_CCCR_OVF, otherwise interrupt get
  456. * asserted again and again
  457. */
  458. (void)checking_wrmsrl(hwc->config_base + hwc->idx,
  459. (u64)(p4_config_unpack_cccr(hwc->config)) &
  460. ~P4_CCCR_ENABLE & ~P4_CCCR_OVF & ~P4_CCCR_RESERVED);
  461. }
  462. static void p4_pmu_disable_all(void)
  463. {
  464. struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
  465. int idx;
  466. for (idx = 0; idx < x86_pmu.num_counters; idx++) {
  467. struct perf_event *event = cpuc->events[idx];
  468. if (!test_bit(idx, cpuc->active_mask))
  469. continue;
  470. p4_pmu_disable_event(event);
  471. }
  472. }
  473. static void p4_pmu_enable_event(struct perf_event *event)
  474. {
  475. struct hw_perf_event *hwc = &event->hw;
  476. int thread = p4_ht_config_thread(hwc->config);
  477. u64 escr_conf = p4_config_unpack_escr(p4_clear_ht_bit(hwc->config));
  478. unsigned int idx = p4_config_unpack_event(hwc->config);
  479. unsigned int idx_cache = p4_config_unpack_cache_event(hwc->config);
  480. struct p4_event_bind *bind;
  481. struct p4_cache_event_bind *bind_cache;
  482. u64 escr_addr, cccr;
  483. bind = &p4_event_bind_map[idx];
  484. escr_addr = (u64)bind->escr_msr[thread];
  485. /*
  486. * - we dont support cascaded counters yet
  487. * - and counter 1 is broken (erratum)
  488. */
  489. WARN_ON_ONCE(p4_is_event_cascaded(hwc->config));
  490. WARN_ON_ONCE(hwc->idx == 1);
  491. /* we need a real Event value */
  492. escr_conf &= ~P4_ESCR_EVENT_MASK;
  493. escr_conf |= P4_ESCR_EVENT(P4_OPCODE_EVNT(bind->opcode));
  494. cccr = p4_config_unpack_cccr(hwc->config);
  495. /*
  496. * it could be Cache event so that we need to
  497. * set metrics into additional MSRs
  498. */
  499. BUILD_BUG_ON(P4_CACHE__MAX > P4_CCCR_CACHE_OPS_MASK);
  500. if (idx_cache > P4_CACHE__NONE &&
  501. idx_cache < ARRAY_SIZE(p4_cache_event_bind_map)) {
  502. bind_cache = &p4_cache_event_bind_map[idx_cache];
  503. (void)checking_wrmsrl(MSR_IA32_PEBS_ENABLE, (u64)bind_cache->metric_pebs);
  504. (void)checking_wrmsrl(MSR_P4_PEBS_MATRIX_VERT, (u64)bind_cache->metric_vert);
  505. }
  506. (void)checking_wrmsrl(escr_addr, escr_conf);
  507. (void)checking_wrmsrl(hwc->config_base + hwc->idx,
  508. (cccr & ~P4_CCCR_RESERVED) | P4_CCCR_ENABLE);
  509. }
  510. static void p4_pmu_enable_all(int added)
  511. {
  512. struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
  513. int idx;
  514. for (idx = 0; idx < x86_pmu.num_counters; idx++) {
  515. struct perf_event *event = cpuc->events[idx];
  516. if (!test_bit(idx, cpuc->active_mask))
  517. continue;
  518. p4_pmu_enable_event(event);
  519. }
  520. }
  521. static int p4_pmu_handle_irq(struct pt_regs *regs)
  522. {
  523. struct perf_sample_data data;
  524. struct cpu_hw_events *cpuc;
  525. struct perf_event *event;
  526. struct hw_perf_event *hwc;
  527. int idx, handled = 0;
  528. u64 val;
  529. data.addr = 0;
  530. data.raw = NULL;
  531. cpuc = &__get_cpu_var(cpu_hw_events);
  532. for (idx = 0; idx < x86_pmu.num_counters; idx++) {
  533. if (!test_bit(idx, cpuc->active_mask))
  534. continue;
  535. event = cpuc->events[idx];
  536. hwc = &event->hw;
  537. WARN_ON_ONCE(hwc->idx != idx);
  538. /* it might be unflagged overflow */
  539. handled = p4_pmu_clear_cccr_ovf(hwc);
  540. val = x86_perf_event_update(event);
  541. if (!handled && (val & (1ULL << (x86_pmu.cntval_bits - 1))))
  542. continue;
  543. /* event overflow for sure */
  544. data.period = event->hw.last_period;
  545. if (!x86_perf_event_set_period(event))
  546. continue;
  547. if (perf_event_overflow(event, 1, &data, regs))
  548. p4_pmu_disable_event(event);
  549. }
  550. if (handled) {
  551. /* p4 quirk: unmask it again */
  552. apic_write(APIC_LVTPC, apic_read(APIC_LVTPC) & ~APIC_LVT_MASKED);
  553. inc_irq_stat(apic_perf_irqs);
  554. }
  555. return handled;
  556. }
  557. /*
  558. * swap thread specific fields according to a thread
  559. * we are going to run on
  560. */
  561. static void p4_pmu_swap_config_ts(struct hw_perf_event *hwc, int cpu)
  562. {
  563. u32 escr, cccr;
  564. /*
  565. * we either lucky and continue on same cpu or no HT support
  566. */
  567. if (!p4_should_swap_ts(hwc->config, cpu))
  568. return;
  569. /*
  570. * the event is migrated from an another logical
  571. * cpu, so we need to swap thread specific flags
  572. */
  573. escr = p4_config_unpack_escr(hwc->config);
  574. cccr = p4_config_unpack_cccr(hwc->config);
  575. if (p4_ht_thread(cpu)) {
  576. cccr &= ~P4_CCCR_OVF_PMI_T0;
  577. cccr |= P4_CCCR_OVF_PMI_T1;
  578. if (escr & P4_ESCR_T0_OS) {
  579. escr &= ~P4_ESCR_T0_OS;
  580. escr |= P4_ESCR_T1_OS;
  581. }
  582. if (escr & P4_ESCR_T0_USR) {
  583. escr &= ~P4_ESCR_T0_USR;
  584. escr |= P4_ESCR_T1_USR;
  585. }
  586. hwc->config = p4_config_pack_escr(escr);
  587. hwc->config |= p4_config_pack_cccr(cccr);
  588. hwc->config |= P4_CONFIG_HT;
  589. } else {
  590. cccr &= ~P4_CCCR_OVF_PMI_T1;
  591. cccr |= P4_CCCR_OVF_PMI_T0;
  592. if (escr & P4_ESCR_T1_OS) {
  593. escr &= ~P4_ESCR_T1_OS;
  594. escr |= P4_ESCR_T0_OS;
  595. }
  596. if (escr & P4_ESCR_T1_USR) {
  597. escr &= ~P4_ESCR_T1_USR;
  598. escr |= P4_ESCR_T0_USR;
  599. }
  600. hwc->config = p4_config_pack_escr(escr);
  601. hwc->config |= p4_config_pack_cccr(cccr);
  602. hwc->config &= ~P4_CONFIG_HT;
  603. }
  604. }
  605. /*
  606. * ESCR address hashing is tricky, ESCRs are not sequential
  607. * in memory but all starts from MSR_P4_BSU_ESCR0 (0x03a0) and
  608. * the metric between any ESCRs is laid in range [0xa0,0xe1]
  609. *
  610. * so we make ~70% filled hashtable
  611. */
  612. #define P4_ESCR_MSR_BASE 0x000003a0
  613. #define P4_ESCR_MSR_MAX 0x000003e1
  614. #define P4_ESCR_MSR_TABLE_SIZE (P4_ESCR_MSR_MAX - P4_ESCR_MSR_BASE + 1)
  615. #define P4_ESCR_MSR_IDX(msr) (msr - P4_ESCR_MSR_BASE)
  616. #define P4_ESCR_MSR_TABLE_ENTRY(msr) [P4_ESCR_MSR_IDX(msr)] = msr
  617. static const unsigned int p4_escr_table[P4_ESCR_MSR_TABLE_SIZE] = {
  618. P4_ESCR_MSR_TABLE_ENTRY(MSR_P4_ALF_ESCR0),
  619. P4_ESCR_MSR_TABLE_ENTRY(MSR_P4_ALF_ESCR1),
  620. P4_ESCR_MSR_TABLE_ENTRY(MSR_P4_BPU_ESCR0),
  621. P4_ESCR_MSR_TABLE_ENTRY(MSR_P4_BPU_ESCR1),
  622. P4_ESCR_MSR_TABLE_ENTRY(MSR_P4_BSU_ESCR0),
  623. P4_ESCR_MSR_TABLE_ENTRY(MSR_P4_BSU_ESCR1),
  624. P4_ESCR_MSR_TABLE_ENTRY(MSR_P4_CRU_ESCR0),
  625. P4_ESCR_MSR_TABLE_ENTRY(MSR_P4_CRU_ESCR1),
  626. P4_ESCR_MSR_TABLE_ENTRY(MSR_P4_CRU_ESCR2),
  627. P4_ESCR_MSR_TABLE_ENTRY(MSR_P4_CRU_ESCR3),
  628. P4_ESCR_MSR_TABLE_ENTRY(MSR_P4_CRU_ESCR4),
  629. P4_ESCR_MSR_TABLE_ENTRY(MSR_P4_CRU_ESCR5),
  630. P4_ESCR_MSR_TABLE_ENTRY(MSR_P4_DAC_ESCR0),
  631. P4_ESCR_MSR_TABLE_ENTRY(MSR_P4_DAC_ESCR1),
  632. P4_ESCR_MSR_TABLE_ENTRY(MSR_P4_FIRM_ESCR0),
  633. P4_ESCR_MSR_TABLE_ENTRY(MSR_P4_FIRM_ESCR1),
  634. P4_ESCR_MSR_TABLE_ENTRY(MSR_P4_FLAME_ESCR0),
  635. P4_ESCR_MSR_TABLE_ENTRY(MSR_P4_FLAME_ESCR1),
  636. P4_ESCR_MSR_TABLE_ENTRY(MSR_P4_FSB_ESCR0),
  637. P4_ESCR_MSR_TABLE_ENTRY(MSR_P4_FSB_ESCR1),
  638. P4_ESCR_MSR_TABLE_ENTRY(MSR_P4_IQ_ESCR0),
  639. P4_ESCR_MSR_TABLE_ENTRY(MSR_P4_IQ_ESCR1),
  640. P4_ESCR_MSR_TABLE_ENTRY(MSR_P4_IS_ESCR0),
  641. P4_ESCR_MSR_TABLE_ENTRY(MSR_P4_IS_ESCR1),
  642. P4_ESCR_MSR_TABLE_ENTRY(MSR_P4_ITLB_ESCR0),
  643. P4_ESCR_MSR_TABLE_ENTRY(MSR_P4_ITLB_ESCR1),
  644. P4_ESCR_MSR_TABLE_ENTRY(MSR_P4_IX_ESCR0),
  645. P4_ESCR_MSR_TABLE_ENTRY(MSR_P4_IX_ESCR1),
  646. P4_ESCR_MSR_TABLE_ENTRY(MSR_P4_MOB_ESCR0),
  647. P4_ESCR_MSR_TABLE_ENTRY(MSR_P4_MOB_ESCR1),
  648. P4_ESCR_MSR_TABLE_ENTRY(MSR_P4_MS_ESCR0),
  649. P4_ESCR_MSR_TABLE_ENTRY(MSR_P4_MS_ESCR1),
  650. P4_ESCR_MSR_TABLE_ENTRY(MSR_P4_PMH_ESCR0),
  651. P4_ESCR_MSR_TABLE_ENTRY(MSR_P4_PMH_ESCR1),
  652. P4_ESCR_MSR_TABLE_ENTRY(MSR_P4_RAT_ESCR0),
  653. P4_ESCR_MSR_TABLE_ENTRY(MSR_P4_RAT_ESCR1),
  654. P4_ESCR_MSR_TABLE_ENTRY(MSR_P4_SAAT_ESCR0),
  655. P4_ESCR_MSR_TABLE_ENTRY(MSR_P4_SAAT_ESCR1),
  656. P4_ESCR_MSR_TABLE_ENTRY(MSR_P4_SSU_ESCR0),
  657. P4_ESCR_MSR_TABLE_ENTRY(MSR_P4_SSU_ESCR1),
  658. P4_ESCR_MSR_TABLE_ENTRY(MSR_P4_TBPU_ESCR0),
  659. P4_ESCR_MSR_TABLE_ENTRY(MSR_P4_TBPU_ESCR1),
  660. P4_ESCR_MSR_TABLE_ENTRY(MSR_P4_TC_ESCR0),
  661. P4_ESCR_MSR_TABLE_ENTRY(MSR_P4_TC_ESCR1),
  662. P4_ESCR_MSR_TABLE_ENTRY(MSR_P4_U2L_ESCR0),
  663. P4_ESCR_MSR_TABLE_ENTRY(MSR_P4_U2L_ESCR1),
  664. };
  665. static int p4_get_escr_idx(unsigned int addr)
  666. {
  667. unsigned int idx = P4_ESCR_MSR_IDX(addr);
  668. if (unlikely(idx >= P4_ESCR_MSR_TABLE_SIZE ||
  669. !p4_escr_table[idx] ||
  670. p4_escr_table[idx] != addr)) {
  671. WARN_ONCE(1, "P4 PMU: Wrong address passed: %x\n", addr);
  672. return -1;
  673. }
  674. return idx;
  675. }
  676. static int p4_next_cntr(int thread, unsigned long *used_mask,
  677. struct p4_event_bind *bind)
  678. {
  679. int i, j;
  680. for (i = 0; i < P4_CNTR_LIMIT; i++) {
  681. j = bind->cntr[thread][i];
  682. if (j != -1 && !test_bit(j, used_mask))
  683. return j;
  684. }
  685. return -1;
  686. }
  687. static int p4_pmu_schedule_events(struct cpu_hw_events *cpuc, int n, int *assign)
  688. {
  689. unsigned long used_mask[BITS_TO_LONGS(X86_PMC_IDX_MAX)];
  690. unsigned long escr_mask[BITS_TO_LONGS(P4_ESCR_MSR_TABLE_SIZE)];
  691. int cpu = smp_processor_id();
  692. struct hw_perf_event *hwc;
  693. struct p4_event_bind *bind;
  694. unsigned int i, thread, num;
  695. int cntr_idx, escr_idx;
  696. bitmap_zero(used_mask, X86_PMC_IDX_MAX);
  697. bitmap_zero(escr_mask, P4_ESCR_MSR_TABLE_SIZE);
  698. for (i = 0, num = n; i < n; i++, num--) {
  699. hwc = &cpuc->event_list[i]->hw;
  700. thread = p4_ht_thread(cpu);
  701. bind = p4_config_get_bind(hwc->config);
  702. escr_idx = p4_get_escr_idx(bind->escr_msr[thread]);
  703. if (unlikely(escr_idx == -1))
  704. goto done;
  705. if (hwc->idx != -1 && !p4_should_swap_ts(hwc->config, cpu)) {
  706. cntr_idx = hwc->idx;
  707. if (assign)
  708. assign[i] = hwc->idx;
  709. goto reserve;
  710. }
  711. cntr_idx = p4_next_cntr(thread, used_mask, bind);
  712. if (cntr_idx == -1 || test_bit(escr_idx, escr_mask))
  713. goto done;
  714. p4_pmu_swap_config_ts(hwc, cpu);
  715. if (assign)
  716. assign[i] = cntr_idx;
  717. reserve:
  718. set_bit(cntr_idx, used_mask);
  719. set_bit(escr_idx, escr_mask);
  720. }
  721. done:
  722. return num ? -ENOSPC : 0;
  723. }
  724. static __initconst const struct x86_pmu p4_pmu = {
  725. .name = "Netburst P4/Xeon",
  726. .handle_irq = p4_pmu_handle_irq,
  727. .disable_all = p4_pmu_disable_all,
  728. .enable_all = p4_pmu_enable_all,
  729. .enable = p4_pmu_enable_event,
  730. .disable = p4_pmu_disable_event,
  731. .eventsel = MSR_P4_BPU_CCCR0,
  732. .perfctr = MSR_P4_BPU_PERFCTR0,
  733. .event_map = p4_pmu_event_map,
  734. .max_events = ARRAY_SIZE(p4_general_events),
  735. .get_event_constraints = x86_get_event_constraints,
  736. /*
  737. * IF HT disabled we may need to use all
  738. * ARCH_P4_MAX_CCCR counters simulaneously
  739. * though leave it restricted at moment assuming
  740. * HT is on
  741. */
  742. .num_counters = ARCH_P4_MAX_CCCR,
  743. .apic = 1,
  744. .cntval_bits = 40,
  745. .cntval_mask = (1ULL << 40) - 1,
  746. .max_period = (1ULL << 39) - 1,
  747. .hw_config = p4_hw_config,
  748. .schedule_events = p4_pmu_schedule_events,
  749. };
  750. static __init int p4_pmu_init(void)
  751. {
  752. unsigned int low, high;
  753. /* If we get stripped -- indexig fails */
  754. BUILD_BUG_ON(ARCH_P4_MAX_CCCR > X86_PMC_MAX_GENERIC);
  755. rdmsr(MSR_IA32_MISC_ENABLE, low, high);
  756. if (!(low & (1 << 7))) {
  757. pr_cont("unsupported Netburst CPU model %d ",
  758. boot_cpu_data.x86_model);
  759. return -ENODEV;
  760. }
  761. memcpy(hw_cache_event_ids, p4_hw_cache_event_ids,
  762. sizeof(hw_cache_event_ids));
  763. pr_cont("Netburst events, ");
  764. x86_pmu = p4_pmu;
  765. return 0;
  766. }
  767. #endif /* CONFIG_CPU_SUP_INTEL */