[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1440991580.5735.4.camel@ellerman.id.au>
Date: Mon, 31 Aug 2015 13:26:20 +1000
From: Michael Ellerman <mpe@...erman.id.au>
To: Bamvor Jian Zhang <bamvor.zhangjian@...aro.org>
Cc: linux-kernel@...r.kernel.org, broonie@...aro.org,
khilman@...aro.org, tyler.baker@...aro.org, shuahkh@....samsung.com
Subject: Re: [PATCH 6/7] selftests: only compile userfaultfd for x86 and
powperpc
On Fri, 2015-08-14 at 21:43 +0800, Bamvor Jian Zhang wrote:
> Signed-off-by: Bamvor Jian Zhang <bamvor.zhangjian@...aro.org>
> ---
> tools/testing/selftests/vm/Makefile | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/tools/testing/selftests/vm/Makefile b/tools/testing/selftests/vm/Makefile
> index bb888c6..4dd6e4f 100644
> --- a/tools/testing/selftests/vm/Makefile
> +++ b/tools/testing/selftests/vm/Makefile
> @@ -1,5 +1,15 @@
> # Makefile for vm selftests
>
> +uname_M := $(shell uname -m 2>/dev/null || echo not)
> +ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/i386/ -e s/ppc.*/powerpc/)
> +
> +ifeq ($(ARCH),powerpc)
> +support_userfaultfd = yes
> +endif
> +ifeq ($(ARCH),x86)
> +support_userfaultfd = yes
> +endif
> +
> CFLAGS = -Wall
> BINARIES = compaction_test
> BINARIES += hugepage-mmap
> @@ -9,7 +19,9 @@ BINARIES += mlock2-tests
> BINARIES += on-fault-limit
> BINARIES += thuge-gen
> BINARIES += transhuge-stress
> +ifdef support_userfaultfd
> BINARIES += userfaultfd
> +endif
>
> all: $(BINARIES)
> %: %.c
This is nasty. It means when userfaultfd gets implemented for other arches
someone has to remember to update the logic here, which they won't.
Instead the C program should just do nothing when __NR_userfaultfd is not defined, eg:
#ifdef __NR_userfaultfd
int main(int argc, char **argv)
{
...
}
#else
int main(void)
{
printf("skip: Skipping userfaultfd test\n");
return 0;
}
#endif
This way when the syscall is implemented for other arches the test will just
start working.
cheers
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists