All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] selftests/mlock2: Build warning fixes on Debian/m68k 4.0
@ 2015-11-09 10:14 Geert Uytterhoeven
  2015-11-09 10:14   ` Geert Uytterhoeven
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Geert Uytterhoeven @ 2015-11-09 10:14 UTC (permalink / raw)
  To: Eric B Munson, Thierry Reding, Andrew Morton, Shuah Khan
  Cc: linux-api, linux-kernel, Geert Uytterhoeven

	Hi,

The following 2 patches are needed to fix build warnings on Debian/m68k
4.0.

However, after wiring up the mlock2 syscall, the test fails with:

# ./mlock2-tests
fread kpageflags: Success
# 

as the fread() call returns 0, not 1.

The original commit description for the test said "Note that the limit
test needs to be run a normal user.". But running it as a non-root user
also fails:

$ ./mlock2-tests 
fopen kpageflags: Permission denied
$ ls -l /proc/kpageflags 
-r-------- 1 root root 0 Nov  9 11:05 /proc/kpageflags
$

What am I missing?

Thanks!

Geert Uytterhoeven (2):
  selftests/mlock2: Add missing #define _GNU_SOURCE
  selftests/mlock2: Add ULL prefix to 64-bit constants

 tools/testing/selftests/vm/mlock2-tests.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

-- 
1.9.1

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 1/2] selftests/mlock2: Add missing #define _GNU_SOURCE
@ 2015-11-09 10:14   ` Geert Uytterhoeven
  0 siblings, 0 replies; 14+ messages in thread
From: Geert Uytterhoeven @ 2015-11-09 10:14 UTC (permalink / raw)
  To: Eric B Munson, Thierry Reding, Andrew Morton, Shuah Khan
  Cc: linux-api, linux-kernel, Geert Uytterhoeven

On glibc 2.3.6:

    mlock2-tests.c: In function 'seek_to_smaps_entry':
    mlock2-tests.c:158: warning: implicit declaration of function 'getline'

According to the manpage of getline(), it needs _GNU_SOURCE before glibc
2.10.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
 tools/testing/selftests/vm/mlock2-tests.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/testing/selftests/vm/mlock2-tests.c b/tools/testing/selftests/vm/mlock2-tests.c
index 4431994aade2ef6f..cb247219f1f72889 100644
--- a/tools/testing/selftests/vm/mlock2-tests.c
+++ b/tools/testing/selftests/vm/mlock2-tests.c
@@ -1,3 +1,4 @@
+#define _GNU_SOURCE
 #include <sys/mman.h>
 #include <stdint.h>
 #include <stdio.h>
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 1/2] selftests/mlock2: Add missing #define _GNU_SOURCE
@ 2015-11-09 10:14   ` Geert Uytterhoeven
  0 siblings, 0 replies; 14+ messages in thread
From: Geert Uytterhoeven @ 2015-11-09 10:14 UTC (permalink / raw)
  To: Eric B Munson, Thierry Reding, Andrew Morton, Shuah Khan
  Cc: linux-api-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Geert Uytterhoeven

On glibc 2.3.6:

    mlock2-tests.c: In function 'seek_to_smaps_entry':
    mlock2-tests.c:158: warning: implicit declaration of function 'getline'

According to the manpage of getline(), it needs _GNU_SOURCE before glibc
2.10.

Signed-off-by: Geert Uytterhoeven <geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org>
---
 tools/testing/selftests/vm/mlock2-tests.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/testing/selftests/vm/mlock2-tests.c b/tools/testing/selftests/vm/mlock2-tests.c
index 4431994aade2ef6f..cb247219f1f72889 100644
--- a/tools/testing/selftests/vm/mlock2-tests.c
+++ b/tools/testing/selftests/vm/mlock2-tests.c
@@ -1,3 +1,4 @@
+#define _GNU_SOURCE
 #include <sys/mman.h>
 #include <stdint.h>
 #include <stdio.h>
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 2/2] selftests/mlock2: Add ULL prefix to 64-bit constants
  2015-11-09 10:14 [PATCH 0/2] selftests/mlock2: Build warning fixes on Debian/m68k 4.0 Geert Uytterhoeven
  2015-11-09 10:14   ` Geert Uytterhoeven
