[lttng-dev] custom probe for loadable device driver - no output?

Julien Desfossez jdesfossez at efficios.com
Wed Aug 5 15:46:19 EDT 2015


Oh, that's right, we have a wrapper in lttng-modules to do the trick of
enabling the tracepoint in signed kernels even if the module is not signed.
See wrapper_lttng_fixup_sig in wrapper/tracepoint.h, it might help.

Julien

On 15-08-05 03:13 PM, Joe VanAndel wrote:
> Sorry, I’m answering my own question:
> 
> When I built a new kernel with “CONFIG_MODULE_SIG” disabled, the probes
> in my loadable driver started working.
> 
> It would be helpful to have this documented in the tutorial on kernel
> tracing.
> 
> On Tue, Aug 4, 2015 at 3:46 PM, Joe VanAndel <vanandel at ucar.edu
> <mailto:vanandel at ucar.edu>> wrote:
> 
>     I’m trying to add LTTng probes to a driver module, but I don’t get
>     any output from my probe in the LTTng session.
> 
> 
>     Any idea what else I need to configure to get the output from my probe?
> 
> 
>     Kernel: 3.10.0
> 
>     OS:  Centos 7.1.1503
> 
>     LTTng tools : from EfficiOS-RHEL7-x86-64 repository
> 
>     lttng-modules:  2.6.2
> 
> 
>     The running kernel has the following enabled:
> 
>     CONFIG_MODULES
> 
>     CONFIG_KALLSYMS
> 
>     CONFIG_HIGH_RES_TIMERS
> 
>     CONFIG_TRACEPOINTS
> 
> 
>     I’ve defined/used tracepoints in my driver with the mainline
>     TRACE_EVENT() macros.  My tracepoints are on the open/close entry
>     points of the device.
> 
> 
>     I’ve added the LTTng adaptation layer for my probe in LTTng-modules. 
> 
> 
>     I’ve started the daemon to load my custom probe
> 
>      lttng-sessiond -d --extra-kmod-probes=db2k
> 
> 
>     I’ve verified that my event is available, by running
> 
> 
>     lttng list --kernel | grep db2k
> 
>           db2k_hello (loglevel: TRACE_EMERG (0)) (type: tracepoint)
> 
> 
>     There’s an entry for my probe in 
> 
>     /sys/kernel/debug/tracing/events/db2k/db2k_hello
> 
> 
>     When I run the following as root:
> 
>     lttng create trace_db2k
> 
>     lttng enable-event --kernel --tracepoint db2k_hello --tracepoint
>     kmem_kmalloc --tracepoint kmem_kfree \
> 
>          --tracepoint timer_start --tracepoint timer_cancel
> 
>     lttng start
> 
>     ———————
> 
>     the output is:
> 
>     Session trace_db2k created.
> 
>     Traces will be written in /root/lttng-traces/trace_db2k-20150804-193318
> 
>     Kernel event db2k_hello created in channel channel0
> 
>     Tracing started for session trace_db2k
> 
>     ===========
> 
>      I run a test program that uses the driver, and then stop the session.
> 
>     # lttng stop
> 
>     Waiting for data availability.
> 
>     Tracing stopped for session trace_db2k
> 
>     # lttng view
> 
>     Trace directory: /root/lttng-traces/trace_db2k-20150804-193318
> 
>     <No output>
> 
> 
>     Here is the “mainline” db2k.h
> 
>     http://pastebin.com/0i8eWF1a
> 
> 
>     Here is the 
> 
>     LTTng adaptation db2k.h
> 
>     http://pastebin.com/fXW9ppqM
> 
> 
>     Here is the 
> 
>     lttng-probe-db2k.c
> 
>     http://pastebin.com/WHuWKpPZ
> 
> 
>     The drive contains the lines:
> 
>     #define CREATE_TRACE_POINTS
> 
>     #include "trace/events/db2k.h"
> 
> 
>     static int
>     db2k_open(struct inode *inode, struct file *file)
>     {
>         int minor = MINOR(inode->i_rdev);
>         int stat = 0;
>         DEVICE_EXTENSION *pde = NULL;
>         dbg("db2k_open called");
>         trace_db2k_hello(minor, "open");
>     .
>     .
>     }
> 
>     -- 
>     Joe VanAndel
>     NCAR/EOL
> 
> 
> 
> 
> -- 
> Joe VanAndel
> NCAR/EOL
> 
> 
> _______________________________________________
> lttng-dev mailing list
> lttng-dev at lists.lttng.org
> http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
> 



More information about the lttng-dev mailing list