2015-06-15 15:32:04

by Mathieu Desnoyers

[permalink] [raw]
Subject: membarrier selftest issue

Hi,

The updated membarrier tree:
https://github.com/compudj/linux-dev
branch: sys-membarrier-volatile

has an issue building selftests (make -C tools/testing/selftests)

It appears that including linux/membarrier.h from those userspace
tests now fails (as of 4.1-rc8). Of course, my system does not have
the updated userspace headers installed. What is the right course
of action there ?

[...]
gcc -I../../../../usr/include/ kcmp_test.c -o kcmp_test
kcmp_test.c:13:24: fatal error: linux/kcmp.h: No such file or directory
#include <linux/kcmp.h>
^
compilation terminated.
make[1]: *** [kcmp_test] Error 1
make[1]: Leaving directory `/home/efficios/git/linux-dev/tools/testing/selftests/kcmp'
make[1]: Entering directory `/home/efficios/git/linux-dev/tools/testing/selftests/membarrier'
gcc -g -I../../../../usr/include/ membarrier_test.c -o membarrier_test
membarrier_test.c:4:30: fatal error: linux/membarrier.h: No such file or directory
#include <linux/membarrier.h>
^
compilation terminated.
make[1]: *** [all] Error 1
make[1]: Leaving directory `/home/efficios/git/linux-dev/tools/testing/selftests/membarrier'
make[1]: Entering directory `/home/efficios/git/linux-dev/tools/testing/selftests/memfd'
gcc -D_FILE_OFFSET_BITS=64 -I../../../../include/uapi/ -I../../../../include/ -I../../../../usr/include/ memfd_test.c -o memfd_test
memfd_test.c: In function ‘sys_memfd_create’:
memfd_test.c:26:17: error: ‘__NR_memfd_create’ undeclared (first use in this function)
return syscall(__NR_memfd_create, name, flags);
^
memfd_test.c:26:17: note: each undeclared identifier is reported only once for each function it appears

Thanks,

Mathieu

--
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com


2015-06-17 04:56:57

by Pranith Kumar

[permalink] [raw]
Subject: Re: membarrier selftest issue

Hi Mathieu,

On Mon, Jun 15, 2015 at 11:31 AM, Mathieu Desnoyers
<[email protected]> wrote:
> Hi,
>
> The updated membarrier tree:
> https://github.com/compudj/linux-dev
> branch: sys-membarrier-volatile
>
> has an issue building selftests (make -C tools/testing/selftests)
>
> It appears that including linux/membarrier.h from those userspace
> tests now fails (as of 4.1-rc8). Of course, my system does not have
> the updated userspace headers installed. What is the right course
> of action there ?
>

This somehow is working for me. Did you install the kernel? I am on
debian and I had to install kernel+headers+libc for this to work. pmu
tests did not work due to missing headers but membarrier and memfd did
work.

