Was there no response to this or did I just miss it?

- Ben


On Mon, 2008-05-26 at 15:07 -0400, Ben Gamari wrote:
> Hey all,
> 
> I've been trying to use perfmon against the linus's tree on Core 2 and
> have been reasonably successful (besides some initial excepted merge
> conflicts in the sparc64 arch). Unfortunately, with debug output enabled
> on a preemptible kernel, much of the useful information produced by
> perfmon gets drowned out by preemptible kernel warnings because
> smp_processor_id() is called in PFM_DBG, i.e.
> 
>         BUG: using smp_processor_id() in preemptible [00000000] code: 
> packing-benchma/23558
>         caller is pfm_free_context+0x56/0x96
>         Pid: 23558, comm: packing-benchma Not tainted 
> 2.6.26-rc3-00627-g70e62a6-dirty #46
>         
>         Call Trace:
>          [<ffffffff8039570b>] debug_smp_processor_id+0xb7/0xc8
>          [<ffffffff8038a9d2>] pfm_free_context+0x56/0x96
>          [<ffffffff80384a90>] __pfm_close+0x2e8/0x2fd
>          [<ffffffff80384b21>] pfm_close+0x7c/0x81
>          [<ffffffff802930ca>] __fput+0xac/0x170
>          [<ffffffff802931a2>] fput+0x14/0x16
>          [<ffffffff802904ae>] filp_close+0x66/0x71
>          [<ffffffff8023bf2b>] put_files_struct+0x74/0xc8
>          [<ffffffff8023bfc6>] exit_files+0x47/0x50
>          [<ffffffff8023d761>] do_exit+0x26a/0x6ac
>          [<ffffffff8023dc16>] do_group_exit+0x73/0xa0
>          [<ffffffff8023dc55>] sys_exit_group+0x12/0x14
>          [<ffffffff8020b43b>] system_call_after_swapgs+0x7b/0x80
>         
> While I can see the value in having the processor ID in the debug
> output, having it in every PFM_DBG does seem a bit overkill. Regardless,
> in order to shut up these warnings, I simply surrounded the printk in
> preempt_[disable|enable]() (patch attached). Certainly not a great
> solution but it cleaned up debug output considerably. I'm not sure if
> anyone else has run across this case, but it might be worth considering
> fixing, even just for debug code. Thanks for the great framework,
> 
> - Ben
> 
> 
> 
> diff --git a/include/linux/perfmon_kern.h b/include/linux/perfmon_kern.h
> index 52773f1..998be07 100644
> --- a/include/linux/perfmon_kern.h
> +++ b/include/linux/perfmon_kern.h
> @@ -232,9 +232,11 @@ struct pfm_context {
> #define PFM_DBG(f, x...) \
>         do { \
>                 if (unlikely(pfm_controls.debug > 0 && printk_ratelimit())) { 
> \
> +                       preempt_disable(); \
>                         printk("perfmon: %s.%d: CPU%d [%d]: " f "\n", \
>                                __func__, __LINE__, \
>                                smp_processor_id(), current->pid , ## x); \
> +                       preempt_enable(); \
>                 } \
>         } while (0)
> 
> @@ -242,9 +244,11 @@ struct pfm_context {
>         do { \
>                 if (unlikely(pfm_controls.debug_ovfl >0 \
>                              && printk_ratelimit())) { \
> +                       preempt_disable(); \
>                         printk("perfmon: %s.%d: CPU%d [%d]: " f "\n", \
>                                __func__, __LINE__, \
>                                smp_processor_id(), current->pid , ## x); \
> +                       preempt_enable(); \
>                 } \
>         } while (0)
> #else
> 
> 
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> perfmon2-devel mailing list
> perfmon2-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/perfmon2-devel


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
perfmon2-devel mailing list
perfmon2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/perfmon2-devel

Reply via email to