2014-10-23 05:07: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 | 13 +------------
include/uapi/linux/Kbuild | 1 +
include/uapi/linux/kcmp.h | 17 +++++++++++++++++
3 files changed, 19 insertions(+), 12 deletions(-)
create mode 100644 include/uapi/linux/kcmp.h

diff --git a/include/linux/kcmp.h b/include/linux/kcmp.h
index 2dcd1b3aafc8..9dfb23e1771b 100644
--- a/include/linux/kcmp.h
+++ b/include/linux/kcmp.h
@@ -1,17 +1,6 @@
#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,
-};
+#include <uapi/linux/kcmp.h>

#endif /* _LINUX_KCMP_H */
diff --git a/include/uapi/linux/Kbuild b/include/uapi/linux/Kbuild
index b70237e8bc37..1cf50d682dbf 100644
--- a/include/uapi/linux/Kbuild
+++ b/include/uapi/linux/Kbuild
@@ -209,6 +209,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-10-23 05:07:31

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.

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

diff --git a/tools/testing/selftests/kcmp/Makefile b/tools/testing/selftests/kcmp/Makefile
index 4f00c0524501..cda9cc4004c9 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
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

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

2014-10-23 05:07:50

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]>
---
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-10-23 06:04:12

by Cyrill Gorcunov

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

On Thu, Oct 23, 2014 at 04:07:12PM +1100, Michael Ellerman wrote:
> 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]>
Acked-by: Cyrill Gorcunov <[email protected]>

2014-10-23 06:05:28

by Cyrill Gorcunov

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

On Thu, Oct 23, 2014 at 04:07:13PM +1100, Michael Ellerman wrote:
> 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]>

The reason was to be able to run test without userspace headers generated.
Still this one is better I think.

Acked-by: Cyrill Gorcunov <[email protected]>

2014-10-23 06:09:17

by Cyrill Gorcunov

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

On Thu, Oct 23, 2014 at 04:07:14PM +1100, 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.
>
> Signed-off-by: Michael Ellerman <[email protected]>

kcmp depends on checkpoint/restore config symbol which is known
to work on x86 and (iirc) on arm, that's why x86 was only allowed.
I don't mind to such change but not sure.

2014-10-23 07:49:22

by Arnd Bergmann

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

On Thursday 23 October 2014 16:07:12 Michael Ellerman wrote:
> --- a/include/linux/kcmp.h
> +++ b/include/linux/kcmp.h
> @@ -1,17 +1,6 @@
> #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,
> -};
> +#include <uapi/linux/kcmp.h>
>
> #endif /* _LINUX_KCMP_H */
>

If the file is empty except for the uapi include, I think it's better to
delete it completely. The include path logic should ensure we pick the
other one up.

Arnd

2014-10-23 08:15:06

by Cyrill Gorcunov

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

On Thu, Oct 23, 2014 at 09:49:14AM +0200, Arnd Bergmann wrote:
> On Thursday 23 October 2014 16:07:12 Michael Ellerman wrote:
> > --- a/include/linux/kcmp.h
> > +++ b/include/linux/kcmp.h
> > @@ -1,17 +1,6 @@
> > #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,
> > -};
> > +#include <uapi/linux/kcmp.h>
> >
> > #endif /* _LINUX_KCMP_H */
> >
>
> If the file is empty except for the uapi include, I think it's better to
> delete it completely. The include path logic should ensure we pick the
> other one up.

Good point, somehow managed to miss this.

2014-10-23 13:07:03

by Christopher Covington

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

Hi Michael,

On 10/23/2014 01:07 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.

As a user of kcmp via CRIU on arm and arm64, thanks!

> diff --git a/tools/testing/selftests/kcmp/Makefile b/tools/testing/selftests/kcmp/Makefile
> index 4f00c0524501..cda9cc4004c9 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
> CFLAGS += -I../../../../usr/include/
>
> all:
> -ifeq ($(ARCH),x86)
> gcc $(CFLAGS) kcmp_test.c -o kcmp_test

Not that this needs to be addressed in this patch, but this looks broken for
cross compilation. It looks like some of the other selftests use:

CC = $(CROSS_COMPILE)gcc

But perhaps this should be set (and perhaps with ':=') once at the top level.

Chris

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

2014-10-23 13:53:03

by Shuah Khan

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

On 10/23/2014 07:06 AM, Christopher Covington wrote:
> Hi Michael,
>
> On 10/23/2014 01:07 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.
>
> As a user of kcmp via CRIU on arm and arm64, thanks!
>
>> diff --git a/tools/testing/selftests/kcmp/Makefile b/tools/testing/selftests/kcmp/Makefile
>> index 4f00c0524501..cda9cc4004c9 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
>> CFLAGS += -I../../../../usr/include/
>>
>> all:
>> -ifeq ($(ARCH),x86)
>> gcc $(CFLAGS) kcmp_test.c -o kcmp_test
>
> Not that this needs to be addressed in this patch, but this looks broken for
> cross compilation. It looks like some of the other selftests use:
>
> CC = $(CROSS_COMPILE)gcc
>

It makes sense to fix the cross-compile problem now, since
this patch is extending the support to other archs.

thanks,
-- Shuah


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

2014-11-28 02:18:49

by Michael Ellerman

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

On Thu, 2014-10-23 at 16:07 +1100, Michael Ellerman wrote:
> 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.

Looks like this series fell through the cracks?

It still applies on rc6. Should I resend?

cheers

> Signed-off-by: Michael Ellerman <[email protected]>
> ---
> include/linux/kcmp.h | 13 +------------
> include/uapi/linux/Kbuild | 1 +
> include/uapi/linux/kcmp.h | 17 +++++++++++++++++
> 3 files changed, 19 insertions(+), 12 deletions(-)
> create mode 100644 include/uapi/linux/kcmp.h
>
> diff --git a/include/linux/kcmp.h b/include/linux/kcmp.h
> index 2dcd1b3aafc8..9dfb23e1771b 100644
> --- a/include/linux/kcmp.h
> +++ b/include/linux/kcmp.h
> @@ -1,17 +1,6 @@
> #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,
> -};
> +#include <uapi/linux/kcmp.h>
>
> #endif /* _LINUX_KCMP_H */
> diff --git a/include/uapi/linux/Kbuild b/include/uapi/linux/Kbuild
> index b70237e8bc37..1cf50d682dbf 100644
> --- a/include/uapi/linux/Kbuild
> +++ b/include/uapi/linux/Kbuild
> @@ -209,6 +209,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 */



2014-12-01 16:57:41

by Shuah Khan

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

On 10/23/2014 02:14 AM, Cyrill Gorcunov wrote:
> On Thu, Oct 23, 2014 at 09:49:14AM +0200, Arnd Bergmann wrote:
>> On Thursday 23 October 2014 16:07:12 Michael Ellerman wrote:
>>> --- a/include/linux/kcmp.h
>>> +++ b/include/linux/kcmp.h
>>> @@ -1,17 +1,6 @@
>>> #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,
>>> -};
>>> +#include <uapi/linux/kcmp.h>
>>>
>>> #endif /* _LINUX_KCMP_H */
>>>
>>
>> If the file is empty except for the uapi include, I think it's better to
>> delete it completely. The include path logic should ensure we pick the
>> other one up.
>
> Good point, somehow managed to miss this.
>

Michael,

Are you planning to send v2 to address the comments?

-- Shuah

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

2014-12-01 16:58:24

by Shuah Khan

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

