aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/oprofile
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/oprofile')
-rw-r--r--arch/x86/oprofile/nmi_int.c14
-rw-r--r--arch/x86/oprofile/op_model_athlon.c18
2 files changed, 25 insertions, 7 deletions
diff --git a/arch/x86/oprofile/nmi_int.c b/arch/x86/oprofile/nmi_int.c
index b29819313f2b..287513a09819 100644
--- a/arch/x86/oprofile/nmi_int.c
+++ b/arch/x86/oprofile/nmi_int.c
@@ -468,6 +468,14 @@ int __init op_nmi_init(struct oprofile_operations *ops)
468 return -ENODEV; 468 return -ENODEV;
469 } 469 }
470 470
471 /* default values, can be overwritten by model */
472 ops->create_files = nmi_create_files;
473 ops->setup = nmi_setup;
474 ops->shutdown = nmi_shutdown;
475 ops->start = nmi_start;
476 ops->stop = nmi_stop;
477 ops->cpu_type = cpu_type;
478
471 if (model->init) 479 if (model->init)
472 ret = model->init(ops); 480 ret = model->init(ops);
473 if (ret) 481 if (ret)
@@ -475,12 +483,6 @@ int __init op_nmi_init(struct oprofile_operations *ops)
475 483
476 init_sysfs(); 484 init_sysfs();
477 using_nmi = 1; 485 using_nmi = 1;
478 ops->create_files = nmi_create_files;
479 ops->setup = nmi_setup;
480 ops->shutdown = nmi_shutdown;
481 ops->start = nmi_start;
482 ops->stop = nmi_stop;
483 ops->cpu_type = cpu_type;
484 printk(KERN_INFO "oprofile: using NMI interrupt.\n"); 486 printk(KERN_INFO "oprofile: using NMI interrupt.\n");
485 return 0; 487 return 0;
486} 488}
diff --git a/arch/x86/oprofile/op_model_athlon.c b/arch/x86/oprofile/op_model_athlon.c
index 2650b12a0c56..0d8390319797 100644
--- a/arch/x86/oprofile/op_model_athlon.c
+++ b/arch/x86/oprofile/op_model_athlon.c
@@ -446,13 +446,25 @@ static void clear_ibs_nmi(void)
446 on_each_cpu(apic_clear_ibs_nmi_per_cpu, NULL, 1); 446 on_each_cpu(apic_clear_ibs_nmi_per_cpu, NULL, 1);
447} 447}
448 448
449static int (*create_arch_files)(struct super_block * sb, struct dentry * root);
450
449static int setup_ibs_files(struct super_block * sb, struct dentry * root) 451static int setup_ibs_files(struct super_block * sb, struct dentry * root)
450{ 452{
451 char buf[12]; 453 char buf[12];
452 struct dentry *dir; 454 struct dentry *dir;
455 int ret = 0;
456
457 /* architecture specific files */
458 if (create_arch_files)
459 ret = create_arch_files(sb, root);
460
461 if (ret)
462 return ret;
453 463
454 if (!ibs_allowed) 464 if (!ibs_allowed)
455 return 0; 465 return ret;
466
467 /* model specific files */
456 468
457 /* setup some reasonable defaults */ 469 /* setup some reasonable defaults */
458 ibs_config.max_cnt_fetch = 250000; 470 ibs_config.max_cnt_fetch = 250000;
@@ -482,11 +494,15 @@ static int setup_ibs_files(struct super_block * sb, struct dentry * root)
482 494
483static int op_amd_init(struct oprofile_operations *ops) 495static int op_amd_init(struct oprofile_operations *ops)
484{ 496{
497 setup_ibs();
498 create_arch_files = ops->create_files;
499 ops->create_files = setup_ibs_files;
485 return 0; 500 return 0;
486} 501}
487 502
488static void op_amd_exit(void) 503static void op_amd_exit(void)
489{ 504{
505 clear_ibs_nmi();
490} 506}
491 507
492struct op_x86_model_spec const op_amd_spec = { 508struct op_x86_model_spec const op_amd_spec = {