Skip to contentSkip to conversation

ltp: typos correction

PATCH New Li Wang 3 participants 10 messages Oct 25, 2017 – Nov 10, 2017 Library code

lore
Share & tools
lore

Li Wang

author
#0 lore raw

PATCH 1/2 ltp: typos correction

---
 include/tst_safe_macros.h                                     | 2 +-
 testcases/kernel/syscalls/clock_nanosleep/clock_nanosleep02.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
include/tst_safe_macros.h +1 -1
index 9562005..ed9c73c 100644
@@ -406,7 +406,7 @@ static inline sighandler_t safe_signal(const char *file, const int lineno,
 #define SAFE_EXECL(file, arg, ...) do {				\
        execl((file), (arg), ##__VA_ARGS__);			\
        tst_brk_(__FILE__, __LINE__, TBROK | TERRNO,		\
-                "execlp(%s, %s, ...) failed", file, arg); 	\
+                "execl(%s, %s, ...) failed", file, arg); 	\
        } while (0)
 
 int safe_getpriority(const char *file, const int lineno, int which, id_t who);
testcases/kernel/syscalls/clock_nanosleep/clock_nanosleep02.c +2 -2
index f114013..f52d853 100644
@@ -36,7 +36,7 @@ int sample_fn(int clk_id, long long usec)
 
 	if (TEST_RETURN != 0) {
 		tst_res(TFAIL | TERRNO,
-			"nanosleep() returned %li", TEST_RETURN);
+			"clock_nanosleep() returned %li", TEST_RETURN);
 		return 1;
 	}
 
@@ -44,6 +44,6 @@ int sample_fn(int clk_id, long long usec)
 }
 
 static struct tst_test test = {
-	.tid = "nanosleep()",
+	.tid = "clock_nanosleep()",
 	.sample = sample_fn,
 };
Signature · 1 line
2.9.3
author
#1 lore raw

PATCH 2/2 mm: enlarge mmap HIGH_ADDR value for s390 arch

The kernel commit 1aea9b3f92 (s390/mm: implement 5 level pages tables) enlarge the maximum address in the tasks address space from (1UL << 53) to (-PAGE_SIZE) on s390 platform.

We have to increase the HIGH_ADDR in ltp testcases accordingly otherwise that would be failed with succeeded mmap into high region:

mmap15.c:
mmap15 1 TFAIL : mmap15.c:77: mmap into high region succeeded unexpectedly

mmapstress03.c:

mmapstress03: errno = 25: really large mmap didn't fail
mmapstress03    0  TINFO  :  uname.machine=s390x kernel is 32bit
mmapstress03    1  TFAIL  :  mmapstress03.c:212: Test failed
---
 testcases/kernel/mem/mmapstress/mmapstress03.c | 3 +--
 testcases/kernel/syscalls/mmap/mmap15.c        | 2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)
testcases/kernel/mem/mmapstress/mmapstress03.c +1 -2
index 0012eeb..f8541e1 100644
@@ -141,8 +141,7 @@ int main(void)
 	}
 
 	/* Ask for a ridiculously large mmap region at a high address */
-	if (mmap((void*) (((uintptr_t)1) << ((sizeof(void*)<<3) - 1)) - pagesize,
-		 (size_t) ((1ULL << (kernel_bits - 1)) - pagesize),
+	if (mmap((void*) (-pagesize), (size_t) ((1ULL << (kernel_bits - 1)) - pagesize),
 		 PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_FIXED | MAP_SHARED,
 		 0, 0)
 	    != (void*) - 1) {
testcases/kernel/syscalls/mmap/mmap15.c +1 -1
index 7e917bd..e1dbca2 100644
@@ -43,7 +43,7 @@ int TST_TOTAL = 1;
 #ifdef __ia64__
 # define HIGH_ADDR (void *)(0xa000000000000000UL)
 #else
-# define HIGH_ADDR (void *)(1L << 53)
+# define HIGH_ADDR (void *)(0xfffffffffffff000UL)
 #endif
 
 static long map_sz;
Signature · 1 line
2.9.3
#2 lore raw

PATCH 2/2 mm: enlarge mmap HIGH_ADDR value for s390 arch

----- Original Message -----

Quoted 7 lines

The kernel commit 1aea9b3f92 (s390/mm: implement 5 level pages tables) enlarge the maximum address in the tasks address space from (1UL << 53) to (-PAGE_SIZE) on s390 platform.

We have to increase the HIGH_ADDR in ltp testcases accordingly otherwise that would be failed with succeeded mmap into high region:

Quoted 7 lines

mmap15.c:
mmap15 1 TFAIL : mmap15.c:77: mmap into high region succeeded unexpectedly

mmapstress03.c:
mmapstress03: errno = 25: really large mmap didn't fail
mmapstress03 0 TINFO : uname.machine=s390x kernel is 32bit

Isn't this the problem? ^^

Quoted 2 lines

mmapstress03 1 TFAIL : mmapstress03.c:212: Test failed

Regards,
Jan

author
#3 lore raw

PATCH 2/2 mm: enlarge mmap HIGH_ADDR value for s390 arch

Quoted 14 lines · Jan Stancek

----- Original Message -----

Quoted 11 lines

The kernel commit 1aea9b3f92 (s390/mm: implement 5 level pages tables) enlarge the maximum address in the tasks address space from (1UL << 53) to (-PAGE_SIZE) on s390 platform.

We have to increase the HIGH_ADDR in ltp testcases accordingly otherwise that would be failed with succeeded mmap into high region:

mmap15.c:
mmap15 1 TFAIL : mmap15.c:77: mmap into high region succeeded unexpectedly

Quoted 5 lines
Quoted 3 lines

mmapstress03.c:
mmapstress03: errno = 25: really large mmap didn't fail
mmapstress03 0 TINFO : uname.machine=s390x kernel is 32bit

Isn't this the problem? ^^

No, It is an misinformation (for s390 platform) from LTP tst_kernel_bits() function.

====

# uname -r
3.10.0-514.el7.s390x
# readelf -h mmapstress03
ELF Header:
  Magic:   7f 45 4c 46 02 02 01 00 00 00 00 00 00 00 00 00
  Class:                             ELF64
  Data:                              2's complement, big endian
  Version:                           1 (current)
...
# ./mmapstress03
mmapstress03    0  TINFO  :  uname.machine=s390x kernel is 32bit
mmapstress03    1  TPASS  :  Test passed

I'd suggest to fix this as:

$ git diff
lib/tst_kernel.c +2 -1
index fd648b1..6d6fd38 100644
@@ -35,7 +35,8 @@ int tst_kernel_bits(void)
         * ARM64 (aarch64) defines 32-bit compatibility modes as
         * armv8l and armv8b (little and big endian).
         */
-       if (!strcmp(buf.machine, "armv8l") || !strcmp(buf.machine, "armv8b"))
+       if (!strcmp(buf.machine, "armv8l") || !strcmp(buf.machine, "armv8b")
+                       || !strcmp(buf.machine, "s390x"))
                kernel_bits = 64;
 
        tst_resm(TINFO, "uname.machine=%s kernel is %ibit",
Signature · 2 lines
Li Wang
[email protected]
#4 lore raw

PATCH 2/2 mm: enlarge mmap HIGH_ADDR value for s390 arch

----- Original Message -----

Quoted 15 lines · Jan Stancek
Quoted 14 lines

----- Original Message -----

Quoted 11 lines

The kernel commit 1aea9b3f92 (s390/mm: implement 5 level pages tables) enlarge the maximum address in the tasks address space from (1UL << 53) to (-PAGE_SIZE) on s390 platform.

We have to increase the HIGH_ADDR in ltp testcases accordingly otherwise that would be failed with succeeded mmap into high region:

mmap15.c:
mmap15 1 TFAIL : mmap15.c:77: mmap into high region succeeded unexpectedly

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

mmapstress03.c:
mmapstress03: errno = 25: really large mmap didn't fail
mmapstress03 0 TINFO : uname.machine=s390x kernel is 32bit

Isn't this the problem? ^^

No, It is an misinformation (for s390 platform) from LTP tst_kernel_bits() function.

That number is used to calculate size for mmap in mmapstress03.
Are you saying that after commit 1aea9b3f92, mmap for size "(1 << 63) - pagesize" will succeed?

Regards,
Jan

Quoted 43 lines

====

# uname -r
3.10.0-514.el7.s390x
# readelf -h mmapstress03
ELF Header:
  Magic:   7f 45 4c 46 02 02 01 00 00 00 00 00 00 00 00 00
  Class:                             ELF64
  Data:                              2's complement, big endian
  Version:                           1 (current)
...
# ./mmapstress03
mmapstress03    0  TINFO  :  uname.machine=s390x kernel is 32bit
mmapstress03    1  TPASS  :  Test passed

I'd suggest to fix this as:

$ git diff
lib/tst_kernel.c +2 -2
index fd648b1..6d6fd38 100644
@@ -35,7 +35,8 @@ int tst_kernel_bits(void)
         * ARM64 (aarch64) defines 32-bit compatibility modes as
         * armv8l and armv8b (little and big endian).
         */
-       if (!strcmp(buf.machine, "armv8l") || !strcmp(buf.machine, "armv8b"))
+       if (!strcmp(buf.machine, "armv8l") || !strcmp(buf.machine, "armv8b")
+                       || !strcmp(buf.machine, "s390x"))
                kernel_bits = 64;
 
        tst_resm(TINFO, "uname.machine=%s kernel is %ibit",
 
 
 
--

Li Wang
[email protected]

author
#5 lore raw

PATCH 2/2 mm: enlarge mmap HIGH_ADDR value for s390 arch

Quoted 22 lines · Jan Stancek

----- Original Message -----

Quoted 19 lines · Jan Stancek
Quoted 18 lines

----- Original Message -----

Quoted 14 lines

The kernel commit 1aea9b3f92 (s390/mm: implement 5 level pages tables) enlarge the maximum address in the tasks address space from (1UL << 53) to (-PAGE_SIZE) on s390 platform.

We have to increase the HIGH_ADDR in ltp testcases accordingly otherwise that would be failed with succeeded mmap into high region:

mmap15.c:
mmap15 1 TFAIL : mmap15.c:77: mmap into high region succeeded unexpectedly

mmapstress03.c:
mmapstress03: errno = 25: really large mmap didn't fail
mmapstress03 0 TINFO : uname.machine=s390x kernel is 32bit

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

Isn't this the problem? ^^

No, It is an misinformation (for s390 platform) from LTP tst_kernel_bits() function.

That number is used to calculate size for mmap in mmapstress03.
Are you saying that after commit 1aea9b3f92, mmap for size "(1 << 63) - pagesize" will succeed?

Hmm no, mmap for size "(1 << 63) - pagesize" still failed as we expected on kernel-v4.14-rc8.
Indeed, now we have no need to change anything in mmapstress03.c.

Signature · 2 lines
Li Wang
[email protected]
author
#6 lore raw

PATCH 2/2 mm: enlarge mmap HIGH_ADDR value for s390 arch

In reply to Jan Stancek
Quoted 14 lines · Jan Stancek

----- Original Message -----

Quoted 11 lines

The kernel commit 1aea9b3f92 (s390/mm: implement 5 level pages tables) enlarge the maximum address in the tasks address space from (1UL << 53) to (-PAGE_SIZE) on s390 platform.

We have to increase the HIGH_ADDR in ltp testcases accordingly otherwise that would be failed with succeeded mmap into high region:

mmap15.c:
mmap15 1 TFAIL : mmap15.c:77: mmap into high region succeeded unexpectedly

Quoted 5 lines
Quoted 3 lines

mmapstress03.c:
mmapstress03: errno = 25: really large mmap didn't fail
mmapstress03 0 TINFO : uname.machine=s390x kernel is 32bit

Isn't this the problem? ^^

I did more test on s390x platform with upstream kernel-v4.14-rc8. It has been proved that the mmapstress03.c failures was only caused by wrong kernel_bits value.

So I think we have no need to raise the mmap high address in mmapstress03.c test, but mmap15 testcase should be fixed at least.

Just adding debugging sentence temporarily to show something:
==============

testcases/kernel/mem/mmapstress/mmapstress03.c +4 -0
@@ -140,6 +140,14 @@ int main(void)
                anyfail();
        }
 
+# define HIGH_ADDR_MAX (void *)(-pagesize)
+printf("HIGH_ADDR_MAX = %p\n", HIGH_ADDR_MAX);
+
+void * map_addr = (void*) (((uintptr_t)1) << ((sizeof(void*)<<3) -

1)) - pagesize;
+size_t map_size = (size_t) (1ULL << (kernel_bits - 1)) - pagesize; +printf("map_addr = %p\n", map_addr);
+printf("map_size = %p\n", map_size);
+

        /* Ask for a ridiculously large mmap region@a high address */
        if (mmap((void*) (((uintptr_t)1) << ((sizeof(void*)<<3) - 1))
- pagesize,
                 (size_t) ((1ULL << (kernel_bits - 1)) - pagesize),

============

# uname -rm
4.14.0-rc8+ s390x
# ./mmapstress03
mmapstress03    0  TINFO  :  uname.machine=s390x kernel is 64bit
HIGH_ADDR_MAX = 0xfffffffffffff000
map_addr = 0x7ffffffffffff000
map_size = 0x7ffffffffffff000
mmapstress03    1  TPASS  :  Test passed

I'd like to format two new patches for kernel-bit detection and mmap15 issue.

Signature · 2 lines
Li Wang
[email protected]
author
#7 lore raw

PATCH 2/2 mm: enlarge mmap HIGH_ADDR value for s390 arch

In reply to Jan Stancek
Quoted 14 lines · Jan Stancek

----- Original Message -----

Quoted 11 lines

The kernel commit 1aea9b3f92 (s390/mm: implement 5 level pages tables) enlarge the maximum address in the tasks address space from (1UL << 53) to (-PAGE_SIZE) on s390 platform.

We have to increase the HIGH_ADDR in ltp testcases accordingly otherwise that would be failed with succeeded mmap into high region:

mmap15.c:
mmap15 1 TFAIL : mmap15.c:77: mmap into high region succeeded unexpectedly

Quoted 5 lines
Quoted 3 lines

mmapstress03.c:
mmapstress03: errno = 25: really large mmap didn't fail
mmapstress03 0 TINFO : uname.machine=s390x kernel is 32bit

Isn't this the problem? ^^

I did some more test on s390x platform with upstream kernel-v4.14-rc8. Seems the mmapstress03.c failures was caused by wrong kernel_bits value.

# uname -rm
4.14.0-rc8+ s390x
Signature · 2 lines
Li Wang
[email protected]
#8 lore raw

PATCH 1/2 ltp: typos correction

In reply to Li Wang

Hi!

testcases/kernel/syscalls/clock_nanosleep/clock_nanosleep02.c int sample_fn(int clk_id, long long usec) · line 48

Quoted 4 lines

static struct tst_test test = {

testcases/kernel/syscalls/clock_nanosleep/clock_nanosleep02.c +1 -1
-	.tid = "nanosleep()",
+	.tid = "clock_nanosleep()",
 	.sample = sample_fn,

The .tid field should not be set in the tests since a5bf5254ca9 (tst_test.c: set the test id automatically).

Just remove it from the test structure here.

I guess that we may as well remove it from the test structure completely and keep it hidden in the test library.

Signature · 2 lines
Cyril Hrubis
[email protected]
author
#9 lore raw

PATCH 1/2 ltp: typos correction

Quoted 8 lines · Cyril Hrubis

Hi!

Review

Quoted 4 lines

static struct tst_test test = {

(quoted diff) +1 -1
-     .tid = "nanosleep()",
+     .tid = "clock_nanosleep()",
      .sample = sample_fn,

The .tid field should not be set in the tests since a5bf5254ca9 (tst_test.c: set the test id automatically).

Yes!

I thought if there are some special meaning there before. Because you put the function
tst_timer_test_setup(tst_test) in the front of get_tid(argv) in tst_test.c.

Quoted 5 lines

Just remove it from the test structure here.

I guess that we may as well remove it from the test structure completely and keep it hidden in the test library.

Agree!

if so, the code changes in library should be like:

$ git diff
lib/tst_test.c +3 -3
index f8b3fb4..a8a2115 100644
@@ -688,12 +688,12 @@ static void do_setup(int argc, char *argv[])
 
        assert_test_fn();
 
-       if (tst_test->sample)
-               tst_test = tst_timer_test_setup(tst_test);
-
        if (!tst_test->tid)
                tst_test->tid = get_tid(argv);
 
+       if (tst_test->sample)
+               tst_test = tst_timer_test_setup(tst_test);
+
        parse_opts(argc, argv);
 
        if (tst_test->needs_root && geteuid() != 0)

If you don't have more suggestion, I will re-write a new patch V2 do that.

Signature · 2 lines
Li Wang
[email protected]