Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 117114
b: refs/heads/master
c: 818273a
h: refs/heads/master
v: v3
  • Loading branch information
Robert Richter committed Oct 16, 2008
1 parent ce1fa02 commit 3c386ca
Show file tree
Hide file tree
Showing 29 changed files with 331 additions and 319 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9b1f261166f56d4b2c33fdf5aad64edd5e30b46f
refs/heads/master: 818273ae46bd84251b4b8ea7ed3621e67c69d267
2 changes: 1 addition & 1 deletion trunk/arch/alpha/oprofile/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ op_axp_stop(void)
}

static int
op_axp_create_files(struct super_block *sb, struct dentry *root)
op_axp_create_files(struct super_block * sb, struct dentry * root)
{
int i;

Expand Down
4 changes: 2 additions & 2 deletions trunk/arch/ia64/oprofile/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
#include <linux/init.h>
#include <linux/errno.h>

extern int perfmon_init(struct oprofile_operations *ops);
extern int perfmon_init(struct oprofile_operations * ops);
extern void perfmon_exit(void);
extern void ia64_backtrace(struct pt_regs * const regs, unsigned int depth);

int __init oprofile_arch_init(struct oprofile_operations *ops)
int __init oprofile_arch_init(struct oprofile_operations * ops)
{
int ret = -ENODEV;

Expand Down
4 changes: 2 additions & 2 deletions trunk/arch/ia64/oprofile/perfmon.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ static pfm_buffer_fmt_t oprofile_fmt = {
};


static char *get_cpu_type(void)
static char * get_cpu_type(void)
{
__u8 family = local_cpu_data->family;

Expand All @@ -75,7 +75,7 @@ static char *get_cpu_type(void)

static int using_perfmon;

int perfmon_init(struct oprofile_operations *ops)
int perfmon_init(struct oprofile_operations * ops)
{
int ret = pfm_register_buffer_fmt(&oprofile_fmt);
if (ret)
Expand Down
2 changes: 1 addition & 1 deletion trunk/arch/m32r/oprofile/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include <linux/errno.h>
#include <linux/init.h>

int __init oprofile_arch_init(struct oprofile_operations *ops)
int __init oprofile_arch_init(struct oprofile_operations * ops)
{
return -ENODEV;
}
Expand Down
2 changes: 1 addition & 1 deletion trunk/arch/mips/oprofile/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ static int op_mips_setup(void)
return 0;
}

static int op_mips_create_files(struct super_block *sb, struct dentry *root)
static int op_mips_create_files(struct super_block * sb, struct dentry * root)
{
int i;

Expand Down
2 changes: 1 addition & 1 deletion trunk/arch/mips/oprofile/op_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ struct op_counter_config {
/* Per-architecture configury and hooks. */
struct op_mips_model {
void (*reg_setup) (struct op_counter_config *);
void (*cpu_setup) (void *dummy);
void (*cpu_setup) (void * dummy);
int (*init)(void);
void (*exit)(void);
void (*cpu_start)(void *args);
Expand Down
2 changes: 1 addition & 1 deletion trunk/arch/mips/oprofile/op_model_rm9000.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ static void rm9000_cpu_stop(void *args)
write_c0_perfcontrol(0);
}

static irqreturn_t rm9000_perfcount_handler(int irq, void *dev_id)
static irqreturn_t rm9000_perfcount_handler(int irq, void * dev_id)
{
unsigned int control = read_c0_perfcontrol();
struct pt_regs *regs = get_irq_regs();
Expand Down
2 changes: 1 addition & 1 deletion trunk/arch/parisc/oprofile/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include <linux/kernel.h>
#include <linux/oprofile.h>

int __init oprofile_arch_init(struct oprofile_operations *ops)
int __init oprofile_arch_init(struct oprofile_operations * ops)
{
return -ENODEV;
}
Expand Down
2 changes: 1 addition & 1 deletion trunk/arch/powerpc/oprofile/op_model_cell.c
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ set_count_mode(u32 kernel, u32 user)
}
}

static inline void enable_ctr(u32 cpu, u32 ctr, u32 *pm07_cntrl)
static inline void enable_ctr(u32 cpu, u32 ctr, u32 * pm07_cntrl)
{

pm07_cntrl[ctr] |= CBE_PM_CTR_ENABLE;
Expand Down
2 changes: 1 addition & 1 deletion trunk/arch/sparc/oprofile/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include <linux/errno.h>
#include <linux/init.h>

int __init oprofile_arch_init(struct oprofile_operations *ops)
int __init oprofile_arch_init(struct oprofile_operations * ops)
{
return -ENODEV;
}
Expand Down
2 changes: 1 addition & 1 deletion trunk/arch/sparc64/oprofile/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include <linux/errno.h>
#include <linux/init.h>

int __init oprofile_arch_init(struct oprofile_operations *ops)
int __init oprofile_arch_init(struct oprofile_operations * ops)
{
return -ENODEV;
}
Expand Down
147 changes: 76 additions & 71 deletions trunk/arch/x86/oprofile/nmi_int.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,85 @@ static struct op_x86_model_spec const *model;
static DEFINE_PER_CPU(struct op_msrs, cpu_msrs);
static DEFINE_PER_CPU(unsigned long, saved_lvtpc);

static int nmi_start(void);
static void nmi_stop(void);
static void nmi_cpu_start(void *dummy);
static void nmi_cpu_stop(void *dummy);

/* 0 == registered but off, 1 == registered and on */
static int nmi_enabled = 0;

#ifdef CONFIG_SMP
static int oprofile_cpu_notifier(struct notifier_block *b, unsigned long action,
void *data)
{
int cpu = (unsigned long)data;
switch (action) {
case CPU_DOWN_FAILED:
case CPU_ONLINE:
smp_call_function_single(cpu, nmi_cpu_start, NULL, 0);
break;
case CPU_DOWN_PREPARE:
smp_call_function_single(cpu, nmi_cpu_stop, NULL, 1);
break;
}
return NOTIFY_DONE;
}

static struct notifier_block oprofile_cpu_nb = {
.notifier_call = oprofile_cpu_notifier
};
#endif

#ifdef CONFIG_PM

static int nmi_suspend(struct sys_device *dev, pm_message_t state)
{
/* Only one CPU left, just stop that one */
if (nmi_enabled == 1)
nmi_cpu_stop(NULL);
return 0;
}

static int nmi_resume(struct sys_device *dev)
{
if (nmi_enabled == 1)
nmi_cpu_start(NULL);
return 0;
}

static struct sysdev_class oprofile_sysclass = {
.name = "oprofile",
.resume = nmi_resume,
.suspend = nmi_suspend,
};

static struct sys_device device_oprofile = {
.id = 0,
.cls = &oprofile_sysclass,
};

static int __init init_sysfs(void)
{
int error;

error = sysdev_class_register(&oprofile_sysclass);
if (!error)
error = sysdev_register(&device_oprofile);
return error;
}

static void exit_sysfs(void)
{
sysdev_unregister(&device_oprofile);
sysdev_class_unregister(&oprofile_sysclass);
}

#else
#define init_sysfs() do { } while (0)
#define exit_sysfs() do { } while (0)
#endif /* CONFIG_PM */

static int profile_exceptions_notify(struct notifier_block *self,
unsigned long val, void *data)
{
Expand Down Expand Up @@ -285,77 +361,6 @@ static int nmi_create_files(struct super_block *sb, struct dentry *root)
return 0;
}

#ifdef CONFIG_SMP
static int oprofile_cpu_notifier(struct notifier_block *b, unsigned long action,
void *data)
{
int cpu = (unsigned long)data;
switch (action) {
case CPU_DOWN_FAILED:
case CPU_ONLINE:
smp_call_function_single(cpu, nmi_cpu_start, NULL, 0);
break;
case CPU_DOWN_PREPARE:
smp_call_function_single(cpu, nmi_cpu_stop, NULL, 1);
break;
}
return NOTIFY_DONE;
}

static struct notifier_block oprofile_cpu_nb = {
.notifier_call = oprofile_cpu_notifier
};
#endif

#ifdef CONFIG_PM

static int nmi_suspend(struct sys_device *dev, pm_message_t state)
{
/* Only one CPU left, just stop that one */
if (nmi_enabled == 1)
nmi_cpu_stop(NULL);
return 0;
}

static int nmi_resume(struct sys_device *dev)
{
if (nmi_enabled == 1)
nmi_cpu_start(NULL);
return 0;
}

static struct sysdev_class oprofile_sysclass = {
.name = "oprofile",
.resume = nmi_resume,
.suspend = nmi_suspend,
};

static struct sys_device device_oprofile = {
.id = 0,
.cls = &oprofile_sysclass,
};

static int __init init_sysfs(void)
{
int error;

error = sysdev_class_register(&oprofile_sysclass);
if (!error)
error = sysdev_register(&device_oprofile);
return error;
}

static void exit_sysfs(void)
{
sysdev_unregister(&device_oprofile);
sysdev_class_unregister(&oprofile_sysclass);
}

#else
#define init_sysfs() do { } while (0)
#define exit_sysfs() do { } while (0)
#endif /* CONFIG_PM */

static int p4force;
module_param(p4force, int, 0);

Expand Down
55 changes: 26 additions & 29 deletions trunk/arch/x86/oprofile/op_model_amd.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,8 @@ static unsigned long reset_value[NUM_COUNTERS];

/* The function interface needs to be fixed, something like add
data. Should then be added to linux/oprofile.h. */
extern void
oprofile_add_ibs_sample(struct pt_regs *const regs,
unsigned int *const ibs_sample, int ibs_code);
extern void oprofile_add_ibs_sample(struct pt_regs *const regs,
unsigned int * const ibs_sample, u8 code);

struct ibs_fetch_sample {
/* MSRC001_1031 IBS Fetch Linear Address Register */
Expand Down Expand Up @@ -310,15 +309,12 @@ static void op_amd_start(struct op_msrs const * const msrs)
#ifdef CONFIG_OPROFILE_IBS
if (ibs_allowed && ibs_config.fetch_enabled) {
low = (ibs_config.max_cnt_fetch >> 4) & 0xFFFF;
high = ((ibs_config.rand_en & 0x1) << 25) /* bit 57 */
+ IBS_FETCH_HIGH_ENABLE;
high = IBS_FETCH_HIGH_ENABLE;
wrmsr(MSR_AMD64_IBSFETCHCTL, low, high);
}

if (ibs_allowed && ibs_config.op_enabled) {
low = ((ibs_config.max_cnt_op >> 4) & 0xFFFF)
+ ((ibs_config.dispatched_ops & 0x1) << 19) /* bit 19 */
+ IBS_OP_LOW_ENABLE;
low = ((ibs_config.max_cnt_op >> 4) & 0xFFFF) + IBS_OP_LOW_ENABLE;
high = 0;
wrmsr(MSR_AMD64_IBSOPCTL, low, high);
}
Expand Down Expand Up @@ -476,6 +472,7 @@ 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;

Expand All @@ -497,22 +494,22 @@ static int setup_ibs_files(struct super_block *sb, struct dentry *root)
ibs_config.max_cnt_op = 250000;
ibs_config.op_enabled = 0;
ibs_config.dispatched_ops = 1;

dir = oprofilefs_mkdir(sb, root, "ibs_fetch");
oprofilefs_create_ulong(sb, dir, "enable",
&ibs_config.fetch_enabled);
oprofilefs_create_ulong(sb, dir, "max_count",
&ibs_config.max_cnt_fetch);
snprintf(buf, sizeof(buf), "ibs_fetch");
dir = oprofilefs_mkdir(sb, root, buf);
oprofilefs_create_ulong(sb, dir, "rand_enable",
&ibs_config.rand_en);

dir = oprofilefs_mkdir(sb, root, "ibs_op");
oprofilefs_create_ulong(sb, dir, "enable",
&ibs_config.op_enabled);
&ibs_config.fetch_enabled);
oprofilefs_create_ulong(sb, dir, "max_count",
&ibs_config.max_cnt_fetch);
snprintf(buf, sizeof(buf), "ibs_uops");
dir = oprofilefs_mkdir(sb, root, buf);
oprofilefs_create_ulong(sb, dir, "enable",
&ibs_config.op_enabled);
oprofilefs_create_ulong(sb, dir, "max_count",
&ibs_config.max_cnt_op);
&ibs_config.max_cnt_op);
oprofilefs_create_ulong(sb, dir, "dispatched_ops",
&ibs_config.dispatched_ops);
&ibs_config.dispatched_ops);

return 0;
}
Expand All @@ -533,14 +530,14 @@ static void op_amd_exit(void)
#endif

struct op_x86_model_spec const op_amd_spec = {
.init = op_amd_init,
.exit = op_amd_exit,
.num_counters = NUM_COUNTERS,
.num_controls = NUM_CONTROLS,
.fill_in_addresses = &op_amd_fill_in_addresses,
.setup_ctrs = &op_amd_setup_ctrs,
.check_ctrs = &op_amd_check_ctrs,
.start = &op_amd_start,
.stop = &op_amd_stop,
.shutdown = &op_amd_shutdown
.init = op_amd_init,
.exit = op_amd_exit,
.num_counters = NUM_COUNTERS,
.num_controls = NUM_CONTROLS,
.fill_in_addresses = &op_amd_fill_in_addresses,
.setup_ctrs = &op_amd_setup_ctrs,
.check_ctrs = &op_amd_check_ctrs,
.start = &op_amd_start,
.stop = &op_amd_stop,
.shutdown = &op_amd_shutdown
};
Loading

0 comments on commit 3c386ca

Please sign in to comment.