@ 2015-11-09 10:14 ` Geert Uytterhoeven
  2015-11-09 15:50     ` Eric B Munson
  2015-11-09 15:48   ` Eric B Munson
  2 siblings, 1 reply; 14+ messages in thread
From: Geert Uytterhoeven @ 2015-11-09 10:14 UTC (permalink / raw)
  To: Eric B Munson, Thierry Reding, Andrew Morton, Shuah Khan
  Cc: linux-api, linux-kernel, Geert Uytterhoeven

On 32-bit (e.g. m68k):

mlock2-tests.c: In function 'lock_check':
mlock2-tests.c:293: warning: integer constant is too large for 'long' type
mlock2-tests.c:294: warning: integer constant is too large for 'long' type
mlock2-tests.c:299: warning: integer constant is too large for 'long' type
mlock2-tests.c:300: warning: integer constant is too large for 'long' type
mlock2-tests.c: In function 'unlock_lock_check':
mlock2-tests.c:329: warning: integer constant is too large for 'long' type
mlock2-tests.c:330: warning: integer constant is too large for 'long' type
mlock2-tests.c: In function 'onfault_check':
mlock2-tests.c:398: warning: integer constant is too large for 'long' type
mlock2-tests.c:398: warning: integer constant is too large for 'long' type
mlock2-tests.c:408: warning: integer constant is too large for 'long' type
mlock2-tests.c:411: warning: integer constant is too large for 'long' type
mlock2-tests.c:416: warning: integer constant is too large for 'long' type
mlock2-tests.c: In function 'unlock_onfault_check':
mlock2-tests.c:443: warning: integer constant is too large for 'long' type
mlock2-tests.c: In function 'test_lock_onfault_of_present':
mlock2-tests.c:528: warning: integer constant is too large for 'long' type
mlock2-tests.c:529: warning: integer constant is too large for 'long' type

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
 tools/testing/selftests/vm/mlock2-tests.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/vm/mlock2-tests.c b/tools/testing/selftests/vm/mlock2-tests.c
index cb247219f1f72889..02ca5e0177c539c7 100644
--- a/tools/testing/selftests/vm/mlock2-tests.c
+++ b/tools/testing/selftests/vm/mlock2-tests.c
@@ -277,8 +277,8 @@ out:
 	return ret;
 }
 
-#define PRESENT_BIT     0x8000000000000000
-#define PFN_MASK        0x007FFFFFFFFFFFFF
+#define PRESENT_BIT     0x8000000000000000ULL
+#define PFN_MASK        0x007FFFFFFFFFFFFFULL
 #define UNEVICTABLE_BIT (1UL << 18)
 
 static int lock_check(char *map)
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH 0/2] selftests/mlock2: Build warning fixes on Debian/m68k 4.0
@ 2015-11-09 15:48   ` Eric B Munson
  0 siblings, 0 replies; 14+ messages in thread
From: Eric B Munson @ 2015-11-09 15:48 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Thierry Reding, Andrew Morton, Shuah Khan, linux-api, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1822 bytes --]

On Mon, 09 Nov 2015, Geert Uytterhoeven wrote:

> 	Hi,
> 
> The following 2 patches are needed to fix build warnings on Debian/m68k
> 4.0.
> 
> However, after wiring up the mlock2 syscall, the test fails with:
> 
> # ./mlock2-tests
> fread kpageflags: Success
> # 
> 
> as the fread() call returns 0, not 1.

This would fail is the index into the kpageflags file is not being
calculated properly.  This tests works on x86_64 (I am in the process of
testing x86 incase this is a 32bit issue).  I am fairly sure that I
tested it on x86, but it has been a while.

> 
> The original commit description for the test said "Note that the limit
> test needs to be run a normal user.". But running it as a non-root user
> also fails:

The original commit says that the on-fault-limit test needs to be run as
a regular user becuase it relies on enforcing memory limits.
mlock2-tests has to be run as root to get access to the various files
under /proc it needs to verify things are working.

