Skip to content

Commit

Permalink
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel…
Browse files Browse the repository at this point in the history
…/git/rric/oprofile

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rric/oprofile: (21 commits)
  OProfile: Fix buffer synchronization for IBS
  oprofile: hotplug cpu fix
  oprofile: fixing whitespaces in arch/x86/oprofile/*
  oprofile: fixing whitespaces in arch/x86/oprofile/*
  oprofile: fixing whitespaces in drivers/oprofile/*
  x86/oprofile: add the logic for enabling additional IBS bits
  x86/oprofile: reordering functions in nmi_int.c
  x86/oprofile: removing unused function parameter in add_ibs_begin()
  oprofile: more whitespace fixes
  oprofile: whitespace fixes
  OProfile: Rename IBS sysfs dir into "ibs_op"
  OProfile: Rework string handling in setup_ibs_files()
  OProfile: Rework oprofile_add_ibs_sample() function
  oprofile: discover counters for op ppro too
  oprofile: Implement Intel architectural perfmon support
  oprofile: Don't report Nehalem as core_2
  oprofile: drop const in num counters field
  Revert "Oprofile Multiplexing Patch"
  x86, oprofile: BUG: using smp_processor_id() in preemptible code
  x86/oprofile: fix on_each_cpu build error
  ...

Manually fixed trivial conflicts in
	drivers/oprofile/{cpu_buffer.c,event_buffer.h}
  • Loading branch information
Linus Torvalds committed Oct 23, 2008
2 parents a534487 + df13b31 commit 92fb83a
Show file tree
Hide file tree
Showing 31 changed files with 431 additions and 371 deletions.
2 changes: 1 addition & 1 deletion 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 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 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 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 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 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 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 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 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 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 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
3 changes: 1 addition & 2 deletions arch/x86/oprofile/backtrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ struct frame_head {
unsigned long ret;
} __attribute__((packed));

static struct frame_head *
dump_user_backtrace(struct frame_head * head)
static struct frame_head *dump_user_backtrace(struct frame_head *head)
{
struct frame_head bufhead[2];

Expand Down
173 changes: 88 additions & 85 deletions arch/x86/oprofile/nmi_int.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,85 +28,9 @@ 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 @@ -361,6 +285,77 @@ 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 Expand Up @@ -420,9 +415,6 @@ static int __init ppro_init(char **cpu_type)
case 15: case 23:
*cpu_type = "i386/core_2";
break;
case 26:
*cpu_type = "i386/core_2";
break;
default:
/* Unknown */
return 0;
Expand All @@ -432,14 +424,24 @@ static int __init ppro_init(char **cpu_type)
return 1;
}

static int __init arch_perfmon_init(char **cpu_type)
{
if (!cpu_has_arch_perfmon)
return 0;
*cpu_type = "i386/arch_perfmon";
model = &op_arch_perfmon_spec;
arch_perfmon_setup_counters();
return 1;
}

/* in order to get sysfs right */
static int using_nmi;

int __init op_nmi_init(struct oprofile_operations *ops)
{
__u8 vendor = boot_cpu_data.x86_vendor;
__u8 family = boot_cpu_data.x86;
char *cpu_type;
char *cpu_type = NULL;
int ret = 0;

if (!cpu_has_apic)
Expand Down Expand Up @@ -477,19 +479,20 @@ int __init op_nmi_init(struct oprofile_operations *ops)
switch (family) {
/* Pentium IV */
case 0xf:
if (!p4_init(&cpu_type))
return -ENODEV;
p4_init(&cpu_type);
break;

/* A P6-class processor */
case 6:
if (!ppro_init(&cpu_type))
return -ENODEV;
ppro_init(&cpu_type);
break;

default:
return -ENODEV;
break;
}

if (!cpu_type && !arch_perfmon_init(&cpu_type))
return -ENODEV;
break;

default:
Expand Down
18 changes: 9 additions & 9 deletions arch/x86/oprofile/op_counter.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@
*
* @author John Levon
*/

#ifndef OP_COUNTER_H
#define OP_COUNTER_H

#define OP_MAX_COUNTER 8

/* Per-perfctr configuration as set via
* oprofilefs.
*/
struct op_counter_config {
unsigned long count;
unsigned long enabled;
unsigned long event;
unsigned long kernel;
unsigned long user;
unsigned long unit_mask;
unsigned long count;
unsigned long enabled;
unsigned long event;
unsigned long kernel;
unsigned long user;
unsigned long unit_mask;
};

extern struct op_counter_config counter_config[];
Expand Down
Loading

0 comments on commit 92fb83a

Please sign in to comment.