Project

General

Profile

Actions

Bug #1156

closed

Redeclaration of rcu symbols when adding UST tracepoints to tools

Added by Geneviève Bastien over 6 years ago. Updated over 5 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
02/26/2018
Due date:
% Done:

0%

Estimated time:

Description

As discussed offline, I am adding a monitoring thread to lttng-tools that monitors udev events and adds a lttng-ust event when <something> happens.

When trying to compile with lttng-ust tracepoints, I get compilation errors about redeclarations of rcu-related symbols defined in urcu-bp.h, included by ust includes and urcu.h included by tools, as the following output shows:

In file included from /usr/local/include/urcu-bp.h:62:0,
from /usr/local/include/lttng/tracepoint-rcu.h:30,
from /usr/local/include/lttng/tracepoint.h:29,
from udev-monitor-provider.h:36,
from udev-monitor.c:37:
/usr/local/include/urcu/static/urcu-bp.h:57:6: error: nested redefinition of ‘enum rcu_state’
enum rcu_state {
^~~~~~~
/usr/local/include/urcu/static/urcu-bp.h:57:6: error: redeclaration of ‘enum rcu_state’
In file included from /usr/local/include/urcu.h:59:0,
from lttng-sessiond.h:22,
from udev-monitor.c:26:
/usr/local/include/urcu/static/urcu.h:77:6: note: originally defined here
enum rcu_state {
^~~~~~~
In file included from /usr/local/include/urcu-bp.h:62:0,
from /usr/local/include/lttng/tracepoint-rcu.h:30,
from /usr/local/include/lttng/tracepoint.h:29,
from udev-monitor-provider.h:36,
from udev-monitor.c:37:
/usr/local/include/urcu/static/urcu-bp.h:58:2: error: redeclaration of enumerator ‘RCU_READER_ACTIVE_CURRENT’
RCU_READER_ACTIVE_CURRENT,
^~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/local/include/urcu.h:59:0,
from lttng-sessiond.h:22,
from udev-monitor.c:26:
/usr/local/include/urcu/static/urcu.h:78:2: note: previous definition of ‘RCU_READER_ACTIVE_CURRENT’ was here
RCU_READER_ACTIVE_CURRENT,
^~~~~~~~~~~~~~~~~~~~~~~


Files

0001-Add-thread-to-monitor-udev.patch (14.1 KB) 0001-Add-thread-to-monitor-udev.patch faulty patch Geneviève Bastien, 02/26/2018 02:55 PM
Actions #1

Updated by Mathieu Desnoyers over 6 years ago

This is an issue in liburcu: this enum and its labels should have been namespaced with e.g. urcu_bp_... and URCU_BP_... Can you try doing a patch for this ?

Actions #2

Updated by Mathieu Desnoyers over 6 years ago