> 
> $ ./mlock2-tests 
> fopen kpageflags: Permission denied
> $ ls -l /proc/kpageflags 
> -r-------- 1 root root 0 Nov  9 11:05 /proc/kpageflags
> $
> 
> What am I missing?
> 
> Thanks!
> 
> Geert Uytterhoeven (2):
>   selftests/mlock2: Add missing #define _GNU_SOURCE
>   selftests/mlock2: Add ULL prefix to 64-bit constants
> 
>  tools/testing/selftests/vm/mlock2-tests.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> -- 
> 1.9.1
> 
> Gr{oetje,eeting}s,
> 
> 						Geert
> 
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
> 
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
> 							    -- Linus Torvalds

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 0/2] selftests/mlock2: Build warning fixes on Debian/m68k 4.0
@ 2015-11-09 15:48   ` Eric B Munson
  0 siblings, 0 replies; 14+ messages in thread
From: Eric B Munson @ 2015-11-09 15:48 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Thierry Reding, Andrew Morton, Shuah Khan,
	linux-api-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: Type: text/plain, Size: 1822 bytes --]

On Mon, 09 Nov 2015, Geert Uytterhoeven wrote:

> 	Hi,
> 
> The following 2 patches are needed to fix build warnings on Debian/m68k
> 4.0.
> 
> However, after wiring up the mlock2 syscall, the test fails with:
> 
> # ./mlock2-tests
> fread kpageflags: Success
> # 
> 
> as the fread() call returns 0, not 1.

This would fail is the index into the kpageflags file is not being
calculated properly.  This tests works on x86_64 (I am in the process of
testing x86 incase this is a 32bit issue).  I am fairly sure that I
tested it on x86, but it has been a while.

> 
> The original commit description for the test said "Note that the limit
> test needs to be run a normal user.". But running it as a non-root user
> also fails:

The original commit says that the on-fault-limit test needs to be run as
a regular user becuase it relies on enforcing memory limits.
mlock2-tests has to be run as root to get access to the various files
under /proc it needs to verify things are working.

> 
> $ ./mlock2-tests 
> fopen kpageflags: Permission denied
> $ ls -l /proc/kpageflags 
> -r-------- 1 root root 0 Nov  9 11:05 /proc/kpageflags
> $
> 
> What am I missing?
> 
> Thanks!
> 
> Geert Uytterhoeven (2):
>   selftests/mlock2: Add missing #define _GNU_SOURCE
>   selftests/mlock2: Add ULL prefix to 64-bit constants
> 
>  tools/testing/selftests/vm/mlock2-tests.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> -- 
> 1.9.1
> 
> Gr{oetje,eeting}s,
> 
> 						Geert
> 
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
> 
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
> 							    -- Linus Torvalds

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/2] selftests/mlock2: Add missing #define _GNU_SOURCE
@ 2015-11-09 15:50     ` Eric B Munson
  0 siblings, 0 replies; 14+ messages in thread
From: Eric B Munson @ 2015-11-09 15:50 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Thierry Reding, Andrew Morton, Shuah Khan, linux-api, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 902 bytes --]

On Mon, 09 Nov 2015, Geert Uytterhoeven wrote:

> On glibc 2.3.6:
> 
>     mlock2-tests.c: In function 'seek_to_smaps_entry':
>     mlock2-tests.c:158: warning: implicit declaration of function 'getline'
> 
> According to the manpage of getline(), it needs _GNU_SOURCE before glibc
> 2.10.
> 
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>

Acked-by: Eric B Munson <emunson@akamai.com>

> ---
>  tools/testing/selftests/vm/mlock2-tests.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/tools/testing/selftests/vm/mlock2-tests.c b/tools/testing/selftests/vm/mlock2-tests.c
> index 4431994aade2ef6f..cb247219f1f72889 100644
> --- a/tools/testing/selftests/vm/mlock2-tests.c
> +++ b/tools/testing/selftests/vm/mlock2-tests.c
> @@ -1,3 +1,4 @@
> +#define _GNU_SOURCE
>  #include <sys/mman.h>
>  #include <stdint.h>
>  #include <stdio.h>
> -- 
> 1.9.1
> 

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/2] selftests/mlock2: Add missing #define _GNU_SOURCE
@ 2015-11-09 15:50     ` Eric B Munson
  0 siblings, 0 replies; 14+ messages in thread
From: Eric B Munson @ 2015-11-09 15:50 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Thierry Reding, Andrew Morton, Shuah Khan,
	linux-api-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: Type: text/plain, Size: 956 bytes --]

On Mon, 09 Nov 2015, Geert Uytterhoeven wrote:

> On glibc 2.3.6:
> 
>     mlock2-tests.c: In function 'seek_to_smaps_entry':
>     mlock2-tests.c:158: warning: implicit declaration of function 'getline'
> 
> According to the manpage of getline(), it needs _GNU_SOURCE before glibc
> 2.10.
> 
> Signed-off-by: Geert Uytterhoeven <geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org>

Acked-by: Eric B Munson <emunson-JqFfY2XvxFXQT0dZR+AlfA@public.gmane.org>

> ---
>  tools/testing/selftests/vm/mlock2-tests.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/tools/testing/selftests/vm/mlock2-tests.c b/tools/testing/selftests/vm/mlock2-tests.c
> index 4431994aade2ef6f..cb247219f1f72889 100644
> --- a/tools/testing/selftests/vm/mlock2-tests.c
> +++ b/tools/testing/selftests/vm/mlock2-tests.c
> @@ -1,3 +1,4 @@
> +#define _GNU_SOURCE
>  #include <sys/mman.h>
>  #include <stdint.h>
>  #include <stdio.h>
> -- 
> 1.9.1
> 

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/2] selftests/mlock2: Add ULL prefix to 64-bit constants
@ 2015-11-09 15:50     ` Eric B Munson
  0 siblings, 0 replies; 14+ messages in thread
