Robert,

I have partially applied this patch. I have rewritten
the PFM_DBG("syscall") to provide more useful information such as argument 
values.

I have dropped the BUG_ON() from the header file.

Thanks.

On Mon, Jul 02, 2007 at 05:58:08PM +0200, Robert Richter wrote:
> Signed-off-by: Robert Richter <[EMAIL PROTECTED]>
> 
> ---
>  include/asm-i386/perfmon.h |    4 ++++
>  perfmon/perfmon_syscalls.c |   30 +++++++++++++++++++++++++++---
>  2 files changed, 31 insertions(+), 3 deletions(-)
> 
> Index: linux-2.6.22-rc4/perfmon/perfmon_syscalls.c
> ===================================================================
> --- linux-2.6.22-rc4.orig/perfmon/perfmon_syscalls.c
> +++ linux-2.6.22-rc4/perfmon/perfmon_syscalls.c
> @@ -417,6 +417,8 @@ asmlinkage long sys_pfm_create_context(s
>       void *fmt_arg = NULL;
>       int ret;
>  
> +     PFM_DBG("syscall");
> +
>       if (perfmon_disabled)
>               return -ENOSYS;
>  
> @@ -447,6 +449,8 @@ asmlinkage long sys_pfm_write_pmcs(int f
>       size_t sz;
>       int ret, fput_needed;
>  
> +     PFM_DBG("syscall");
> +
>       if (count < 0 || count >= PFM_MAX_ARG_COUNT(ureq)) {
>               PFM_DBG("invalid arg count %d", count);
>               return -EINVAL;
> @@ -505,8 +509,12 @@ asmlinkage long sys_pfm_write_pmds(int f
>       size_t sz;
>       int ret, fput_needed;
>  
> -     if (count < 0 || count >= PFM_MAX_ARG_COUNT(ureq))
> +     PFM_DBG("syscall");
> +
> +     if (count < 0 || count >= PFM_MAX_ARG_COUNT(ureq)) {
> +             PFM_DBG("invalid arg count %d", count);
>               return -EINVAL;
> +     }
>  
>       sz = count*sizeof(*ureq);
>  
> @@ -557,6 +565,8 @@ asmlinkage long sys_pfm_read_pmds(int fd
>       size_t sz;
>       int ret, fput_needed;
>  
> +     PFM_DBG("syscall");
> +
>       if (count < 0 || count >= PFM_MAX_ARG_COUNT(ureq))
>               return -EINVAL;
>  
> @@ -605,6 +615,8 @@ asmlinkage long sys_pfm_restart(int fd)
>       unsigned long flags;
>       int ret, fput_needed, complete_needed;
>  
> +     PFM_DBG("syscall");
> +
>       filp = fget_light(fd, &fput_needed);
>       if (unlikely(filp == NULL)) {
>               PFM_DBG("invalid fd %d", fd);
> @@ -661,6 +673,8 @@ asmlinkage long sys_pfm_stop(int fd)
>       unsigned long flags;
>       int ret, fput_needed;
>  
> +     PFM_DBG("syscall");
> +
>       filp = fget_light(fd, &fput_needed);
>       if (unlikely(filp == NULL)) {
>               PFM_DBG("invalid fd %d", fd);
> @@ -696,6 +710,8 @@ asmlinkage long sys_pfm_start(int fd, st
>       unsigned long flags;
>       int ret, fput_needed;
>  
> +     PFM_DBG("syscall");
> +
>       filp = fget_light(fd, &fput_needed);
>       if (unlikely(filp == NULL)) {
>               PFM_DBG("invalid fd %d", fd);
> @@ -738,6 +754,8 @@ asmlinkage long sys_pfm_load_context(int
>       struct pfarg_load req;
>       int ret, fput_needed;
>  
> +     PFM_DBG("syscall");
> +
>       if (copy_from_user(&req, ureq, sizeof(req)))
>               return -EFAULT;
>  
> @@ -806,6 +824,8 @@ asmlinkage long sys_pfm_unload_context(i
>       int is_system, can_release = 0;
>       u32 cpu;
>  
> +     PFM_DBG("syscall");
> +
>       filp = fget_light(fd, &fput_needed);
>       if (unlikely(filp == NULL)) {
>               PFM_DBG("invalid fd %d", fd);
> @@ -848,6 +868,8 @@ asmlinkage long sys_pfm_create_evtsets(i
>       size_t sz;
>       int ret, fput_needed;
>  
> +     PFM_DBG("syscall");
> +
>       if (count < 0 || count >= PFM_MAX_ARG_COUNT(ureq))
>               return -EINVAL;
>  
> @@ -904,6 +926,8 @@ asmlinkage long  sys_pfm_getinfo_evtsets
>       size_t sz;
>       int ret, fput_needed;
>  
> +     PFM_DBG("syscall");
> +
>       if (count < 0 || count >= PFM_MAX_ARG_COUNT(ureq))
>               return -EINVAL;
>  
> @@ -946,8 +970,6 @@ asmlinkage long  sys_pfm_getinfo_evtsets
>       kfree(fptr);
>  error:
>       fput_light(filp, fput_needed);
> -     if (ret)
> -             PFM_DBG("failed: errno=%d", -ret);
>       return ret;
>  }
>  
> @@ -961,6 +983,8 @@ asmlinkage long sys_pfm_delete_evtsets(i
>       size_t sz;
>       int ret, fput_needed;
>  
> +     PFM_DBG("syscall");
> +
>       if (count < 0 || count >= PFM_MAX_ARG_COUNT(ureq))
>               return -EINVAL;
>  
> Index: linux-2.6.22-rc4/include/asm-i386/perfmon.h
> ===================================================================
> --- linux-2.6.22-rc4.orig/include/asm-i386/perfmon.h
> +++ linux-2.6.22-rc4/include/asm-i386/perfmon.h
> @@ -150,6 +150,7 @@ static inline void pfm_arch_write_pmc(st
>       PFM_DBG_ovfl("pfm_arch_write_pmc(0x%016Lx, 0x%016Lx)",
>                    (unsigned long long) pfm_pmu_conf->pmc_desc[cnum].hw_addr,
>                    (unsigned long long) value);
> +     BUG_ON(pfm_pmu_conf->pmc_desc[cnum].type & PFM_REG_V);
>       if (arch_info->pmu_style == PFM_X86_PMU_P4)
>               __pfm_write_reg_p4(&arch_info->pmc_addrs[cnum], value);
>       else
> @@ -168,6 +169,7 @@ static inline void pfm_arch_write_pmd(st
>       PFM_DBG_ovfl("pfm_arch_write_pmd(0x%016Lx, 0x%016Lx)",
>                    (unsigned long long) pfm_pmu_conf->pmd_desc[cnum].hw_addr,
>                    (unsigned long long) value);
> +     BUG_ON(pfm_pmu_conf->pmd_desc[cnum].type & PFM_REG_V);
>       if (arch_info->pmu_style == PFM_X86_PMU_P4)
>               __pfm_write_reg_p4(&arch_info->pmd_addrs[cnum], value);
>       else
> @@ -178,6 +180,7 @@ static inline u64 pfm_arch_read_pmd(stru
>  {
>       struct pfm_arch_pmu_info *arch_info = pfm_pmu_conf->arch_info;
>       u64 tmp;
> +     BUG_ON(pfm_pmu_conf->pmd_desc[cnum].type & PFM_REG_V);
>       if (arch_info->pmu_style == PFM_X86_PMU_P4)
>               __pfm_read_reg_p4(&arch_info->pmd_addrs[cnum], &tmp);
>       else
> @@ -192,6 +195,7 @@ static inline u64 pfm_arch_read_pmc(stru
>  {
>       struct pfm_arch_pmu_info *arch_info = pfm_pmu_conf->arch_info;
>       u64 tmp;
> +     BUG_ON(pfm_pmu_conf->pmc_desc[cnum].type & PFM_REG_V);
>       if (arch_info->pmu_style == PFM_X86_PMU_P4)
>               __pfm_read_reg_p4(&arch_info->pmc_addrs[cnum], &tmp);
>       else
> 
> -- 
> AMD Saxony, Dresden, Germany
> Operating System Research Center
> email: [EMAIL PROTECTED]
> 
> 
> 
> _______________________________________________
> perfmon mailing list
> [email protected]
> http://www.hpl.hp.com/hosted/linux/mail-archives/perfmon/

-- 

-Stephane
_______________________________________________
perfmon mailing list
[email protected]
http://www.hpl.hp.com/hosted/linux/mail-archives/perfmon/

Reply via email to