From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965014AbbD0TRp (ORCPT ); Mon, 27 Apr 2015 15:17:45 -0400 Received: from mail04v-smtp02.fnal.gov ([131.225.199.27]:46549 "EHLO ex-smtp.fnal.gov" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932896AbbD0TRn (ORCPT ); Mon, 27 Apr 2015 15:17:43 -0400 X-Greylist: delayed 330 seconds by postgrey-1.27 at vger.kernel.org; Mon, 27 Apr 2015 15:17:42 EDT Message-ID: <553E8A0A.5080505@fnal.gov> Date: Mon, 27 Apr 2015 14:12:10 -0500 From: Ron Rechenmacher Reply-To: User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 MIME-Version: 1.0 To: Steven Rostedt CC: , Mathieu Desnoyers Subject: Re: [PATCH] tracing: Export key trace event symbols References: <553571C3.1060505@fnal.gov> <20150424172426.016da583@gandalf.local.home> In-Reply-To: <20150424172426.016da583@gandalf.local.home> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [131.225.82.234] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Steven Rostedt wrote on 04/24/15 16:24: > On Mon, 20 Apr 2015 16:38:11 -0500 > Ron Rechenmacher wrote: > >> If symbols are not exported, modules can no longer register additional >> (module specified) tracepoints like they use to be able to (i.e linux-3.15.x). >> Somewhere on or about commit de7b2973903c6cc50b31ee5682a69b2219b9919d >> (Author: Mathieu Desnoyers >> Date: Tue Apr 8 17:26:21 2014 -0400 >> tracepoint: Use struct pointer instead of name hash for reg/unreg tracepoints) >> modules which attempted to register additional tracing functions would >> get "Unknown symbol" errors. For example: "... Unknown symbol >> __tracepoint_sched_switch (err 0)" >> Symbols can be exported using the kernel's EXPORT_TRACEPOINT_SYMBOL_GPL macro >> to allow modules to once again register their own tracing functions (for at >> least some key points in the kernel as provided by this patch). >> >> Signed-off-by: Ron Rechenmacher >> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=96051 > > Hi Ron, > > I was talking with Mathieu on IRC and asked him how LTTng gets its > kernel tracepoints, and he told me he uses > for_each_kernel_tracepoint(). That will iterate over all tracepoints > that have been added in the kernel (and is exported GPL). > > You can still use that to get the handle onto any tracepoint you need. > It's pretty straight forward (I just wrote a simple module to test it > out), and just compare against the tp->name, to find what you want. Excellent. Thanks Steve. I was able to get this to work 100% for me. What should be done about the bug report (96051)? Will you handle it or should I change it to "resolved as invalid"? > > I still would like to get more usage out of the internal code, but this > is your work around you wanted. No need to export new symbols. Just a > little more setup time on module load. Do you think for_each_kernel_tracepoint() and, additionally, the tracepoint_probe_register() and tracepoint_probe_unregister() functions will be around for quite some time? I would imagine as long as LTTng uses them. Thanks, Ron > > -- Steve > > Here's my mod.... > > > #include > #include > #include > > static func(struct tracepoint *tp, void *ignore) > { > printk("tracepoint: %s\n", tp->name); > } > > static int __init my_tp_init(void) > { > for_each_kernel_tracepoint(func, NULL); > return 0; > } > > static void __exit my_tp_exit(void) > { > } > > module_init(my_tp_init); > module_exit(my_tp_exit); > > MODULE_AUTHOR("My name here"); > MODULE_DESCRIPTION("Me!"); > MODULE_LICENSE("GPL"); > -- Ron Rechenmacher Engineer Fermi National Accelerator Laboratory Batavia, IL 60510