  • Project changed from LTTng-tools to Userspace RCU
  • Status changed from New to Confirmed
Actions #3

Updated by Mathieu Desnoyers over 6 years ago

Now that I think about it a bit more, I now remember that it's not supported to include multiple liburcu flavors within the same compile unit. We'll have to investigate further.

Actions #4

Updated by Geneviève Bastien over 6 years ago

So it means that for now it would be impossible to add UST tracepoints to lttng-tools. Is my understanding correct?

Actions #5

Updated by Mathieu Desnoyers over 6 years ago

It might work if you do not #define _LGPL_SOURCE at the top of the implementation. This will prevent inlining of urcu calls, and therefore we don't need to include urcu-bp.h from tracepoint-rcu.h.

Actions #6

Updated by Geneviève Bastien over 6 years ago

Ok, so removing the _LGPL_SOURCE did remove the redefinitions or urcu related symbols.

But going back to the original bug, there are other redefinitions related to ust vs tools redefinitions:

In file included from /usr/local/include/lttng/ust-tracepoint-event.h:27:0,
from /usr/local/include/lttng/tracepoint-event.h:58,
from udev-monitor-provider.h:67,
from udev-monitor.c:37:
/usr/local/include/lttng/ust-events.h:252:8: error: redefinition of ‘struct lttng_event_field’
struct lttng_event_field {
^~~~~~~~~~~~~~~
In file included from ./syscall.h:22:0,
from /usr/local/include/urcu/syscall-compat.h:33,
from /usr/local/include/urcu/arch.h:27,
from /usr/local/include/urcu/tls-compat.h:29,
from ../../../src/common/error.h:26,
from ../../../src/common/common.h:22,
from udev-monitor.c:21:
../../../include/lttng/event.h:283:8: note: originally defined here
struct lttng_event_field {
^~~~~~~~~~~~~~~
In file included from /usr/local/include/lttng/ust-tracepoint-event.h:27:0,
from /usr/local/include/lttng/tracepoint-event.h:58,
from udev-monitor-provider.h:67,
from udev-monitor.c:37:
/usr/local/include/lttng/ust-events.h:444:8: error: redefinition of ‘struct lttng_event’
struct lttng_event {
^~~~~~~~~
In file included from ./syscall.h:22:0,
from /usr/local/include/urcu/syscall-compat.h:33,
from /usr/local/include/urcu/arch.h:27,
from /usr/local/include/urcu/tls-compat.h:29,
from ../../../src/common/error.h:26,
from ../../../src/common/common.h:22,
from udev-monitor.c:21:
../../../include/lttng/event.h:231:8: note: originally defined here
struct lttng_event {
^~~~~~~~~

and a few more such. And they lead to errors like this later:

./udev-monitor-provider.h: In function ‘__event_probe__udev_monitor___kvm_created’:
./udev-monitor-provider.h:43:1: error: ‘struct lttng_session’ has no member named ‘active’
TRACEPOINT_EVENT(
^
./udev-monitor-provider.h:43:1: error: ‘struct lttng_session’ has no member named ‘active’
TRACEPOINT_EVENT(
^
./udev-monitor-provider.h: In function ‘__event_probe__udev_monitor___kvm_destroyed’:
./udev-monitor-provider.h:56:1: error: ‘struct lttng_session’ has no member named ‘active’
TRACEPOINT_EVENT(
^
./udev-monitor-provider.h:56:1: error: ‘struct lttng_session’ has no member named ‘active’
TRACEPOINT_EVENT(

Since those structs with same names do not have the same structure in ust and tools

Actions #7

Updated by Mathieu Desnoyers over 6 years ago

This is unexpected:

In file included from ./syscall.h:22:0,
from /usr/local/include/urcu/syscall-compat.h:33,

Basically, the file src/bin/lttng-sessiond/syscall.h overrides the system header syscall.h included from urcu/syscall-compat.h.

Can you try renaming the tools syscall.h header file to lttng-syscall.h to remove this mixup ?

By doing this, you won't end up including as a side-effect lttng/event.h, which declares the struct that conflicts with the lttng-ust code. This should only be needed if the program is a liblttng-ust-ctl user, and I don't think your daemon needs that.

Thanks,

Mathieu

Actions #8

Updated by Geneviève Bastien over 6 years ago

oh maybe that's me then, I had to add -I./ to AM_CPPFLAGS in src/bin/lttng-sessiond/Makefile.am

or else I got the following when defining the tracepoints:

In file included from udev-monitor.c:37:0:
udev-monitor-provider.h:31:28: fatal error: udev-monitor-provider.h: No such file or directory
#define TRACEPOINT_INCLUDE "./udev-monitor-provider.h"
^~~~~~~~~~~~~~~~~~~~~~~

Maybe I shouldn't do that?

Actions #9

Updated by Geneviève Bastien over 6 years ago

Anyway, even if I do as you say, this is not the end of it. It still ends up being included more than once from another path:

In file included from /usr/local/include/lttng/ust-tracepoint-event.h:27:0,
from /usr/local/include/lttng/tracepoint-event.h:58,
from udev-monitor-provider.h:67,
from udev-monitor.c:37:
/usr/local/include/lttng/ust-events.h:252:8: error: redefinition of ‘struct lttng_event_field’
struct lttng_event_field {
^~~~~~~~~~~~~~~
In file included from ../../../include/lttng/channel.h:22:0,
from ../../../include/lttng/lttng.h:29,
from ../../../src/common/sessiond-comm/sessiond-comm.h:29,
from lttng-sessiond.h:25,
from udev-monitor.c:26:
../../../include/lttng/event.h:283:8: note: originally defined here
struct lttng_event_field {

I think I'm doomed to either rename everything, or just forget about UST tracepoints in tools :(

Actions #10

Updated by Mathieu Desnoyers over 5 years ago

  • Project changed from Userspace RCU to LTTng-UST

AFAIK, the original issue (clash of liburcu identifiers) was corrected in liburcu master branch.

Moving this ticket to the lttng-ust project.

Thanks,

Mathieu

Actions #11

Updated by Mathieu Desnoyers over 5 years ago

  • Status changed from Confirmed to Resolved

Actually, considering that the original issue was fixed upstream, I will close this ticket. Please open a separate ticket for other compile issues when integrating lttng-ust instrumentation into lttng-tools.

Actions

Also available in: Atom PDF