Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1763097Ab3DCSjN (ORCPT ); Wed, 3 Apr 2013 14:39:13 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38013 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1763060Ab3DCSjL (ORCPT ); Wed, 3 Apr 2013 14:39:11 -0400 Message-ID: <515C7720.2020503@redhat.com> Date: Wed, 03 Apr 2013 11:38:24 -0700 From: Josh Stone User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130311 Thunderbird/17.0.4 MIME-Version: 1.0 To: "Frank Ch. Eigler" CC: Frederic Weisbecker , Mel Gorman , Ingo Molnar , LKML , SystemTap Subject: Re: systemtap broken by removal of register_timer_hook References: <20130403075017.GA2534@suse.de> <20130403144428.GA15432@redhat.com> In-Reply-To: <20130403144428.GA15432@redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3172 Lines: 106 On 04/03/2013 07:44 AM, Frank Ch. Eigler wrote: > Hi - > > On Wed, Apr 03, 2013 at 02:49:53PM +0200, Frederic Weisbecker wrote: > >> Sounds good, would you like to propose a version? We are also >> interested in a timer tick event tracepoint for dynticks debugging. > > How about this? > > Author: Frank Ch. Eigler > Date: Wed Apr 3 10:35:21 2013 -0400 > > profiling: add profile_tick tracepoint > > Commit ba6fdda4 removed the timer_hook mechanism for modules to listen > to profiling timer ticks (without having to set up more complicated > perf mechanisms). To reduce the impact on out-of-tree users, a > TRACE_EVENT-flavoured tracepoint is added in its place. Tested with > perf and systemtap. One nice benefit over register_timer_hook() is that a tracepoint allows multiple consumers, like the old register_profile_notifier() did. > > Cc: Frederic Weisbecker > Cc: Ingo Molnar > Cc: Mel Gorman > Signed-off-by: Frank Ch. Eigler > > diff --git a/include/trace/events/profile.h b/include/trace/events/profile.h > new file mode 100644 > index 0000000..b48b6fe > --- /dev/null > +++ b/include/trace/events/profile.h > @@ -0,0 +1,35 @@ > +#undef TRACE_SYSTEM > +#define TRACE_SYSTEM profile > + > +#if !defined(_TRACE_PROFILE_H) || defined(TRACE_HEADER_MULTI_READ) > +#define _TRACE_PROFILE_H > + > +#include > + > + > +struct pt_regs; > + > +/** > + * profile_tick - called when the profiling timer ticks > + * @regs: pointer to struct pt_regs* > + */ > + > +TRACE_EVENT(profile_tick, > + TP_PROTO(int type, struct pt_regs *regs), > + TP_ARGS(type, regs), > + TP_STRUCT__entry( > + __field( int, type ) > + __field( struct pt_regs*, regs ) > + ), > + TP_fast_assign( > + __entry->type = type; > + __entry->regs = regs; > + ), > + TP_printk("type=%d regs=%p", __entry->type, __entry->regs) > +); I agree that full regs are good for the tracepoint in general, but I doubt that this pointer is useful for the printk. Maybe instead print instruction_pointer(__entry->regs)? > + > + > +#endif /* _TRACE_PROFILE_H */ > + > +/* This part must be outside protection */ > +#include > diff --git a/kernel/profile.c b/kernel/profile.c > index dc3384e..d61f921 100644 > --- a/kernel/profile.c > +++ b/kernel/profile.c > @@ -29,6 +29,9 @@ > #include > #include > > +#define CREATE_TRACE_POINTS > +#include > + > struct profile_hit { > u32 pc, hits; > }; > @@ -414,6 +417,8 @@ void profile_tick(int type) > { > struct pt_regs *regs = get_irq_regs(); > > + trace_profile_tick(type, regs); > + > if (!user_mode(regs) && prof_cpu_mask != NULL && > cpumask_test_cpu(smp_processor_id(), prof_cpu_mask)) > profile_hit(type, (void *)profile_pc(regs)); > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/