Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1231812
| From | Michael Ellerman <mpe@ellerman.id.au> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 2/2] selftests/userfaultfd: improve syscall number definition |
| Date | 2015-09-24 04:10 +0200 |
| Message-ID | <qc48V-5Uv-17@gated-at.bofh.it> (permalink) |
| References | (2 earlier) <qbw7g-6Xg-27@gated-at.bofh.it> <qbwqC-7yX-23@gated-at.bofh.it> <qbzou-3mH-15@gated-at.bofh.it> <qbP0d-yp-5@gated-at.bofh.it> <qbS7L-5di-13@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Wed, 2015-09-23 at 14:11 +0100, Andre Przywara wrote:
> Hi Michael,
>
> On 23/09/15 10:55, Michael Ellerman wrote:
> > On Tue, 2015-09-22 at 18:15 +0100, Andre Przywara wrote:
> >> On 22/09/15 15:06, Andrea Arcangeli wrote:
> >>> Andre, could you see if linux-next (which includes -mm) works for you
> >>> by just running "cd tools/testing/selftests/vm/ && make"? If there's
> >>> any further change required could you diff it against linux-next?
> >>
> >> This doesn't compile now for me, because it looks into
> >> /usr/include/asm/unistd.h, which I keep to the distribution copy of it.
> >> Also linux/userfaultfd.h is missing, because it's brand new.
> > ...
> >> I guess the right solution would be to hack the Makefile to set the
> >> include path to the kernel's copy of include/uapi, though I am not sure
> >> this works cleanly for different architectures and separate build
> >> directories. I will give this a try ...
> >
> > Not that's not the right solution.
> >
> > The right solution is to export the kernel headers, the Makefile will pick them
> > up (at least in linux-next):
>
> Actually that was I was hoping for, I just missed the possibility of
> headers_install to put the files back into the kernel tree (I usually
> use it with INSTALL_HDR_PATH for packaging).
OK great.
It does seem that folks are struggling to work out how to do this, so maybe we
can come up with a way to have it automated.
> > $ cd linux
> > $ make headers_install
> > $ ls usr/include/
> > asm/ asm-generic/ drm/ linux/ misc/ mtd/ rdma/ scsi/ sound/ uapi/ video/ xen/
> > $ make -C tools/testing/selftests TARGETS=vm
> > ...
> > $ ls tools/testing/selftests/vm/userfaultfd
> > tools/testing/selftests/vm/userfaultfd*
>
> Yes, that works. Now I have just to figure out how to arrange this with
> out-of-tree build directories.
Right, I think it doesn't work at the moment.
The makefiles that look for the kernel headers use ../../../../usr/include,
which probably isn't what you want for an out of tree build.
Maybe we should do something like the below.
It allows you to do:
$ make O=~/work/build/ headers_install
$ ls ~/work/build/usr/include/
asm/ asm-generic/ drm/ linux/ misc/ mtd/ rdma/ scsi/ sound/ uapi/ video/ xen/
$ ls usr/include
ls: cannot access usr/include: No such file or directory
$ make -C tools/testing/selftests KERNEL_HEADERS=~/work/build/usr/include/ TARGEST=vm
$ ls tools/testing/selftests/vm/userfaultfd
tools/testing/selftests/vm/userfaultfd*
cheers
diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile
index 8922c2155a47..617a76be3889 100644
--- a/tools/testing/selftests/Makefile
+++ b/tools/testing/selftests/Makefile
@@ -41,6 +41,9 @@ override LDFLAGS =
override MAKEFLAGS =
endif
+KERNEL_HEADERS ?= $(abspath ../../../usr/include)
+export KERNEL_HEADERS
+
all:
for TARGET in $(TARGETS); do \
make -C $$TARGET; \
diff --git a/tools/testing/selftests/vm/Makefile b/tools/testing/selftests/vm/Makefile
index e4bb1de1d526..4f45b9c8dd75 100644
--- a/tools/testing/selftests/vm/Makefile
+++ b/tools/testing/selftests/vm/Makefile
@@ -1,6 +1,6 @@
# Makefile for vm selftests
-CFLAGS = -Wall -I ../../../../usr/include $(EXTRA_CFLAGS)
+CFLAGS = -Wall -I $(KERNEL_HEADERS) $(EXTRA_CFLAGS)
BINARIES = compaction_test
BINARIES += hugepage-mmap
BINARIES += hugepage-shm
@@ -14,12 +14,9 @@ BINARIES += userfaultfd
all: $(BINARIES)
%: %.c
$(CC) $(CFLAGS) -o $@ $^ -lrt
-userfaultfd: userfaultfd.c ../../../../usr/include/linux/kernel.h
+userfaultfd: userfaultfd.c $(KERNEL_HEADERS)/linux/kernel.h
$(CC) $(CFLAGS) -O2 -o $@ $< -lpthread
-../../../../usr/include/linux/kernel.h:
- make -C ../../../.. headers_install
-
TEST_PROGS := run_vmtests
TEST_FILES := $(BINARIES)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH 0/2] selftests/userfaultfd: fix build Andre Przywara <andre.przywara@arm.com> - 2015-09-22 12:50 +0200
[PATCH 1/2] userfaultfd: remove kernel header include from uapi header Andre Przywara <andre.przywara@arm.com> - 2015-09-22 12:50 +0200
[PATCH 2/2] selftests/userfaultfd: improve syscall number definition Andre Przywara <andre.przywara@arm.com> - 2015-09-22 12:50 +0200
Re: [PATCH 2/2] selftests/userfaultfd: improve syscall number definition Shuah Khan <shuahkh@osg.samsung.com> - 2015-09-22 15:50 +0200
Re: [PATCH 2/2] selftests/userfaultfd: improve syscall number definition Andrea Arcangeli <aarcange@redhat.com> - 2015-09-22 16:10 +0200
Re: [PATCH 2/2] selftests/userfaultfd: improve syscall number definition Andre Przywara <andre.przywara@arm.com> - 2015-09-22 19:20 +0200
Re: [PATCH 2/2] selftests/userfaultfd: improve syscall number definition Michael Ellerman <mpe@ellerman.id.au> - 2015-09-23 12:00 +0200
Re: [PATCH 2/2] selftests/userfaultfd: improve syscall number definition Andre Przywara <andre.przywara@arm.com> - 2015-09-23 15:20 +0200
Re: [PATCH 2/2] selftests/userfaultfd: improve syscall number definition Michael Ellerman <mpe@ellerman.id.au> - 2015-09-24 04:10 +0200
csiph-web