Skip to contentSkip to conversation

Out of Tree Kernel Module

DISCUSSION Alexandre Montplaisir 4 participants 5 messages Jan 21, 2015 3 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 1421873728.21263.3.camel@c00941

#1 lore raw

Hi,

I have never tried this myself, but a similar question was asked on StackOverflow recently:
http://stackoverflow.com/questions/27950396/is-it-possible-to-build-lttng-probe-module-outside-of-lttng-modules-tree

and the author found a solution. Maybe this can help?

Cheers,
Alex

Quoted 53 lines · Jonathan Haws

I am developing an out-of-tree kernel module and would like to instrument it for tracing. I understand I will need to create an LTTng probe in the modules source tree, however when I try to build my module, I get errors stating that a header file for the subsystem doesn't exist in the source tree.

Here is my trace event file:

#undef TRACE_SYSTEM
#define TRACE_SYSTEM sigma

#if !defined(_TRACE_SIGMA_H) || defined(TRACE_HEADER_MULTI_READ) #define _TRACE_SIGMA_H

#include <linux/tracepoint.h>

TRACE_EVENT(

     sigma_exarioctl,
     TP_PROTO(int cmd, int pin, int value),
     TP_ARGS(cmd, pin, value),

     /* LTTng doesn't need those */
     TP_STRUCT__entry(),
     TP_fast_assign(),
     TP_printk("", 0)

);

#endif

/* this part must be outside protection */
#include <trace/define_trace.h>

When I include that in my module, I do this:

#define CREATE_TRACE_POINTS
#include "exartrace.h"

However, when I build, I get the error:
<KERNELDIR>/include/trace/define_trace.h:83:43: fatal error:
trace/events/sigma.h: No such file or directory
#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)

Any thoughts on what I am doing wrong?

Thanks!
Jon
_______________________________________________
lttng-dev mailing list
[email protected]
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

A message that is not in the archive (sent off-list or not yet received): [email protected]

#3 lore raw
Quoted 5 lines

I have never tried this myself, but a similar question was asked on StackOverflow recently:
http://stackoverflow.com/questions/27950396/is-it-possible-to-build-lttng-probe-module-outside-of-lttng-modules-tree

and the author found a solution. Maybe this can help?

That certainly helps, however I am still having the issue with my kernel
module itself not building. That link will help me pull my LTTng probe
back into my source directory (highly desirable), but doesn't give me any information as to why when I build my module (i.e. my driver) that it is looking for the trace/events/sigma.h file (which doesn't exists, nor should it - it is exartrace.h).

Thoughts?

Thanks!
Jon

#4 lore raw
In reply to a message not in the archive

I believe this issue is not related to what Jon was looking for. It seems to be a problem of proper inclusion of the tp header.

I followed the guide to build out-of-kernel LTTng modules recently and was able to do it properly for a random test module I did recently [1]. However it was done as a new addition to the current lttng-modules, so I was in the lttng source tree. But I believe it will clear up some doubts you have. I have not seen all macros properly and I might be wrong but I think your problem might be related to this [1] :

#define TRACE_INCLUDE_PATH ../instrumentation/events/lttng-module

#include "../instrumentation/events/lttng-module/net_filt.h"

Also, I might be way off in solving your problem, but you can use the patch as a reference while building your own module as well. If you are just testing, you can also have a look at lttng addons [3]. Its almost the same thing as a new module I think.

[1] https://gist.github.com/tuxology/4235d49b6a5fa87fa760
[2] https://gist.github.com/tuxology/4235d49b6a5fa87fa760#file-filter-example-patch-L541
[3] https://github.com/giraldeau/lttng-modules/tree/addons

--
Suchakra

Quoting Alexandre Montplaisir <[email protected]>:

Quoted 72 lines

Hi,

I have never tried this myself, but a similar question was asked on StackOverflow recently:
http://stackoverflow.com/questions/27950396/is-it-possible-to-build-lttng-probe-module-outside-of-lttng-modules-tree

