[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1216753748-11261-18-git-send-email-robert.richter@amd.com>
Date: Tue, 22 Jul 2008 21:09:01 +0200
From: Robert Richter <robert.richter@....com>
To: Barry Kasindorf <barry.kasindorf@....com>,
Ingo Molnar <mingo@...e.hu>
CC: Thomas Gleixner <tglx@...utronix.de>,
oprofile-list <oprofile-list@...ts.sourceforge.net>,
LKML <linux-kernel@...r.kernel.org>,
Robert Richter <robert.richter@....com>
Subject: [PATCH 17/24] OProfile: Enable IBS for AMD CPUs
Signed-off-by: Robert Richter <robert.richter@....com>
---
arch/x86/oprofile/nmi_int.c | 14 ++++++++------
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 4e42b50..f46d8fc 100644
--- a/arch/x86/oprofile/nmi_int.c
+++ b/arch/x86/oprofile/nmi_int.c
@@ -454,6 +454,14 @@ int __init op_nmi_init(struct oprofile_operations *ops)
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)
ret = model->init(ops);
if (ret)
@@ -461,12 +469,6 @@ int __init op_nmi_init(struct oprofile_operations *ops)
init_sysfs();
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");
return 0;
}
diff --git a/arch/x86/oprofile/op_model_athlon.c b/arch/x86/oprofile/op_model_athlon.c
index 2650b12..0d83903 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)
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)
{
char buf[12];
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)
- return 0;
+ return ret;
+
+ /* model specific files */
/* setup some reasonable defaults */
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)
{
+ setup_ibs();
+ create_arch_files = ops->create_files;
+ ops->create_files = setup_ibs_files;
return 0;
}
static void op_amd_exit(void)
{
+ clear_ibs_nmi();
}
struct op_x86_model_spec const op_amd_spec = {
--
1.5.5.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists