2014-12-02 05:52:24

by Michael Ellerman

[permalink] [raw]
Subject: [PATCH 1/3] kcmp: Move kcmp.h into uapi

kcmp.h appears to be part of the API, it's documented in kcmp(2), and
the selftests/kcmp code uses it. So move it to uapi so it's actually
exported.

Signed-off-by: Michael Ellerman <[email protected]>
---
include/linux/kcmp.h | 17 -----------------
include/uapi/linux/Kbuild | 1 +
include/uapi/linux/kcmp.h | 17 +++++++++++++++++
3 files changed, 18 insertions(+), 17 deletions(-)
delete mode 100644 include/linux/kcmp.h
create mode 100644 include/uapi/linux/kcmp.h

diff --git a/include/linux/kcmp.h b/include/linux/kcmp.h
deleted file mode 100644
index 2dcd1b3aafc8..000000000000
--- a/include/linux/kcmp.h
+++ /dev/null
@@ -1,17 +0,0 @@
-#ifndef _LINUX_KCMP_H
-#define _LINUX_KCMP_H
-
-/* Comparison type */
-enum kcmp_type {
- KCMP_FILE,
- KCMP_VM,
- KCMP_FILES,
- KCMP_FS,
- KCMP_SIGHAND,
- KCMP_IO,
- KCMP_SYSVSEM,
-
- KCMP_TYPES,
-};
-
-#endif /* _LINUX_KCMP_H */
diff --git a/include/uapi/linux/Kbuild b/include/uapi/linux/Kbuild
index 4c94f31a8c99..a7b3071c03f2 100644
--- a/include/uapi/linux/Kbuild
+++ b/include/uapi/linux/Kbuild
@@ -211,6 +211,7 @@ header-y += ivtvfb.h
header-y += ixjuser.h
header-y += jffs2.h
header-y += joystick.h
+header-y += kcmp.h
header-y += kd.h
header-y += kdev_t.h
header-y += kernel-page-flags.h
diff --git a/include/uapi/linux/kcmp.h b/include/uapi/linux/kcmp.h
new file mode 100644
index 000000000000..84df14b37360
--- /dev/null
+++ b/include/uapi/linux/kcmp.h
@@ -0,0 +1,17 @@
+#ifndef _UAPI_LINUX_KCMP_H
+#define _UAPI_LINUX_KCMP_H
+
+/* Comparison type */
+enum kcmp_type {
+ KCMP_FILE,
+ KCMP_VM,
+ KCMP_FILES,
+ KCMP_FS,
+ KCMP_SIGHAND,
+ KCMP_IO,
+ KCMP_SYSVSEM,
+
+ KCMP_TYPES,
+};
+
+#endif /* _UAPI_LINUX_KCMP_H */
--
1.9.1


2014-12-02 05:52:38

by Michael Ellerman

[permalink] [raw]
Subject: [PATCH 3/3] selftests/kcmp: Always try to build the test

Don't prevent the test building on non-x86. Just try and build it and
let the chips fall where they may.

Add support for CROSS_COMPILE while we're at it. Also we don't need a
custom rule for building kcmp_test.

Signed-off-by: Michael Ellerman <[email protected]>
---

eg:
$ uname -m
x86_64
$ make ARCH=powerpc headers_install
CHK include/generated/uapi/linux/version.h
UPD include/generated/uapi/linux/version.h
...
INSTALL usr/include/asm/ (43 files)
$ cd tools/testing/selftests/kcmp/
$ make
ppc64-cc -I../../../../usr/include/ kcmp_test.c -o kcmp_test
$ file kcmp_test
kcmp_test: ELF 32-bit MSB executable, PowerPC or cisco 4500 ...


tools/testing/selftests/kcmp/Makefile | 18 ++----------------
1 file changed, 2 insertions(+), 16 deletions(-)

diff --git a/tools/testing/selftests/kcmp/Makefile b/tools/testing/selftests/kcmp/Makefile
index 4f00c0524501..ff0eefdc6ceb 100644
--- a/tools/testing/selftests/kcmp/Makefile
+++ b/tools/testing/selftests/kcmp/Makefile
@@ -1,21 +1,7 @@
-uname_M := $(shell uname -m 2>/dev/null || echo not)
-ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/i386/)
-ifeq ($(ARCH),i386)
- ARCH := x86
- CFLAGS := -DCONFIG_X86_32 -D__i386__
-endif
-ifeq ($(ARCH),x86_64)
- ARCH := x86
- CFLAGS := -DCONFIG_X86_64 -D__x86_64__
-endif
+CC := $(CROSS_COMPILE)$(CC)
CFLAGS += -I../../../../usr/include/

-all:
-ifeq ($(ARCH),x86)
- gcc $(CFLAGS) kcmp_test.c -o kcmp_test
-else
- echo "Not an x86 target, can't build kcmp selftest"
-endif
+all: kcmp_test

run_tests: all
@./kcmp_test || echo "kcmp_test: [FAIL]"
--
1.9.1

2014-12-02 05:52:52

by Michael Ellerman

[permalink] [raw]
Subject: [PATCH 2/3] selftests/kcmp: Don't include kernel headers

The kcmp test mucks with the include path to bring in the kernel
headers, and x86 headers too for reasons that are not clear.

Now that kcmp.h is exported none of that should be necessary.

Signed-off-by: Michael Ellerman <[email protected]>
Acked-by: Cyrill Gorcunov <[email protected]>
---
tools/testing/selftests/kcmp/Makefile | 4 ----
1 file changed, 4 deletions(-)

diff --git a/tools/testing/selftests/kcmp/Makefile b/tools/testing/selftests/kcmp/Makefile
index 8aabd82db9e4..4f00c0524501 100644
--- a/tools/testing/selftests/kcmp/Makefile
+++ b/tools/testing/selftests/kcmp/Makefile
@@ -8,11 +8,7 @@ ifeq ($(ARCH),x86_64)
ARCH := x86
CFLAGS := -DCONFIG_X86_64 -D__x86_64__
endif
-
-CFLAGS += -I../../../../arch/x86/include/generated/
-CFLAGS += -I../../../../include/
CFLAGS += -I../../../../usr/include/
-CFLAGS += -I../../../../arch/x86/include/

all:
ifeq ($(ARCH),x86)
--
1.9.1

2014-12-02 16:20:45

by Christopher Covington

[permalink] [raw]
Subject: Re: [PATCH 3/3] selftests/kcmp: Always try to build the test

Hi Michael,

On 12/02/2014 12:52 AM, Michael Ellerman wrote:
> Don't prevent the test building on non-x86. Just try and build it and
> let the chips fall where they may.
>
> Add support for CROSS_COMPILE while we're at it. Also we don't need a
> custom rule for building kcmp_test.
>
> Signed-off-by: Michael Ellerman <[email protected]>

For what it's worth, all three patches look good to me.

Reviewed-by: Christopher Covington <[email protected]>

Thanks,
Chris

--
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

2014-12-02 20:59:49

by Shuah Khan

[permalink] [raw]
Subject: Re: [PATCH 3/3] selftests/kcmp: Always try to build the test

On 12/02/2014 09:20 AM, Christopher Covington wrote:
> Hi Michael,
>
> On 12/02/2014 12:52 AM, Michael Ellerman wrote:
>> Don't prevent the test building on non-x86. Just try and build it and
>> let the chips fall where they may.
>>
>> Add support for CROSS_COMPILE while we're at it. Also we don't need a
>> custom rule for building kcmp_test.
>>
>> Signed-off-by: Michael Ellerman <[email protected]>
>
> For what it's worth, all three patches look good to me.
>
> Reviewed-by: Christopher Covington <[email protected]>
>
> Thanks,
> Chris
>

All three patches queued for 3.19 - linux-kselftest.git/ fixes branch

kcmp fails on couple tests it runs when CONFIG_CHECKPOINT_RESTORE
is disabled. However, it isn't bad enough to not include the patch,
especially when there is use for it on arm.

FAIL: 0 expected but -1 returned (Function not implemented)
FAIL: 0 expected but -1 returned (Function not implemented)

-- Shuah


--
Shuah Khan
Sr. Linux Kernel Developer
Samsung Research America (Silicon Valley)
[email protected] | (970) 217-8978