On 10/23/2014 07:52 AM, Shuah Khan wrote:
> On 10/23/2014 07:06 AM, Christopher Covington wrote:
>> Hi Michael,
>>
>> On 10/23/2014 01:07 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.
>>
>> As a user of kcmp via CRIU on arm and arm64, thanks!
>>
>>> diff --git a/tools/testing/selftests/kcmp/Makefile b/tools/testing/selftests/kcmp/Makefile
>>> index 4f00c0524501..cda9cc4004c9 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
>>> CFLAGS += -I../../../../usr/include/
>>>
>>> all:
>>> -ifeq ($(ARCH),x86)
>>> gcc $(CFLAGS) kcmp_test.c -o kcmp_test
>>
>> Not that this needs to be addressed in this patch, but this looks broken for
>> cross compilation. It looks like some of the other selftests use:
>>
>> CC = $(CROSS_COMPILE)gcc
>>
>
> It makes sense to fix the cross-compile problem now, since
> this patch is extending the support to other archs.
>
> thanks,
> -- Shuah
>
>

Please address the cross-compile problems in your next patch version.

-- Shuah

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

2014-12-01 17:00:05

by Shuah Khan

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

On 11/27/2014 07:18 PM, Michael Ellerman wrote:
> On Thu, 2014-10-23 at 16:07 +1100, Michael Ellerman wrote:
>> 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.
>
> Looks like this series fell through the cracks?
>
> It still applies on rc6. Should I resend?
>
> cheers
>
>> Signed-off-by: Michael Ellerman <[email protected]>

I am expecting a patch v2 for the series based on the comments
on the series. Please see my responses to the individual patch
threads.

thanks,
-- Shuah


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

2014-12-02 05:36:46

by Michael Ellerman

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

On Mon, 2014-12-01 at 10:00 -0700, Shuah Khan wrote:
> On 11/27/2014 07:18 PM, Michael Ellerman wrote:
> > On Thu, 2014-10-23 at 16:07 +1100, Michael Ellerman wrote:
> >> 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.
> >
> > Looks like this series fell through the cracks?
> >
> > It still applies on rc6. Should I resend?
> >
> > cheers
> >
> >> Signed-off-by: Michael Ellerman <[email protected]>
>
> I am expecting a patch v2 for the series based on the comments
> on the series. Please see my responses to the individual patch
> threads.

Sure, will repost.

cheers

2014-12-02 05:44:06

by Michael Ellerman

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

On Thu, 2014-10-23 at 09:06 -0400, Christopher Covington wrote:
> Hi Michael,
>
> On 10/23/2014 01:07 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.
>
> As a user of kcmp via CRIU on arm and arm64, thanks!
>
> > diff --git a/tools/testing/selftests/kcmp/Makefile b/tools/testing/selftests/kcmp/Makefile
> > index 4f00c0524501..cda9cc4004c9 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
> > CFLAGS += -I../../../../usr/include/
> >
> > all:
> > -ifeq ($(ARCH),x86)
> > gcc $(CFLAGS) kcmp_test.c -o kcmp_test
>
> Not that this needs to be addressed in this patch, but this looks broken for
> cross compilation. It looks like some of the other selftests use:
>
> CC = $(CROSS_COMPILE)gcc
>
> But perhaps this should be set (and perhaps with ':=') once at the top level.

The best solution IMHO is:

CC := $(CROSS_COMPILE)$(CC)

Because it allows cross compiling, but also allows overriding of CC.

Will resend with that change.

cheers

2014-12-02 05:53:57

by Michael Ellerman

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

On Thu, 2014-10-23 at 10:09 +0400, Cyrill Gorcunov wrote:
> On Thu, Oct 23, 2014 at 04:07:14PM +1100, 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.
> >
> > Signed-off-by: Michael Ellerman <[email protected]>
>
> kcmp depends on checkpoint/restore config symbol which is known
> to work on x86 and (iirc) on arm, that's why x86 was only allowed.
> I don't mind to such change but not sure.

Yeah I understand. It's helpful for the other architectures to be able to build
the test, that way we at least know that it's something we should think about
implementing/fixing. If the test doesn't build at all then we just ignore it :)

cheers