pranith@macmini:~/linux$ make -C tools/testing/selftests
make: Entering directory '/home/pranith/linux/tools/testing/selftests'
for TARGET in breakpoints cpu-hotplug efivarfs exec firmware ftrace
kcmp membarrier memfd memory-hotplug mount mqueue net powerpc ptrace
size sysctl timers user vm x86; do \
make -C $TARGET; \
done;
make[1]: Entering directory
'/home/pranith/linux/tools/testing/selftests/breakpoints'
echo "Not an x86 target, can't build breakpoints selftests"
Not an x86 target, can't build breakpoints selftests
make[1]: Leaving directory
'/home/pranith/linux/tools/testing/selftests/breakpoints'
make[1]: Entering directory
'/home/pranith/linux/tools/testing/selftests/cpu-hotplug'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory
'/home/pranith/linux/tools/testing/selftests/cpu-hotplug'
make[1]: Entering directory
'/home/pranith/linux/tools/testing/selftests/efivarfs'
gcc -Wall open-unlink.c -o open-unlink
gcc -Wall create-read.c -o create-read
make[1]: Leaving directory
'/home/pranith/linux/tools/testing/selftests/efivarfs'
make[1]: Entering directory '/home/pranith/linux/tools/testing/selftests/exec'
gcc -Wall -o execveat execveat.c
ln -s -f execveat execveat.symlink
cp execveat execveat.denatured
chmod -x execveat.denatured
echo '#!/bin/sh' > script
echo 'exit $*' >> script
chmod +x script
mkdir -p subdir
make[1]: Leaving directory '/home/pranith/linux/tools/testing/selftests/exec'
make[1]: Entering directory
'/home/pranith/linux/tools/testing/selftests/firmware'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory
'/home/pranith/linux/tools/testing/selftests/firmware'
make[1]: Entering directory '/home/pranith/linux/tools/testing/selftests/ftrace'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/home/pranith/linux/tools/testing/selftests/ftrace'
make[1]: Entering directory '/home/pranith/linux/tools/testing/selftests/kcmp'
gcc -I../../../../usr/include/ kcmp_test.c -o kcmp_test
make[1]: Leaving directory '/home/pranith/linux/tools/testing/selftests/kcmp'
make[1]: Entering directory
'/home/pranith/linux/tools/testing/selftests/membarrier'
gcc -g -I../../../../usr/include/ membarrier_test.c -o membarrier_test
make[1]: Leaving directory
'/home/pranith/linux/tools/testing/selftests/membarrier'
make[1]: Entering directory '/home/pranith/linux/tools/testing/selftests/memfd'
gcc -D_FILE_OFFSET_BITS=64 -I../../../../include/uapi/
-I../../../../include/ -I../../../../usr/include/ memfd_test.c -o
memfd_test
make[1]: Leaving directory '/home/pranith/linux/tools/testing/selftests/memfd'
make[1]: Entering directory
'/home/pranith/linux/tools/testing/selftests/memory-hotplug'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory
'/home/pranith/linux/tools/testing/selftests/memory-hotplug'
make[1]: Entering directory '/home/pranith/linux/tools/testing/selftests/mount'
gcc -Wall -O2 unprivileged-remount-test.c -o unprivileged-remount-test
make[1]: Leaving directory '/home/pranith/linux/tools/testing/selftests/mount'
make[1]: Entering directory '/home/pranith/linux/tools/testing/selftests/mqueue'
gcc -O2 mq_open_tests.c -o mq_open_tests -lrt
gcc -O2 -o mq_perf_tests mq_perf_tests.c -lrt -lpthread -lpopt
mq_perf_tests.c:39:18: fatal error: popt.h: No such file or directory
#include <popt.h>
^
compilation terminated.
Makefile:4: recipe for target 'all' failed
make[1]: *** [all] Error 1
make[1]: Leaving directory '/home/pranith/linux/tools/testing/selftests/mqueue'
make[1]: Entering directory '/home/pranith/linux/tools/testing/selftests/net'
gcc -Wall -O2 -g -I../../../../usr/include/ -o socket socket.c
gcc -Wall -O2 -g -I../../../../usr/include/ -o psock_fanout psock_fanout.c
gcc -Wall -O2 -g -I../../../../usr/include/ -o psock_tpacket psock_tpacket.c
make[1]: Leaving directory '/home/pranith/linux/tools/testing/selftests/net'
make[1]: Entering directory
'/home/pranith/linux/tools/testing/selftests/powerpc'
make -k -C pmu all
make[2]: Entering directory
'/home/pranith/linux/tools/testing/selftests/powerpc/pmu'
gcc -Wall -O2 -flto -Wall -Werror
-DGIT_VERSION='"v4.1-rc8-3-g9ab055c-dirty"'
-I/home/pranith/linux/tools/testing/selftests/powerpc -m64 -o
count_instructions loop.S count_instructions.c ../harness.c event.c
lib.c
In file included from /usr/include/stdio.h:27:0,

--
Pranith

2015-06-17 11:59:51

by Mathieu Desnoyers

[permalink] [raw]
Subject: Re: membarrier selftest issue

----- On Jun 17, 2015, at 12:56 AM, Pranith Kumar [email protected] wrote:

> Hi Mathieu,
>
> On Mon, Jun 15, 2015 at 11:31 AM, Mathieu Desnoyers
> <[email protected]> wrote:
>> Hi,
>>
>> The updated membarrier tree:
>> https://github.com/compudj/linux-dev
>> branch: sys-membarrier-volatile
>>
>> has an issue building selftests (make -C tools/testing/selftests)
>>
>> It appears that including linux/membarrier.h from those userspace
>> tests now fails (as of 4.1-rc8). Of course, my system does not have
>> the updated userspace headers installed. What is the right course
>> of action there ?
>>
>
> This somehow is working for me. Did you install the kernel? I am on
> debian and I had to install kernel+headers+libc for this to work. pmu
> tests did not work due to missing headers but membarrier and memfd did
> work.

It's the make headers_install part I forgot. I mistakenly thought
that the kernel self-tests would build against the in-tree headers
rather than the system headers. This is how userspace projects I know
of are usually designed.

Thanks,

Mathieu