From: Eric B Munson @ 2015-11-09 15:50 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Thierry Reding, Andrew Morton, Shuah Khan, linux-api, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 2274 bytes --]

On Mon, 09 Nov 2015, Geert Uytterhoeven wrote:

> On 32-bit (e.g. m68k):
> 
> mlock2-tests.c: In function 'lock_check':
> mlock2-tests.c:293: warning: integer constant is too large for 'long' type
> mlock2-tests.c:294: warning: integer constant is too large for 'long' type
> mlock2-tests.c:299: warning: integer constant is too large for 'long' type
> mlock2-tests.c:300: warning: integer constant is too large for 'long' type
> mlock2-tests.c: In function 'unlock_lock_check':
> mlock2-tests.c:329: warning: integer constant is too large for 'long' type
> mlock2-tests.c:330: warning: integer constant is too large for 'long' type
> mlock2-tests.c: In function 'onfault_check':
> mlock2-tests.c:398: warning: integer constant is too large for 'long' type
> mlock2-tests.c:398: warning: integer constant is too large for 'long' type
> mlock2-tests.c:408: warning: integer constant is too large for 'long' type
> mlock2-tests.c:411: warning: integer constant is too large for 'long' type
> mlock2-tests.c:416: warning: integer constant is too large for 'long' type
> mlock2-tests.c: In function 'unlock_onfault_check':
> mlock2-tests.c:443: warning: integer constant is too large for 'long' type
> mlock2-tests.c: In function 'test_lock_onfault_of_present':
> mlock2-tests.c:528: warning: integer constant is too large for 'long' type
> mlock2-tests.c:529: warning: integer constant is too large for 'long' type
> 
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>

Acked-by: Eric B Munson <emunson@akamai.com>

