nmi_int.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701
  1. /**
  2. * @file nmi_int.c
  3. *
  4. * @remark Copyright 2002-2009 OProfile authors
  5. * @remark Read the file COPYING
  6. *
  7. * @author John Levon <levon@movementarian.org>
  8. * @author Robert Richter <robert.richter@amd.com>
  9. * @author Barry Kasindorf <barry.kasindorf@amd.com>
  10. * @author Jason Yeh <jason.yeh@amd.com>
  11. * @author Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
  12. */
  13. #include <linux/init.h>
  14. #include <linux/notifier.h>
  15. #include <linux/smp.h>
  16. #include <linux/oprofile.h>
  17. #include <linux/sysdev.h>
  18. #include <linux/slab.h>
  19. #include <linux/moduleparam.h>
  20. #include <linux/kdebug.h>
  21. #include <linux/cpu.h>
  22. #include <asm/nmi.h>
  23. #include <asm/msr.h>
  24. #include <asm/apic.h>
  25. #include "op_counter.h"
  26. #include "op_x86_model.h"
  27. #ifdef CONFIG_OPROFILE_EVENT_MULTIPLEX
  28. DEFINE_PER_CPU(int, switch_index);
  29. #endif
  30. static struct op_x86_model_spec const *model;
  31. static DEFINE_PER_CPU(struct op_msrs, cpu_msrs);
  32. static DEFINE_PER_CPU(unsigned long, saved_lvtpc);
  33. /* 0 == registered but off, 1 == registered and on */
  34. static int nmi_enabled = 0;
  35. #ifdef CONFIG_OPROFILE_EVENT_MULTIPLEX
  36. extern atomic_t multiplex_counter;
  37. #endif
  38. struct op_counter_config counter_config[OP_MAX_COUNTER];
  39. /* common functions */
  40. u64 op_x86_get_ctrl(struct op_x86_model_spec const *model,
  41. struct op_counter_config *counter_config)
  42. {
  43. u64 val = 0;
  44. u16 event = (u16)counter_config->event;
  45. val |= ARCH_PERFMON_EVENTSEL_INT;
  46. val |= counter_config->user ? ARCH_PERFMON_EVENTSEL_USR : 0;
  47. val |= counter_config->kernel ? ARCH_PERFMON_EVENTSEL_OS : 0;
  48. val |= (counter_config->unit_mask & 0xFF) << 8;
  49. event &= model->event_mask ? model->event_mask : 0xFF;
  50. val |= event & 0xFF;
  51. val |= (event & 0x0F00) << 24;
  52. return val;
  53. }
  54. static int profile_exceptions_notify(struct notifier_block *self,
  55. unsigned long val, void *data)
  56. {
  57. struct die_args *args = (struct die_args *)data;
  58. int ret = NOTIFY_DONE;
  59. int cpu = smp_processor_id();
  60. switch (val) {
  61. case DIE_NMI:
  62. case DIE_NMI_IPI:
  63. model->check_ctrs(args->regs, &per_cpu(cpu_msrs, cpu));
  64. ret = NOTIFY_STOP;
  65. break;
  66. default:
  67. break;
  68. }
  69. return ret;
  70. }
  71. static void nmi_cpu_save_registers(struct op_msrs *msrs)
  72. {
  73. struct op_msr *counters = msrs->counters;
  74. struct op_msr *controls = msrs->controls;
  75. unsigned int i;
  76. for (i = 0; i < model->num_counters; ++i) {
  77. if (counters[i].addr)
  78. rdmsrl(counters[i].addr, counters[i].saved);
  79. }
  80. for (i = 0; i < model->num_controls; ++i) {
  81. if (controls[i].addr)
  82. rdmsrl(controls[i].addr, controls[i].saved);
  83. }
  84. }
  85. static void free_msrs(void)
  86. {
  87. int i;
  88. for_each_possible_cpu(i) {
  89. kfree(per_cpu(cpu_msrs, i).counters);
  90. per_cpu(cpu_msrs, i).counters = NULL;
  91. kfree(per_cpu(cpu_msrs, i).controls);
  92. per_cpu(cpu_msrs, i).controls = NULL;
  93. #ifdef CONFIG_OPROFILE_EVENT_MULTIPLEX
  94. kfree(per_cpu(cpu_msrs, i).multiplex);
  95. per_cpu(cpu_msrs, i).multiplex = NULL;
  96. #endif
  97. }
  98. }
  99. static int allocate_msrs(void)
  100. {
  101. int success = 1;
  102. size_t controls_size = sizeof(struct op_msr) * model->num_controls;
  103. size_t counters_size = sizeof(struct op_msr) * model->num_counters;
  104. #ifdef CONFIG_OPROFILE_EVENT_MULTIPLEX
  105. size_t multiplex_size = sizeof(struct op_msr) * model->num_virt_counters;
  106. #endif
  107. int i;
  108. for_each_possible_cpu(i) {
  109. per_cpu(cpu_msrs, i).counters = kmalloc(counters_size,
  110. GFP_KERNEL);
  111. if (!per_cpu(cpu_msrs, i).counters) {
  112. success = 0;
  113. break;
  114. }
  115. per_cpu(cpu_msrs, i).controls = kmalloc(controls_size,
  116. GFP_KERNEL);
  117. if (!per_cpu(cpu_msrs, i).controls) {
  118. success = 0;
  119. break;
  120. }
  121. #ifdef CONFIG_OPROFILE_EVENT_MULTIPLEX
  122. per_cpu(cpu_msrs, i).multiplex =
  123. kmalloc(multiplex_size, GFP_KERNEL);
  124. if (!per_cpu(cpu_msrs, i).multiplex) {
  125. success = 0;
  126. break;
  127. }
  128. #endif
  129. }
  130. if (!success)
  131. free_msrs();
  132. return success;
  133. }
  134. #ifdef CONFIG_OPROFILE_EVENT_MULTIPLEX
  135. static void nmi_cpu_setup_mux(int cpu, struct op_msrs const * const msrs)
  136. {
  137. int i;
  138. struct op_msr *multiplex = msrs->multiplex;
  139. for (i = 0; i < model->num_virt_counters; ++i) {
  140. if (counter_config[i].enabled) {
  141. multiplex[i].saved = -(u64)counter_config[i].count;
  142. } else {
  143. multiplex[i].addr = 0;
  144. multiplex[i].saved = 0;
  145. }
  146. }
  147. per_cpu(switch_index, cpu) = 0;
  148. }
  149. #else
  150. static inline void
  151. nmi_cpu_setup_mux(int cpu, struct op_msrs const * const msrs) { }
  152. #endif
  153. static void nmi_cpu_setup(void *dummy)
  154. {
  155. int cpu = smp_processor_id();
  156. struct op_msrs *msrs = &per_cpu(cpu_msrs, cpu);
  157. nmi_cpu_save_registers(msrs);
  158. spin_lock(&oprofilefs_lock);
  159. model->setup_ctrs(model, msrs);
  160. nmi_cpu_setup_mux(cpu, msrs);
  161. spin_unlock(&oprofilefs_lock);
  162. per_cpu(saved_lvtpc, cpu) = apic_read(APIC_LVTPC);
  163. apic_write(APIC_LVTPC, APIC_DM_NMI);
  164. }
  165. static struct notifier_block profile_exceptions_nb = {
  166. .notifier_call = profile_exceptions_notify,
  167. .next = NULL,
  168. .priority = 2
  169. };
  170. static int nmi_setup(void)
  171. {
  172. int err = 0;
  173. int cpu;
  174. if (!allocate_msrs())
  175. return -ENOMEM;
  176. err = register_die_notifier(&profile_exceptions_nb);
  177. if (err) {
  178. free_msrs();
  179. return err;
  180. }
  181. /* We need to serialize save and setup for HT because the subset
  182. * of msrs are distinct for save and setup operations
  183. */
  184. /* Assume saved/restored counters are the same on all CPUs */
  185. model->fill_in_addresses(&per_cpu(cpu_msrs, 0));
  186. for_each_possible_cpu(cpu) {
  187. if (cpu != 0) {
  188. memcpy(per_cpu(cpu_msrs, cpu).counters,
  189. per_cpu(cpu_msrs, 0).counters,
  190. sizeof(struct op_msr) * model->num_counters);
  191. memcpy(per_cpu(cpu_msrs, cpu).controls,
  192. per_cpu(cpu_msrs, 0).controls,
  193. sizeof(struct op_msr) * model->num_controls);
  194. #ifdef CONFIG_OPROFILE_EVENT_MULTIPLEX
  195. memcpy(per_cpu(cpu_msrs, cpu).multiplex,
  196. per_cpu(cpu_msrs, 0).multiplex,
  197. sizeof(struct op_msr) * model->num_virt_counters);
  198. #endif
  199. }
  200. }
  201. on_each_cpu(nmi_cpu_setup, NULL, 1);
  202. nmi_enabled = 1;
  203. return 0;
  204. }
  205. #ifdef CONFIG_OPROFILE_EVENT_MULTIPLEX
  206. static void nmi_cpu_save_mpx_registers(struct op_msrs *msrs)
  207. {
  208. unsigned int si = __get_cpu_var(switch_index);
  209. struct op_msr *multiplex = msrs->multiplex;
  210. unsigned int i;
  211. for (i = 0; i < model->num_counters; ++i) {
  212. int offset = i + si;
  213. if (multiplex[offset].addr) {
  214. rdmsrl(multiplex[offset].addr,
  215. multiplex[offset].saved);
  216. }
  217. }
  218. }
  219. static void nmi_cpu_restore_mpx_registers(struct op_msrs *msrs)
  220. {
  221. unsigned int si = __get_cpu_var(switch_index);
  222. struct op_msr *multiplex = msrs->multiplex;
  223. unsigned int i;
  224. for (i = 0; i < model->num_counters; ++i) {
  225. int offset = i + si;
  226. if (multiplex[offset].addr) {
  227. wrmsrl(multiplex[offset].addr,
  228. multiplex[offset].saved);
  229. }
  230. }
  231. }
  232. #endif
  233. static void nmi_cpu_restore_registers(struct op_msrs *msrs)
  234. {
  235. struct op_msr *counters = msrs->counters;
  236. struct op_msr *controls = msrs->controls;
  237. unsigned int i;
  238. for (i = 0; i < model->num_controls; ++i) {
  239. if (controls[i].addr)
  240. wrmsrl(controls[i].addr, controls[i].saved);
  241. }
  242. for (i = 0; i < model->num_counters; ++i) {
  243. if (counters[i].addr)
  244. wrmsrl(counters[i].addr, counters[i].saved);
  245. }
  246. }
  247. static void nmi_cpu_shutdown(void *dummy)
  248. {
  249. unsigned int v;
  250. int cpu = smp_processor_id();
  251. struct op_msrs *msrs = &per_cpu(cpu_msrs, cpu);
  252. /* restoring APIC_LVTPC can trigger an apic error because the delivery
  253. * mode and vector nr combination can be illegal. That's by design: on
  254. * power on apic lvt contain a zero vector nr which are legal only for
  255. * NMI delivery mode. So inhibit apic err before restoring lvtpc
  256. */
  257. v = apic_read(APIC_LVTERR);
  258. apic_write(APIC_LVTERR, v | APIC_LVT_MASKED);
  259. apic_write(APIC_LVTPC, per_cpu(saved_lvtpc, cpu));
  260. apic_write(APIC_LVTERR, v);
  261. nmi_cpu_restore_registers(msrs);
  262. #ifdef CONFIG_OPROFILE_EVENT_MULTIPLEX
  263. per_cpu(switch_index, cpu) = 0;
  264. #endif
  265. }
  266. static void nmi_shutdown(void)
  267. {
  268. struct op_msrs *msrs;
  269. nmi_enabled = 0;
  270. on_each_cpu(nmi_cpu_shutdown, NULL, 1);
  271. unregister_die_notifier(&profile_exceptions_nb);
  272. msrs = &get_cpu_var(cpu_msrs);
  273. model->shutdown(msrs);
  274. free_msrs();
  275. put_cpu_var(cpu_msrs);
  276. }
  277. static void nmi_cpu_start(void *dummy)
  278. {
  279. struct op_msrs const *msrs = &__get_cpu_var(cpu_msrs);
  280. model->start(msrs);
  281. }
  282. static int nmi_start(void)
  283. {
  284. on_each_cpu(nmi_cpu_start, NULL, 1);
  285. return 0;
  286. }
  287. static void nmi_cpu_stop(void *dummy)
  288. {
  289. struct op_msrs const *msrs = &__get_cpu_var(cpu_msrs);
  290. model->stop(msrs);
  291. }
  292. static void nmi_stop(void)
  293. {
  294. on_each_cpu(nmi_cpu_stop, NULL, 1);
  295. }
  296. static int nmi_create_files(struct super_block *sb, struct dentry *root)
  297. {
  298. unsigned int i;
  299. for (i = 0; i < model->num_virt_counters; ++i) {
  300. struct dentry *dir;
  301. char buf[4];
  302. #ifndef CONFIG_OPROFILE_EVENT_MULTIPLEX
  303. /* quick little hack to _not_ expose a counter if it is not
  304. * available for use. This should protect userspace app.
  305. * NOTE: assumes 1:1 mapping here (that counters are organized
  306. * sequentially in their struct assignment).
  307. */
  308. if (unlikely(!avail_to_resrv_perfctr_nmi_bit(i)))
  309. continue;
  310. #endif /* CONFIG_OPROFILE_EVENT_MULTIPLEX */
  311. snprintf(buf, sizeof(buf), "%d", i);
  312. dir = oprofilefs_mkdir(sb, root, buf);
  313. oprofilefs_create_ulong(sb, dir, "enabled", &counter_config[i].enabled);
  314. oprofilefs_create_ulong(sb, dir, "event", &counter_config[i].event);
  315. oprofilefs_create_ulong(sb, dir, "count", &counter_config[i].count);
  316. oprofilefs_create_ulong(sb, dir, "unit_mask", &counter_config[i].unit_mask);
  317. oprofilefs_create_ulong(sb, dir, "kernel", &counter_config[i].kernel);
  318. oprofilefs_create_ulong(sb, dir, "user", &counter_config[i].user);
  319. }
  320. return 0;
  321. }
  322. #ifdef CONFIG_OPROFILE_EVENT_MULTIPLEX
  323. static void nmi_cpu_switch(void *dummy)
  324. {
  325. int cpu = smp_processor_id();
  326. int si = per_cpu(switch_index, cpu);
  327. struct op_msrs *msrs = &per_cpu(cpu_msrs, cpu);
  328. nmi_cpu_stop(NULL);
  329. nmi_cpu_save_mpx_registers(msrs);
  330. /* move to next set */
  331. si += model->num_counters;
  332. if ((si > model->num_virt_counters) || (counter_config[si].count == 0))
  333. per_cpu(switch_index, cpu) = 0;
  334. else
  335. per_cpu(switch_index, cpu) = si;
  336. model->switch_ctrl(model, msrs);
  337. nmi_cpu_restore_mpx_registers(msrs);
  338. nmi_cpu_start(NULL);
  339. }
  340. /*
  341. * Quick check to see if multiplexing is necessary.
  342. * The check should be sufficient since counters are used
  343. * in ordre.
  344. */
  345. static int nmi_multiplex_on(void)
  346. {
  347. return counter_config[model->num_counters].count ? 0 : -EINVAL;
  348. }
  349. static int nmi_switch_event(void)
  350. {
  351. if (!model->switch_ctrl)
  352. return -ENOSYS; /* not implemented */
  353. if (nmi_multiplex_on() < 0)
  354. return -EINVAL; /* not necessary */
  355. on_each_cpu(nmi_cpu_switch, NULL, 1);
  356. atomic_inc(&multiplex_counter);
  357. return 0;
  358. }
  359. #endif
  360. #ifdef CONFIG_SMP
  361. static int oprofile_cpu_notifier(struct notifier_block *b, unsigned long action,
  362. void *data)
  363. {
  364. int cpu = (unsigned long)data;
  365. switch (action) {
  366. case CPU_DOWN_FAILED:
  367. case CPU_ONLINE:
  368. smp_call_function_single(cpu, nmi_cpu_start, NULL, 0);
  369. break;
  370. case CPU_DOWN_PREPARE:
  371. smp_call_function_single(cpu, nmi_cpu_stop, NULL, 1);
  372. break;
  373. }
  374. return NOTIFY_DONE;
  375. }
  376. static struct notifier_block oprofile_cpu_nb = {
  377. .notifier_call = oprofile_cpu_notifier
  378. };
  379. #endif
  380. #ifdef CONFIG_PM
  381. static int nmi_suspend(struct sys_device *dev, pm_message_t state)
  382. {
  383. /* Only one CPU left, just stop that one */
  384. if (nmi_enabled == 1)
  385. nmi_cpu_stop(NULL);
  386. return 0;
  387. }
  388. static int nmi_resume(struct sys_device *dev)
  389. {
  390. if (nmi_enabled == 1)
  391. nmi_cpu_start(NULL);
  392. return 0;
  393. }
  394. static struct sysdev_class oprofile_sysclass = {
  395. .name = "oprofile",
  396. .resume = nmi_resume,
  397. .suspend = nmi_suspend,
  398. };
  399. static struct sys_device device_oprofile = {
  400. .id = 0,
  401. .cls = &oprofile_sysclass,
  402. };
  403. static int __init init_sysfs(void)
  404. {
  405. int error;
  406. error = sysdev_class_register(&oprofile_sysclass);
  407. if (!error)
  408. error = sysdev_register(&device_oprofile);
  409. return error;
  410. }
  411. static void exit_sysfs(void)
  412. {
  413. sysdev_unregister(&device_oprofile);
  414. sysdev_class_unregister(&oprofile_sysclass);
  415. }
  416. #else
  417. #define init_sysfs() do { } while (0)
  418. #define exit_sysfs() do { } while (0)
  419. #endif /* CONFIG_PM */
  420. static int __init p4_init(char **cpu_type)
  421. {
  422. __u8 cpu_model = boot_cpu_data.x86_model;
  423. if (cpu_model > 6 || cpu_model == 5)
  424. return 0;
  425. #ifndef CONFIG_SMP
  426. *cpu_type = "i386/p4";
  427. model = &op_p4_spec;
  428. return 1;
  429. #else
  430. switch (smp_num_siblings) {
  431. case 1:
  432. *cpu_type = "i386/p4";
  433. model = &op_p4_spec;
  434. return 1;
  435. case 2:
  436. *cpu_type = "i386/p4-ht";
  437. model = &op_p4_ht2_spec;
  438. return 1;
  439. }
  440. #endif
  441. printk(KERN_INFO "oprofile: P4 HyperThreading detected with > 2 threads\n");
  442. printk(KERN_INFO "oprofile: Reverting to timer mode.\n");
  443. return 0;
  444. }
  445. static int force_arch_perfmon;
  446. static int force_cpu_type(const char *str, struct kernel_param *kp)
  447. {
  448. if (!strcmp(str, "arch_perfmon")) {
  449. force_arch_perfmon = 1;
  450. printk(KERN_INFO "oprofile: forcing architectural perfmon\n");
  451. }
  452. return 0;
  453. }
  454. module_param_call(cpu_type, force_cpu_type, NULL, NULL, 0);
  455. static int __init ppro_init(char **cpu_type)
  456. {
  457. __u8 cpu_model = boot_cpu_data.x86_model;
  458. struct op_x86_model_spec const *spec = &op_ppro_spec; /* default */
  459. if (force_arch_perfmon && cpu_has_arch_perfmon)
  460. return 0;
  461. switch (cpu_model) {
  462. case 0 ... 2:
  463. *cpu_type = "i386/ppro";
  464. break;
  465. case 3 ... 5:
  466. *cpu_type = "i386/pii";
  467. break;
  468. case 6 ... 8:
  469. case 10 ... 11:
  470. *cpu_type = "i386/piii";
  471. break;
  472. case 9:
  473. case 13:
  474. *cpu_type = "i386/p6_mobile";
  475. break;
  476. case 14:
  477. *cpu_type = "i386/core";
  478. break;
  479. case 15: case 23:
  480. *cpu_type = "i386/core_2";
  481. break;
  482. case 26:
  483. spec = &op_arch_perfmon_spec;
  484. *cpu_type = "i386/core_i7";
  485. break;
  486. case 28:
  487. *cpu_type = "i386/atom";
  488. break;
  489. default:
  490. /* Unknown */
  491. return 0;
  492. }
  493. model = spec;
  494. return 1;
  495. }
  496. /* in order to get sysfs right */
  497. static int using_nmi;
  498. int __init op_nmi_init(struct oprofile_operations *ops)
  499. {
  500. __u8 vendor = boot_cpu_data.x86_vendor;
  501. __u8 family = boot_cpu_data.x86;
  502. char *cpu_type = NULL;
  503. int ret = 0;
  504. if (!cpu_has_apic)
  505. return -ENODEV;
  506. switch (vendor) {
  507. case X86_VENDOR_AMD:
  508. /* Needs to be at least an Athlon (or hammer in 32bit mode) */
  509. switch (family) {
  510. case 6:
  511. cpu_type = "i386/athlon";
  512. break;
  513. case 0xf:
  514. /*
  515. * Actually it could be i386/hammer too, but
  516. * give user space an consistent name.
  517. */
  518. cpu_type = "x86-64/hammer";
  519. break;
  520. case 0x10:
  521. cpu_type = "x86-64/family10";
  522. break;
  523. case 0x11:
  524. cpu_type = "x86-64/family11h";
  525. break;
  526. default:
  527. return -ENODEV;
  528. }
  529. model = &op_amd_spec;
  530. break;
  531. case X86_VENDOR_INTEL:
  532. switch (family) {
  533. /* Pentium IV */
  534. case 0xf:
  535. p4_init(&cpu_type);
  536. break;
  537. /* A P6-class processor */
  538. case 6:
  539. ppro_init(&cpu_type);
  540. break;
  541. default:
  542. break;
  543. }
  544. if (cpu_type)
  545. break;
  546. if (!cpu_has_arch_perfmon)
  547. return -ENODEV;
  548. /* use arch perfmon as fallback */
  549. cpu_type = "i386/arch_perfmon";
  550. model = &op_arch_perfmon_spec;
  551. break;
  552. default:
  553. return -ENODEV;
  554. }
  555. #ifdef CONFIG_SMP
  556. register_cpu_notifier(&oprofile_cpu_nb);
  557. #endif
  558. /* default values, can be overwritten by model */
  559. ops->create_files = nmi_create_files;
  560. ops->setup = nmi_setup;
  561. ops->shutdown = nmi_shutdown;
  562. ops->start = nmi_start;
  563. ops->stop = nmi_stop;
  564. ops->cpu_type = cpu_type;
  565. #ifdef CONFIG_OPROFILE_EVENT_MULTIPLEX
  566. ops->switch_events = nmi_switch_event;
  567. #endif
  568. if (model->init)
  569. ret = model->init(ops);
  570. if (ret)
  571. return ret;
  572. init_sysfs();
  573. using_nmi = 1;
  574. printk(KERN_INFO "oprofile: using NMI interrupt.\n");
  575. return 0;
  576. }
  577. void op_nmi_exit(void)
  578. {
  579. if (using_nmi) {
  580. exit_sysfs();
  581. #ifdef CONFIG_SMP
  582. unregister_cpu_notifier(&oprofile_cpu_nb);
  583. #endif
  584. }
  585. if (model->exit)
  586. model->exit();
  587. }