>
> pranith@macmini:~/linux$ make -C tools/testing/selftests
> make: Entering directory '/home/pranith/linux/tools/testing/selftests'
> for TARGET in breakpoints cpu-hotplug efivarfs exec firmware ftrace
> kcmp membarrier memfd memory-hotplug mount mqueue net powerpc ptrace
> size sysctl timers user vm x86; do \
> make -C $TARGET; \
> done;
> make[1]: Entering directory
> '/home/pranith/linux/tools/testing/selftests/breakpoints'
> echo "Not an x86 target, can't build breakpoints selftests"
> Not an x86 target, can't build breakpoints selftests
> make[1]: Leaving directory
> '/home/pranith/linux/tools/testing/selftests/breakpoints'
> make[1]: Entering directory
> '/home/pranith/linux/tools/testing/selftests/cpu-hotplug'
> make[1]: Nothing to be done for 'all'.
> make[1]: Leaving directory
> '/home/pranith/linux/tools/testing/selftests/cpu-hotplug'
> make[1]: Entering directory
> '/home/pranith/linux/tools/testing/selftests/efivarfs'
> gcc -Wall open-unlink.c -o open-unlink
> gcc -Wall create-read.c -o create-read
> make[1]: Leaving directory
> '/home/pranith/linux/tools/testing/selftests/efivarfs'
> make[1]: Entering directory '/home/pranith/linux/tools/testing/selftests/exec'
> gcc -Wall -o execveat execveat.c
> ln -s -f execveat execveat.symlink
> cp execveat execveat.denatured
> chmod -x execveat.denatured
> echo '#!/bin/sh' > script
> echo 'exit $*' >> script
> chmod +x script
> mkdir -p subdir
> make[1]: Leaving directory '/home/pranith/linux/tools/testing/selftests/exec'
> make[1]: Entering directory
> '/home/pranith/linux/tools/testing/selftests/firmware'
> make[1]: Nothing to be done for 'all'.
> make[1]: Leaving directory
> '/home/pranith/linux/tools/testing/selftests/firmware'
> make[1]: Entering directory '/home/pranith/linux/tools/testing/selftests/ftrace'
> make[1]: Nothing to be done for 'all'.
> make[1]: Leaving directory '/home/pranith/linux/tools/testing/selftests/ftrace'
> make[1]: Entering directory '/home/pranith/linux/tools/testing/selftests/kcmp'
> gcc -I../../../../usr/include/ kcmp_test.c -o kcmp_test
> make[1]: Leaving directory '/home/pranith/linux/tools/testing/selftests/kcmp'
> make[1]: Entering directory
> '/home/pranith/linux/tools/testing/selftests/membarrier'
> gcc -g -I../../../../usr/include/ membarrier_test.c -o membarrier_test
> make[1]: Leaving directory
> '/home/pranith/linux/tools/testing/selftests/membarrier'
> make[1]: Entering directory '/home/pranith/linux/tools/testing/selftests/memfd'
> gcc -D_FILE_OFFSET_BITS=64 -I../../../../include/uapi/
> -I../../../../include/ -I../../../../usr/include/ memfd_test.c -o
> memfd_test
> make[1]: Leaving directory '/home/pranith/linux/tools/testing/selftests/memfd'
> make[1]: Entering directory
> '/home/pranith/linux/tools/testing/selftests/memory-hotplug'
> make[1]: Nothing to be done for 'all'.
> make[1]: Leaving directory
> '/home/pranith/linux/tools/testing/selftests/memory-hotplug'
> make[1]: Entering directory '/home/pranith/linux/tools/testing/selftests/mount'
> gcc -Wall -O2 unprivileged-remount-test.c -o unprivileged-remount-test
> make[1]: Leaving directory '/home/pranith/linux/tools/testing/selftests/mount'
> make[1]: Entering directory '/home/pranith/linux/tools/testing/selftests/mqueue'
> gcc -O2 mq_open_tests.c -o mq_open_tests -lrt
> gcc -O2 -o mq_perf_tests mq_perf_tests.c -lrt -lpthread -lpopt
> mq_perf_tests.c:39:18: fatal error: popt.h: No such file or directory
> #include <popt.h>
> ^
> compilation terminated.
> Makefile:4: recipe for target 'all' failed
> make[1]: *** [all] Error 1
> make[1]: Leaving directory '/home/pranith/linux/tools/testing/selftests/mqueue'
> make[1]: Entering directory '/home/pranith/linux/tools/testing/selftests/net'
> gcc -Wall -O2 -g -I../../../../usr/include/ -o socket socket.c
> gcc -Wall -O2 -g -I../../../../usr/include/ -o psock_fanout psock_fanout.c
> gcc -Wall -O2 -g -I../../../../usr/include/ -o psock_tpacket psock_tpacket.c
> make[1]: Leaving directory '/home/pranith/linux/tools/testing/selftests/net'
> make[1]: Entering directory
> '/home/pranith/linux/tools/testing/selftests/powerpc'
> make -k -C pmu all
> make[2]: Entering directory
> '/home/pranith/linux/tools/testing/selftests/powerpc/pmu'
> gcc -Wall -O2 -flto -Wall -Werror
> -DGIT_VERSION='"v4.1-rc8-3-g9ab055c-dirty"'
> -I/home/pranith/linux/tools/testing/selftests/powerpc -m64 -o
> count_instructions loop.S count_instructions.c ../harness.c event.c
> lib.c
> In file included from /usr/include/stdio.h:27:0,
>
> --
> Pranith

--
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com