Re: [PATCH 6/9] perf record: Support synthesizing cgroup events
From: Arnaldo Carvalho de Melo
Date: Mon Mar 30 2020 - 12:43:19 EST
Em Mon, Mar 30, 2020 at 01:30:58PM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Wed, Mar 25, 2020 at 09:45:33PM +0900, Namhyung Kim escreveu:
> > Synthesize cgroup events by iterating cgroup filesystem directories.
> > The cgroup event only saves the portion of cgroup path after the mount
> > point and the cgroup id (which actually is a file handle).
>
> Breaks the build on alpine linux (musl libc):
>
> CC /tmp/build/perf/util/srccode.o
> CC /tmp/build/perf/util/synthetic-events.o
> util/synthetic-events.c: In function 'perf_event__synthesize_cgroup':
> util/synthetic-events.c:427:22: error: field 'fh' has incomplete type
> struct file_handle fh;
> ^
> util/synthetic-events.c:441:6: error: implicit declaration of function 'name_to_handle_at' [-Werror=implicit-function-declaration]
> if (name_to_handle_at(AT_FDCWD, path, &handle.fh, &mount_id, 0) < 0) {
> ^
> util/synthetic-events.c:441:2: error: nested extern declaration of 'name_to_handle_at' [-Werror=nested-externs]
> if (name_to_handle_at(AT_FDCWD, path, &handle.fh, &mount_id, 0) < 0) {
> ^
> CC /tmp/build/perf/util/data.o
> cc1: all warnings being treated as errors
> mv: can't rename '/tmp/build/perf/util/.synthetic-events.o.tmp': No such file or directory
>
>
> I'm trying to fix
musl libc up to 1.2.21 (IIRC) lacks name_to_handle_at and its structs,
then from the one that is in alpine linux 3.10 the error changes to:
CC /tmp/build/perf/util/cloexec.o
util/synthetic-events.c:427:22: error: field 'fh' with variable sized type 'struct file_handle' not at the end of a struct or class is a GNU
extension [-Werror,-Wgnu-variable-sized-type-not-at-end]
struct file_handle fh;
^
1 error generated.
mv: can't rename '/tmp/build/perf/util/.synthetic-events.o.tmp': No such file or directory
make[4]: *** [/git/linux/tools/build/Makefile.build:97: /tmp/build/perf/util/synthetic-events.o] Error 1
make[4]: *** Waiting for unfinished jobs....
make[3]: *** [/git/linux/tools/build/Makefile.build:139: util] Error 2
make[2]: *** [Makefile.perf:617: /tmp/build/perf/perf-in.o] Error 2
make[1]: *** [Makefile.perf:225: sub-make] Error 2
make: *** [Makefile:70: all] Error 2
make: Leaving directory '/git/linux/tools/perf'
+ exit 1
[root@quaco ~]#
So probably we'll need a feature test to catch this and do some
workaround or disable the feature on such systems, providing some
warning.
I left the container build tests running to see if some other system has
problems with this, perhaps the ones with uCLibc or some older glibc,
we'll see.
So far all the alpine versions failed with the above problems and ALT
Linux p8 and p9 built without problems.
- Arnaldo