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>
This commit is contained in:
Robert Richter 2008-07-22 21:09:01 +02:00 committed by Ingo Molnar
parent fc2bd7345b
commit 270d3e1a10
2 changed files with 25 additions and 7 deletions

View File

@ -468,6 +468,14 @@ int __init op_nmi_init(struct oprofile_operations *ops)
return -ENODEV; return -ENODEV;
} }
/* default values, can be overwritten by model */
ops->create_files = nmi_create_files;
ops->setup = nmi_setup;
ops->shutdown = nmi_shutdown;
ops->start = nmi_start;
ops->stop = nmi_stop;
ops->cpu_type = cpu_type;
if (model->init) if (model->init)
ret = model->init(ops); ret = model->init(ops);
if (ret) if (ret)
@ -475,12 +483,6 @@ int __init op_nmi_init(struct oprofile_operations *ops)
init_sysfs(); init_sysfs();
using_nmi = 1; using_nmi = 1;
ops->create_files = nmi_create_files;
ops->setup = nmi_setup;
ops->shutdown = nmi_shutdown;
ops->start = nmi_start;
ops->stop = nmi_stop;
ops->cpu_type = cpu_type;
printk(KERN_INFO "oprofile: using NMI interrupt.\n"); printk(KERN_INFO "oprofile: using NMI interrupt.\n");
return 0; return 0;
} }

View File

@ -446,13 +446,25 @@ static void clear_ibs_nmi(void)
on_each_cpu(apic_clear_ibs_nmi_per_cpu, NULL, 1); on_each_cpu(apic_clear_ibs_nmi_per_cpu, NULL, 1);
} }
static int (*create_arch_files)(struct super_block * sb, struct dentry * root);
static int setup_ibs_files(struct super_block * sb, struct dentry * root) static int setup_ibs_files(struct super_block * sb, struct dentry * root)
{ {
char buf[12]; char buf[12];
struct dentry *dir; struct dentry *dir;
int ret = 0;
/* architecture specific files */
if (create_arch_files)
ret = create_arch_files(sb, root);
if (ret)
return ret;
if (!ibs_allowed) if (!ibs_allowed)
return 0; return ret;
/* model specific files */
/* setup some reasonable defaults */ /* setup some reasonable defaults */
ibs_config.max_cnt_fetch = 250000; ibs_config.max_cnt_fetch = 250000;
@ -482,11 +494,15 @@ static int setup_ibs_files(struct super_block * sb, struct dentry * root)
static int op_amd_init(struct oprofile_operations *ops) static int op_amd_init(struct oprofile_operations *ops)
{ {
setup_ibs();
create_arch_files = ops->create_files;
ops->create_files = setup_ibs_files;
return 0; return 0;
} }
static void op_amd_exit(void) static void op_amd_exit(void)
{ {
clear_ibs_nmi();
} }
struct op_x86_model_spec const op_amd_spec = { struct op_x86_model_spec const op_amd_spec = {