> ---
>  tools/testing/selftests/vm/mlock2-tests.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/testing/selftests/vm/mlock2-tests.c b/tools/testing/selftests/vm/mlock2-tests.c
> index cb247219f1f72889..02ca5e0177c539c7 100644
> --- a/tools/testing/selftests/vm/mlock2-tests.c
> +++ b/tools/testing/selftests/vm/mlock2-tests.c
> @@ -277,8 +277,8 @@ out:
>  	return ret;
>  }
>  
> -#define PRESENT_BIT     0x8000000000000000
> -#define PFN_MASK        0x007FFFFFFFFFFFFF
> +#define PRESENT_BIT     0x8000000000000000ULL
> +#define PFN_MASK        0x007FFFFFFFFFFFFFULL
>  #define UNEVICTABLE_BIT (1UL << 18)
>  
>  static int lock_check(char *map)
> -- 
> 1.9.1
> 

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/2] selftests/mlock2: Add ULL prefix to 64-bit constants
@ 2015-11-09 15:50     ` Eric B Munson
  0 siblings, 0 replies; 14+ messages in thread
From: Eric B Munson @ 2015-11-09 15:50 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Thierry Reding, Andrew Morton, Shuah Khan,
	linux-api-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: Type: text/plain, Size: 2328 bytes --]

On Mon, 09 Nov 2015, Geert Uytterhoeven wrote:

> On 32-bit (e.g. m68k):
> 
> mlock2-tests.c: In function 'lock_check':
> mlock2-tests.c:293: warning: integer constant is too large for 'long' type
> mlock2-tests.c:294: warning: integer constant is too large for 'long' type
> mlock2-tests.c:299: warning: integer constant is too large for 'long' type
> mlock2-tests.c:300: warning: integer constant is too large for 'long' type
> mlock2-tests.c: In function 'unlock_lock_check':
> mlock2-tests.c:329: warning: integer constant is too large for 'long' type
> mlock2-tests.c:330: warning: integer constant is too large for 'long' type
> mlock2-tests.c: In function 'onfault_check':
> mlock2-tests.c:398: warning: integer constant is too large for 'long' type
> mlock2-tests.c:398: warning: integer constant is too large for 'long' type
> mlock2-tests.c:408: warning: integer constant is too large for 'long' type
> mlock2-tests.c:411: warning: integer constant is too large for 'long' type
> mlock2-tests.c:416: warning: integer constant is too large for 'long' type
> mlock2-tests.c: In function 'unlock_onfault_check':
> mlock2-tests.c:443: warning: integer constant is too large for 'long' type
> mlock2-tests.c: In function 'test_lock_onfault_of_present':
> mlock2-tests.c:528: warning: integer constant is too large for 'long' type
> mlock2-tests.c:529: warning: integer constant is too large for 'long' type
> 
> Signed-off-by: Geert Uytterhoeven <geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org>

Acked-by: Eric B Munson <emunson-JqFfY2XvxFXQT0dZR+AlfA@public.gmane.org>

> ---
>  tools/testing/selftests/vm/mlock2-tests.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/testing/selftests/vm/mlock2-tests.c b/tools/testing/selftests/vm/mlock2-tests.c
> index cb247219f1f72889..02ca5e0177c539c7 100644
> --- a/tools/testing/selftests/vm/mlock2-tests.c
> +++ b/tools/testing/selftests/vm/mlock2-tests.c
> @@ -277,8 +277,8 @@ out:
>  	return ret;
>  }
>  
> -#define PRESENT_BIT     0x8000000000000000
> -#define PFN_MASK        0x007FFFFFFFFFFFFF
> +#define PRESENT_BIT     0x8000000000000000ULL
> +#define PFN_MASK        0x007FFFFFFFFFFFFFULL
>  #define UNEVICTABLE_BIT (1UL << 18)
>  
>  static int lock_check(char *map)
> -- 
> 1.9.1
> 

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 0/2] selftests/mlock2: Build warning fixes on Debian/m68k 4.0
@ 2015-11-09 16:16     ` Eric B Munson
  0 siblings, 0 replies; 14+ messages in thread
From: Eric B Munson @ 2015-11-09 16:16 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Thierry Reding, Andrew Morton, Shuah Khan, linux-api, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 2133 bytes --]

On Mon, 09 Nov 2015, Eric B Munson wrote:

> On Mon, 09 Nov 2015, Geert Uytterhoeven wrote:
> 
> > 	Hi,
> > 
> > The following 2 patches are needed to fix build warnings on Debian/m68k
> > 4.0.
> > 
> > However, after wiring up the mlock2 syscall, the test fails with:
> > 
> > # ./mlock2-tests
> > fread kpageflags: Success
> > # 
> > 
> > as the fread() call returns 0, not 1.
> 
> This would fail is the index into the kpageflags file is not being
> calculated properly.  This tests works on x86_64 (I am in the process of
> testing x86 incase this is a 32bit issue).  I am fairly sure that I
> tested it on x86, but it has been a while.

I can confirm that this test works on x86 as well as x86_64.
Unfortunately, I do not have access to m68k hardware to help debug this.

> 
> > 
> > The original commit description for the test said "Note that the limit
> > test needs to be run a normal user.". But running it as a non-root user
> > also fails:
> 
> The original commit says that the on-fault-limit test needs to be run as
> a regular user becuase it relies on enforcing memory limits.
> mlock2-tests has to be run as root to get access to the various files
> under /proc it needs to verify things are working.
> 
> > 
> > $ ./mlock2-tests 
> > fopen kpageflags: Permission denied
> > $ ls -l /proc/kpageflags 
> > -r-------- 1 root root 0 Nov  9 11:05 /proc/kpageflags
> > $
> > 
> > What am I missing?
> > 
> > Thanks!
> > 
> > Geert Uytterhoeven (2):
> >   selftests/mlock2: Add missing #define _GNU_SOURCE
> >   selftests/mlock2: Add ULL prefix to 64-bit constants
> > 
> >  tools/testing/selftests/vm/mlock2-tests.c | 5 +++--
> >  1 file changed, 3 insertions(+), 2 deletions(-)
> > 
> > -- 
> > 1.9.1
> > 
> > Gr{oetje,eeting}s,
> > 
> > 						Geert
> > 
> > --
> > Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
> > 
> > In personal conversations with technical people, I call myself a hacker. But
> > when I'm talking to journalists I just say "programmer" or something like that.
> > 							    -- Linus Torvalds



