Project

General

Profile

Actions

Bug #1213

closed

Cannot print trace under chroot

Added by jinming liao almost 5 years ago. Updated over 2 years ago.

Status:
Invalid
Priority:
Normal
Assignee:
-
Target version:
Start date:
01/13/2020
Due date:
% Done:

0%

Estimated time:

Description

I want to use lttng under chroot, here is what I did:

  1. The root directory of chroot is / var / chroot.
  2. Install userspace-rcu-0.10.1-1.el7.x86_64.rpm, lttng-ust-2.10.3-1.el7.x86_64.rpm, lttng-tools-2.10.4-1.el7.x86_64.rpm And babeltrace-1.5.5-1.el7.x86_64.rpm to / var / chroot.
  3. Copy the corresponding dependent libraries to / var / chroot.
  4. mount --bind / dev / shm / var / chroot / dev / shm

This is fine at first, and can print the trace, but it won't work later, I don't know the reason. Here are the commands I executed under chroot:

lttng-sessiond --no-kernel --daemonize
lttng create
lttng enable-event -u sal _ *, sql *
lttng add-context --type = vpid --type = pthread_id -u
lttng start
lttng stop
lttng view

And I found that if lttng add-context --type = vpid --type = pthread_id -u is not executed, the trace can be printed.

I read the source code of lttng-ust, and printed some logs, and found that the problem was in the frontend_api.h: lib_ring_buffer_reserve function:

static inline
int lib_ring_buffer_reserve (const struct lttng_ust_lib_ring_buffer_config * config,
          struct lttng_ust_lib_ring_buffer_ctx * ctx)
{
  struct channel * chan = ctx-> chan;
  struct lttng_ust_shm_handle * handle = ctx-> handle;
  struct lttng_ust_lib_ring_buffer * buf;
  unsigned long o_begin, o_end, o_old;
  size_t before_hdr_pad = 0;

  if (caa_unlikely (uatomic_read (& chan-> record_disabled)))
    return -EAGAIN;

  if (config-> alloc == RING_BUFFER_ALLOC_PER_CPU)
    buf = shmp (handle, chan-> backend.buf [ctx-> cpu] .shmp);
  else
    buf = shmp (handle, chan-> backend.buf [0] .shmp);
  if (caa_unlikely (! buf))
    return -EIO;
  if (caa_unlikely (uatomic_read (& buf-> record_disabled)))
    return -EAGAIN;
  ctx-> buf = buf;
    ...

I found that the function would return in if (caa_unlikely (! Buf)) and if (caa_unlikely (uatomic_read (& buf-> record_disabled))), resulting in the code that generates the trace cannot be reached, so the trace cannot be printed.

I researched for a while, but I couldn't find the reason, so I came here for help.


Files

log.txt (133 KB) log.txt lttng-sessiond's log jinming liao, 01/14/2020 07:02 AM
hello.log (25.6 KB) hello.log jinming liao, 01/14/2020 10:35 PM
lttng.log (134 KB) lttng.log jinming liao, 01/14/2020 10:37 PM
Actions

Also available in: Atom PDF