Hi Stephane,I have been looking through the perfmon2 code to see how it is going to work with OProfile. It looks like the ia64 oprofile support has not been modified to work with the changes in perfmon2. Has the ia64 kernel been built with perfmon2 and oprofile support? I don't have easy access to an ia64, so I haven't been able to verify that the attached patch works. However, I expect that the changes in the patch will be required for OProfile to function with perfmon2.
-Will
--- linux-2.6.16-rc5-perfop/arch/ia64/oprofile/perfmon.c.ia64chg 2006-03-13 10:56:30.000000000 -0500 +++ linux-2.6.16-rc5-perfop/arch/ia64/oprofile/perfmon.c 2006-03-13 12:31:48.000000000 -0500 @@ -8,22 +8,27 @@ */ #include <linux/kernel.h> +#include <linux/module.h> #include <linux/config.h> #include <linux/oprofile.h> #include <linux/sched.h> -#include <asm/perfmon.h> +#include <linux/perfmon.h> #include <asm/ptrace.h> #include <asm/errno.h> static int allow_ints; static int -perfmon_handler(struct task_struct *task, void *buf, pfm_ovfl_arg_t *arg, - struct pt_regs *regs, unsigned long stamp) +perfmon_handler(void *buf, struct pfm_ovfl_arg *arg, + unsigned long ip, u64 stamp, void *data) { int event = arg->pmd_eventid; - arg->ovfl_ctrl.bits.reset_ovfl_pmds = 1; + /* FIXME: oprofile_add_sample expect to have + struct pt_regs * const regs */ + struct pt_regs * const regs = (struct pt_regs *) data; + + arg->ovfl_ctrl = PFM_OVFL_CTRL_RESET; /* the owner of the oprofile event buffer may have exited * without perfmon being shutdown (e.g. SIGSEGV) @@ -54,6 +59,7 @@ .fmt_name = "oprofile_format", .fmt_uuid = OPROFILE_FMT_UUID, .fmt_handler = perfmon_handler, + .owner = THIS_MODULE, }; @@ -76,9 +82,9 @@ static int using_perfmon; -int perfmon_init(struct oprofile_operations * ops) +int __init op_perfmon_init(struct oprofile_operations * ops) { - int ret = pfm_register_buffer_fmt(&oprofile_fmt); + int ret = pfm_register_smpl_fmt(&oprofile_fmt); if (ret) return -ENODEV; @@ -91,10 +97,10 @@ } -void perfmon_exit(void) +void __exit op_perfmon_exit(void) { if (!using_perfmon) return; - pfm_unregister_buffer_fmt(oprofile_fmt.fmt_uuid); + pfm_unregister_smpl_fmt(oprofile_fmt.fmt_uuid); } --- linux-2.6.16-rc5-perfop/arch/ia64/oprofile/init.c.ia64chg 2006-03-13 11:02:19.000000000 -0500 +++ linux-2.6.16-rc5-perfop/arch/ia64/oprofile/init.c 2006-03-13 11:03:09.000000000 -0500 @@ -12,8 +12,8 @@ #include <linux/init.h> #include <linux/errno.h> -extern int perfmon_init(struct oprofile_operations * ops); -extern void perfmon_exit(void); +extern int op_perfmon_init(struct oprofile_operations * ops); +extern void op_perfmon_exit(void); extern void ia64_backtrace(struct pt_regs * const regs, unsigned int depth); int __init oprofile_arch_init(struct oprofile_operations * ops) @@ -22,7 +22,7 @@ #ifdef CONFIG_PERFMON /* perfmon_init() can fail, but we have no way to report it */ - ret = perfmon_init(ops); + ret = op_perfmon_init(ops); #endif ops->backtrace = ia64_backtrace; @@ -33,6 +33,6 @@ void oprofile_arch_exit(void) { #ifdef CONFIG_PERFMON - perfmon_exit(); + op_perfmon_exit(); #endif }
![]() |