[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 0/2] selftests/mlock2: Build warning fixes on Debian/m68k 4.0
@ 2015-11-09 16:16     ` Eric B Munson
  0 siblings, 0 replies; 14+ messages in thread
From: Eric B Munson @ 2015-11-09 16:16 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Thierry Reding, Andrew Morton, Shuah Khan,
	linux-api-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: Type: text/plain, Size: 2133 bytes --]

On Mon, 09 Nov 2015, Eric B Munson wrote:

> On Mon, 09 Nov 2015, Geert Uytterhoeven wrote:
> 
> > 	Hi,
> > 
> > The following 2 patches are needed to fix build warnings on Debian/m68k
> > 4.0.
> > 
> > However, after wiring up the mlock2 syscall, the test fails with:
> > 
> > # ./mlock2-tests
> > fread kpageflags: Success
> > # 
> > 
> > as the fread() call returns 0, not 1.
> 
> This would fail is the index into the kpageflags file is not being
> calculated properly.  This tests works on x86_64 (I am in the process of
> testing x86 incase this is a 32bit issue).  I am fairly sure that I
> tested it on x86, but it has been a while.

I can confirm that this test works on x86 as well as x86_64.
Unfortunately, I do not have access to m68k hardware to help debug this.

> 
> > 
> > The original commit description for the test said "Note that the limit
> > test needs to be run a normal user.". But running it as a non-root user
> > also fails:
> 
> The original commit says that the on-fault-limit test needs to be run as
> a regular user becuase it relies on enforcing memory limits.
> mlock2-tests has to be run as root to get access to the various files
> under /proc it needs to verify things are working.
> 
> > 
> > $ ./mlock2-tests 
> > fopen kpageflags: Permission denied
> > $ ls -l /proc/kpageflags 
> > -r-------- 1 root root 0 Nov  9 11:05 /proc/kpageflags
> > $
> > 
> > What am I missing?
> > 
> > Thanks!
> > 
> > Geert Uytterhoeven (2):
> >   selftests/mlock2: Add missing #define _GNU_SOURCE
> >   selftests/mlock2: Add ULL prefix to 64-bit constants
> > 
> >  tools/testing/selftests/vm/mlock2-tests.c | 5 +++--
> >  1 file changed, 3 insertions(+), 2 deletions(-)
> > 
> > -- 
> > 1.9.1
> > 
> > Gr{oetje,eeting}s,
> > 
> > 						Geert
> > 
> > --
> > Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
> > 
> > In personal conversations with technical people, I call myself a hacker. But
> > when I'm talking to journalists I just say "programmer" or something like that.
> > 							    -- Linus Torvalds



[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 0/2] selftests/mlock2: Build warning fixes on Debian/m68k 4.0
@ 2015-11-09 20:43     ` Geert Uytterhoeven
  0 siblings, 0 replies; 14+ messages in thread
From: Geert Uytterhoeven @ 2015-11-09 20:43 UTC (permalink / raw)
  To: Eric B Munson
  Cc: Thierry Reding, Andrew Morton, Shuah Khan, linux-api,
	linux-kernel, Linux-Arch

Hi Eric,

[CC linux-arch for more architecture-specific breakage]

On Mon, Nov 9, 2015 at 4:48 PM, Eric B Munson <emunson@akamai.com> wrote:
> On Mon, 09 Nov 2015, Geert Uytterhoeven wrote:
>> The following 2 patches are needed to fix build warnings on Debian/m68k
>> 4.0.
>>
>> However, after wiring up the mlock2 syscall, the test fails with:
>>
>> # ./mlock2-tests
>> fread kpageflags: Success
>> #
>>
>> as the fread() call returns 0, not 1.
>
> This would fail is the index into the kpageflags file is not being
> calculated properly.  This tests works on x86_64 (I am in the process of
> testing x86 incase this is a 32bit issue).  I am fairly sure that I
> tested it on x86, but it has been a while.

