diff options
author | Robert Richter <robert.richter@amd.com> | 2008-07-22 15:09:01 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-07-26 05:48:09 -0400 |
commit | 270d3e1a10e6ef85d5a085377e01d91dbcbe3726 (patch) | |
tree | 4844fe5a7f21748176f96e47dfaf0f56b8464ae8 /arch/x86/oprofile | |
parent | fc2bd7345b4e006a34c2ea3711d8c6b83cba50f7 (diff) |
OProfile: enable IBS for AMD CPUs
Signed-off-by: Robert Richter <robert.richter@amd.com>
Cc: oprofile-list <oprofile-list@lists.sourceforge.net>
Cc: Barry Kasindorf <barry.kasindorf@amd.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/oprofile')
-rw-r--r-- | arch/x86/oprofile/nmi_int.c | 14 | ||||
-rw-r--r-- | arch/x86/oprofile/op_model_athlon.c | 18 |
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 | ||
449 | static int (*create_arch_files)(struct super_block * sb, struct dentry * root); | ||
450 | |||
449 | static int setup_ibs_files(struct super_block * sb, struct dentry * root) | 451 | static 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 | ||
483 | static int op_amd_init(struct oprofile_operations *ops) | 495 | static 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 | ||
488 | static void op_amd_exit(void) | 503 | static void op_amd_exit(void) |
489 | { | 504 | { |
505 | clear_ibs_nmi(); | ||
490 | } | 506 | } |
491 | 507 | ||
492 | struct op_x86_model_spec const op_amd_spec = { | 508 | struct op_x86_model_spec const op_amd_spec = { |