and the author found a solution. Maybe this can help?

Cheers,
Alex

Quoted 45 lines · Jonathan Haws

I am developing an out-of-tree kernel module and would like to instrument it for tracing. I understand I will need to create an LTTng probe in the modules source tree, however when I try to build my module, I get errors stating that a header file for the subsystem doesn't exist in the source tree.

Here is my trace event file:

#undef TRACE_SYSTEM
#define TRACE_SYSTEM sigma

#if !defined(_TRACE_SIGMA_H) || defined(TRACE_HEADER_MULTI_READ) #define _TRACE_SIGMA_H

#include <linux/tracepoint.h>

TRACE_EVENT(

    sigma_exarioctl,
    TP_PROTO(int cmd, int pin, int value),
    TP_ARGS(cmd, pin, value),

    /* LTTng doesn't need those */
    TP_STRUCT__entry(),
    TP_fast_assign(),
    TP_printk("", 0)

);

#endif

/* this part must be outside protection */
#include <trace/define_trace.h>

When I include that in my module, I do this:

#define CREATE_TRACE_POINTS
#include "exartrace.h"

However, when I build, I get the error:
<KERNELDIR>/include/trace/define_trace.h:83:43: fatal error:
trace/events/sigma.h: No such file or directory
#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)

Quoted 8 lines

Any thoughts on what I am doing wrong?

Thanks!
Jon
_______________________________________________
lttng-dev mailing list
[email protected]
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

_______________________________________________
lttng-dev mailing list
[email protected]
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

#5 lore raw
In reply to a message not in the archive
Quoted 35 lines · Jonathan Haws

I am developing an out-of-tree kernel module and would like to instrument it for tracing. I understand I will need to create an LTTng probe in the modules source tree, however when I try to build my module, I get errors stating that a header file for the subsystem doesn't exist in the source tree.

Here is my trace event file:

#undef TRACE_SYSTEM
#define TRACE_SYSTEM sigma

#if !defined(_TRACE_SIGMA_H) || defined(TRACE_HEADER_MULTI_READ) #define _TRACE_SIGMA_H

#include <linux/tracepoint.h>

TRACE_EVENT(

    sigma_exarioctl,
    TP_PROTO(int cmd, int pin, int value),
    TP_ARGS(cmd, pin, value),

    /* LTTng doesn't need those */
    TP_STRUCT__entry(),
    TP_fast_assign(),
    TP_printk("", 0)

);

#endif

/* this part must be outside protection */
#include <trace/define_trace.h>

When I include that in my module, I do this:

Quoted 9 lines

#define CREATE_TRACE_POINTS
#include "exartrace.h"

However, when I build, I get the error:
<KERNELDIR>/include/trace/define_trace.h:83:43: fatal error:
trace/events/sigma.h: No such file or directory
#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)

Jonathan,

Did you try the procedure described here?
<http://lttng.org/docs/#doc-instrumenting-out-of-tree-linux-kernel>

Phil

Quoted 9 lines

Any thoughts on what I am doing wrong?

Thanks!
Jon
_______________________________________________
lttng-dev mailing list
[email protected]
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

A message that is not in the archive (sent off-list or not yet received): CAB4xu_3HiokfZFZsanRBK1bcNv7wxMn2P27yme3H84wxPhtF5w@mail.gmail.com

#7 lore raw
Quoted 2 lines

Did you try the procedure described here?
<http://lttng.org/docs/#doc-instrumenting-out-of-tree-linux-kernel>

Yes, I have been following that. However, that talks about changes to the probe file, but doesn't address anything about the actual module being instrumented. There isn't any information about where to put your tracepoint definitions header for an out-of-tree module.

Does the tracepoint definition still have to reside in the kernel sources? I hope not - hopefully there is a way to point the module Makefiles to where my tracepoint files actually are.

Thanks!
Jon