Project

General

Profile

Actions

Bug #1053

closed

lttng-ust doesn't build on Ubuntu 12.04

Added by Simon Marchi over 7 years ago. Updated over 7 years ago.

Status:
Resolved
Priority:
Normal
Target version:
-
Start date:
10/04/2016
Due date:
% Done:

100%

Estimated time:
(Total: 0.00 h)

Description

UST doesn't build on Ubuntu 12.04, because it uses fields of the perf_event_mmap_page structure that are not available in the version of linux/perf_event.h shipping with that version of Ubuntu.

Build log: https://launchpadlibrarian.net/275214770/buildlog_ubuntu-precise-amd64.ust_2.8.x+stable+bzr2111+pack66+201607262232~ubuntu12.04.1_BUILDING.txt.gz

libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -I../include/lttng -I../include -I../include -D_FORTIFY_SOURCE=2 -I/usr/lib/jvm/default-java/include -I/usr/lib/jvm/default-java/include/linux -fno-strict-aliasing -Wall -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -c lttng-context-perf-counters.c  -fPIC -DPIC -o .libs/lttng-context-perf-counters.o
lttng-context-perf-counters.c: In function 'read_perf_counter':
lttng-context-perf-counters.c:118:22: error: 'struct perf_event_mmap_page' has no member named 'pmc_width'
lttng-context-perf-counters.c:119:22: error: 'struct perf_event_mmap_page' has no member named 'pmc_width'
make[3]: *** [lttng-context-perf-counters.lo] Error 1

Subtasks 1 (0 open1 closed)

Bug #1065: Upgrade failure?ResolvedMathieu Desnoyers10/04/2016

Actions
Actions #1

Updated by Mathieu Desnoyers over 7 years ago

One possible solution would be to grab our own copy of perf-event.h into lttng-ust, and use that local header.

As we do that, we should also check the "version" field of the ABI when interacting with the kernel to ensure
that the pmc_width is populated, else we should refuse to interact with the kernel.

Thoughts ?

Actions #2

Updated by Simon Marchi over 7 years ago

Yeah it makes sense. I suppose that with the stock 12.04 kernel the ABI version will be too old so the perf counter feature won't be available, but at least it would allow using the rest of lttng-ust. It might not be super useful in itself to get lttng-ust working on 12.04 (it's super ooooold), but it would be useful to put the infrastructure to check the ABI version in place for future breakages.

Actions #3

Updated by Anonymous over 7 years ago

linux/perf_event.h is part of the linux-headers package. I guess many users will have kernel headers installed if they also want to compile lttng-modules, but that may not be the case of all of them. Is UST supposed to have a hard dependency on perf/linux-headers? Could that be a configure option, like --disable-perf-counters ?

Actions #4

Updated by Mathieu Desnoyers over 7 years ago

Alex: we're really talking about kernel headers exposing kernel ABI to user-space (make headers_install), not the kernel headers for kernel modules (which are packaged by some distros) here.

The Linux kernel ABI exposed to userspace never breaks, only expands. So it would be safe to build lttng-ust against a local copy of the perf header here.

I don't think we should add yet another configure option. We should instead add a copy of the header into lttng-ust, and dynamically check that the kernel ABI version is appropriate to use the fields we need to use.

Actions #5

Updated by Mathieu Desnoyers over 7 years ago

I'm preparing a patch.

Actions #6

Updated by Mathieu Desnoyers over 7 years ago

  • Status changed from New to Resolved
  • Assignee set to Mathieu Desnoyers

The following commit should fix this issue:

commit 77d7fa989f79f3c2cb14d26576cbbb54b0637594
Author: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Date:   Thu Aug 18 14:21:46 2016 -0400

    Fix: perf counters build against kernel headers < 3.12

    Copy Linux kernel perf_event.h installed headers into lttng-ust to know
    the recent ABI layout, and use the bit description detailed in the
    following Linux kernel commit:

    https://github.com/torvalds/linux/commit/fa7315871046b9a4c48627905691dbde57e51033

    to check whether the kernel supports rdpmc.

    Fall-back on the perf read system call for kernels prior to 3.12,
    because older kernels have an ABI bug where a union was used for both
    cap_usr_time and cap_usr_rdpmc.

    Ensure setup_perf set the pc pointer value before checking whether we
    need to the file descriptor open or not.

    Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Actions #7

Updated by Simon Marchi over 7 years ago

The build passed on launchpad, but I haven't tested the runtime.

Thanks!

Actions

Also available in: Atom PDF