Wind River Support Network

HomeDefectsLIN1019-2430
Fixed

LIN1019-2430 : LTTNG issue with epoch negative clock offset

Created: Sep 1, 2019    Updated: May 11, 2020
Resolved Date: Apr 26, 2020
Found In Version: 10.19.45.1
Fix Version: 10.19.45.7
Severity: Standard
Applicable for: Wind River Linux LTS 19
Component/s: Userspace

Description

The customer requested a solution on Unix time, where systemd prevented that the system date started since 01-01-1970. This was solved.

However, the proposed solution above introduced a new problem on lttng. When using lttng to view traces, it reports the following errors:

[error] ctf_clock_declaration_visit: unexpected unary expression for clock offset

[error] ctf_visitor_construct_metadata: clock declaration error

[error] Error in CTF metadata constructor -22

[warning] Unable to open trace metadata for path "/tmp/csrpTrace/trace/ust/uid/0/32-bit".

[warning] [Context] Cannot open_trace of format ctf at path /tmp/csrpTrace/trace/ust/uid/0/32-bit.

[warning] [Context] cannot open trace "/tmp/csrpTrace/trace/ust/uid/0/32-bit" from /tmp/csrpTrace/trace for reading.

[error] Cannot open any trace for reading.

[error] opening trace "/tmp/csrpTrace/trace" for reading.

[error] none of the specified trace paths could be opened.

 

In the lttng file "metadata", offset of clock is negative:

clock {

name = "monotonic";

uuid = "f18ef9e3-93fb-432b-bd8c-2c0da378d22c";

description = "Monotonic Clock";

freq = 1000000000; /* Frequency, in Hz */

/* clock value offset from Epoch is: offset * (1/freq) */

offset = -40;

};

 

This is with lttng version 2.9.5

The customer suggest the following patch may be useful:

[https://lists.lttng.org/pipermail/lttng-dev/2016-February/025487.html]

 

 

Steps to Reproduce

I tried to repro on qemu and a xilinx zcu102 board onsite but was unable to see the customer's issue. There are the steps I've followed:

1. In LTS18 project. Configure kernel to remove RTC support (in order to avoid any time synchronization) with "bitbake -c menuconfig linux-yocto" then disable Device Drivers>Real Time Clock.

2. Add to conf/local.conf:

EXTRA_OEMESON_append_pn-systemd = " -Dtime-epoch=0"

IMAGE_INSTALL_append = " lttng-tools lttng-modules lttng-ust babeltrace"

3. Boot target without network (to avoid time sync from kernel or systemd)

4. Login and use lttng to create trace session and trace anything (example with scheduler switch tracing):

lttng create
 lttng enable-event -k sched_switch
 lttng start
 lttng stop
 lttng destroy

5. Use lttng view. This should provoke the error due to the negative offset.

lttng view

6. Check metadata file from the lttng trace outputs and confirm the negative offset (example from customer's metadata)

clock

{ name = "monotonic"; uuid = "f18ef9e3-93fb-432b-bd8c-2c0da378d22c"; description = "Monotonic Clock"; freq = 1000000000; /* Frequency, in Hz */ /* clock value offset from Epoch is: offset * (1/freq) */ offset = -40; }

;
Live chat
Online