Found it: /proc/kpageflags is always empty, as m68k doesn't set up max_pfn.

After fixing that, the test is working fine.
Funny how we managed to survive that long without setting it ;-)

Note that several other architectures also don't set max_pfn. Some may
be nommu, and are thus not affected, but others probably are:

    hexagon
    mn10300
    nios2
    score

And a few of the others (e.g. avr32, didn't check all of them) assign to a
local max_pfn variable instead of the global one, so it won't work on those
neither.

>> The original commit description for the test said "Note that the limit
>> test needs to be run a normal user.". But running it as a non-root user
>> also fails:
>
> The original commit says that the on-fault-limit test needs to be run as
> a regular user becuase it relies on enforcing memory limits.
> mlock2-tests has to be run as root to get access to the various files
> under /proc it needs to verify things are working.

Ah, I just used "git log -p" on mlock2-tests.c, and didn't notice the commit
actually added two tests.

Thanks!

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 0/2] selftests/mlock2: Build warning fixes on Debian/m68k 4.0
@ 2015-11-09 20:43     ` Geert Uytterhoeven
  0 siblings, 0 replies; 14+ messages in thread
From: Geert Uytterhoeven @ 2015-11-09 20:43 UTC (permalink / raw)
  To: Eric B Munson
  Cc: Thierry Reding, Andrew Morton, Shuah Khan,
	linux-api-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Linux-Arch

Hi Eric,

[CC linux-arch for more architecture-specific breakage]

On Mon, Nov 9, 2015 at 4:48 PM, Eric B Munson <emunson-JqFfY2XvxFXQT0dZR+AlfA@public.gmane.org> wrote:
> On Mon, 09 Nov 2015, Geert Uytterhoeven wrote:
>> The following 2 patches are needed to fix build warnings on Debian/m68k
>> 4.0.
>>
>> However, after wiring up the mlock2 syscall, the test fails with:
>>
>> # ./mlock2-tests
>> fread kpageflags: Success
>> #
>>
>> as the fread() call returns 0, not 1.
>
> This would fail is the index into the kpageflags file is not being
> calculated properly.  This tests works on x86_64 (I am in the process of
> testing x86 incase this is a 32bit issue).  I am fairly sure that I
> tested it on x86, but it has been a while.

Found it: /proc/kpageflags is always empty, as m68k doesn't set up max_pfn.

After fixing that, the test is working fine.
Funny how we managed to survive that long without setting it ;-)

Note that several other architectures also don't set max_pfn. Some may
be nommu, and are thus not affected, but others probably are:

    hexagon
    mn10300
    nios2
    score

And a few of the others (e.g. avr32, didn't check all of them) assign to a
local max_pfn variable instead of the global one, so it won't work on those
neither.

>> The original commit description for the test said "Note that the limit
>> test needs to be run a normal user.". But running it as a non-root user
>> also fails:
>
> The original commit says that the on-fault-limit test needs to be run as
> a regular user becuase it relies on enforcing memory limits.
> mlock2-tests has to be run as root to get access to the various files
> under /proc it needs to verify things are working.

Ah, I just used "git log -p" on mlock2-tests.c, and didn't notice the commit
actually added two tests.

Thanks!

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2015-11-09 20:43 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-09 10:14 [PATCH 0/2] selftests/mlock2: Build warning fixes on Debian/m68k 4.0 Geert Uytterhoeven
2015-11-09 10:14 ` [PATCH 1/2] selftests/mlock2: Add missing #define _GNU_SOURCE Geert Uytterhoeven
2015-11-09 10:14   ` Geert Uytterhoeven
2015-11-09 15:50   ` Eric B Munson
2015-11-09 15:50     ` Eric B Munson
2015-11-09 10:14 ` [PATCH 2/2] selftests/mlock2: Add ULL prefix to 64-bit constants Geert Uytterhoeven
2015-11-09 15:50   ` Eric B Munson
2015-11-09 15:50     ` Eric B Munson
2015-11-09 15:48 ` [PATCH 0/2] selftests/mlock2: Build warning fixes on Debian/m68k 4.0 Eric B Munson
2015-11-09 15:48   ` Eric B Munson
2015-11-09 16:16   ` Eric B Munson
2015-11-09 16:16     ` Eric B Munson
2015-11-09 20:43   ` Geert Uytterhoeven
2015-11-09 20:43     ` Geert Uytterhoeven

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.