Skip to contentSkip to conversation

swapoff01: Define max_runtime 45s

PATCH In review Petr Vorel 5 participants 14 messages Sep 3, 2024 – Sep 9, 2024

lore
Share & tools
lore

Petr Vorel

author
#0 lore raw

PATCH v2 1/1 swapoff01: Define max_runtime 45s

Test run mostly below 1 sec per filesystem, only NTFS is very slow ~ 10-15 sec depending on architecture.

Also this is the only tests in syscalls which fails on due timeout on emulated risc-v with LTP_TIMEOUT_MUL=2,LTP_RUNTIME_MUL=2 (with the default 30s runtime => 1 min due LTP_RUNTIME_MUL=2).

Therefore set runtime to 45s, that should be enough even for slow risc-v and not that high for other archs.

---
Changes v1->v2:
* 60 => 45

 testcases/kernel/syscalls/swapoff/swapoff01.c | 1 +
 1 file changed, 1 insertion(+)
testcases/kernel/syscalls/swapoff/swapoff01.c +1 -0
index 314630267d..ef75c92de0 100644
@@ -53,5 +53,6 @@ static struct tst_test test = {
 	.all_filesystems = 1,
 	.needs_root = 1,
 	.test_all = verify_swapoff,
+	.max_runtime = 45,
 	.setup = setup
 };
Signature · 5 lines
2.45.2


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#1 lore raw

Hi!

Quoted 2 lines

Test run mostly below 1 sec per filesystem, only NTFS is very slow ~ 10-15 sec depending on architecture.

If part of the slowdown is caused by the fact that we format the filesystems the real question is if all the tests that format and mount a device should have a max_runtime defined. It may make sense to increment the max_runtime in the test library to compensate for the mkfs, but it looks that it's not the mkfs that is slow.

I did some measurements for the swapoff01 case and the whole testrun runs for about 10 seconds for me. If I change the test to do tst_brk(TCONF, ...) as the first thing in the test setup its 1s. So writing out the 1MB of swapfile and running mkswap and swapon() on that takes about 90% of the runtime.

So yes it looks like the actual test needs some runtime defined, although I'm not sure how long it should be. We probably need a reference machine to callibrate this on. I would avoid any emulated CPU and choose a real hardware. I guess one of the RPis e.g. Pi Zero would be a good choice since they are widely available and slow by any modern standards.

Quoted 22 lines

---
Changes v1->v2:
* 60 => 45

 testcases/kernel/syscalls/swapoff/swapoff01.c | 1 +
 1 file changed, 1 insertion(+)
testcases/kernel/syscalls/swapoff/swapoff01.c +1 -0
index 314630267d..ef75c92de0 100644
@@ -53,5 +53,6 @@ static struct tst_test test = {
 	.all_filesystems = 1,
 	.needs_root = 1,
 	.test_all = verify_swapoff,
+	.max_runtime = 45,
 	.setup = setup
 };
Signature · 1 line
2.45.2
Signature · 5 lines
Cyril Hrubis
[email protected]

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
author
#2 lore raw
Quoted 10 lines

Hi!

Quoted 2 lines

Test run mostly below 1 sec per filesystem, only NTFS is very slow ~ 10-15 sec depending on architecture.

If part of the slowdown is caused by the fact that we format the filesystems the real question is if all the tests that format and mount a device should have a max_runtime defined. It may make sense to increment the max_runtime in the test library to compensate for the mkfs, but it looks that it's not the mkfs that is slow.

Quoted 5 lines

I did some measurements for the swapoff01 case and the whole testrun runs for about 10 seconds for me. If I change the test to do tst_brk(TCONF, ...) as the first thing in the test setup its 1s. So writing out the 1MB of swapfile and running mkswap and swapon() on that takes about 90% of the runtime.

Thanks for your investigation.

Quoted 6 lines

So yes it looks like the actual test needs some runtime defined, although I'm not sure how long it should be. We probably need a reference machine to callibrate this on. I would avoid any emulated CPU and choose a real hardware. I guess one of the RPis e.g. Pi Zero would be a good choice since they are widely available and slow by any modern standards.

This makes sense.

Kind regards,
Petr

Quoted 21 lines
Quoted 21 lines

---
Changes v1->v2:
* 60 => 45

 testcases/kernel/syscalls/swapoff/swapoff01.c | 1 +
 1 file changed, 1 insertion(+)
testcases/kernel/syscalls/swapoff/swapoff01.c +1 -0
index 314630267d..ef75c92de0 100644
@@ -53,5 +53,6 @@ static struct tst_test test = {
 	.all_filesystems = 1,
 	.needs_root = 1,
 	.test_all = verify_swapoff,
+	.max_runtime = 45,
 	.setup = setup
 };
Signature · 1 line
2.45.2
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#3 lore raw

Hi!

Quoted 8 lines
Quoted 6 lines

So yes it looks like the actual test needs some runtime defined, although I'm not sure how long it should be. We probably need a reference machine to callibrate this on. I would avoid any emulated CPU and choose a real hardware. I guess one of the RPis e.g. Pi Zero would be a good choice since they are widely available and slow by any modern standards.

This makes sense.

So I dusted off my Pi Zero and indeed the test timeouts there as well. The ntfs filesystem takes 78s, ext2 29s, exfat 20s. So I would say that max_runtime should be at least a minute. I guess I will try to run the whole run there before the release and check for timeouts so that we are sure that the runtime is set reasonably even for very slow hardware.

Signature · 5 lines
Cyril Hrubis
[email protected]

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#4 lore raw
Quoted 9 lines · Cyril Hrubis

Hi!

Quoted 7 lines
Quoted 6 lines

So yes it looks like the actual test needs some runtime defined, although I'm not sure how long it should be. We probably need a reference machine to callibrate this on. I would avoid any emulated CPU and choose a real hardware. I guess one of the RPis e.g. Pi Zero would be a good choice since they are widely available and slow by any modern standards.

Quoted 4 lines
Quoted 1 line

This makes sense.

So I dusted off my Pi Zero and indeed the test timeouts there as well. The ntfs filesystem takes 78s, ext2 29s, exfat 20s. So I would say that

I'm wondering which distribution (and kernel version) did you use on raspi-0?

My raspi4(ubuntu-24, 6.8.0-1010, Cortex-A72) takes a little faster.

ext2: 12s
ext3: 12s
ext4: 0.4s
ntfs: 46s
exfat: skip

Quoted 1 line

max_runtime should be at least a minute. I guess I will try to run the

Agree.

Quoted 2 lines

whole run there before the release and check for timeouts so that we are sure that the runtime is set reasonably even for very slow hardware.

+1

Signature · 6 lines
Regards,
Li Wang


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#5 lore raw
Quoted 11 lines · Li Wang
Quoted 9 lines · Cyril Hrubis

Hi!

Quoted 7 lines
Quoted 6 lines

So yes it looks like the actual test needs some runtime defined, although I'm not sure how long it should be. We probably need a reference machine to callibrate this on. I would avoid any emulated CPU and choose a real hardware. I guess one of the RPis e.g. Pi Zero would be a good choice since they are widely available and slow by any modern standards.

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

This makes sense.

So I dusted off my Pi Zero and indeed the test timeouts there as well. The ntfs filesystem takes 78s, ext2 29s, exfat 20s. So I would say that

I'm wondering which distribution (and kernel version) did you use on raspi-0?

I ask this because we might need to consider the oldest supported systems:
- https://linux-test-project.readthedocs.io/en/latest/users/supported_systems.html

Signature · 6 lines
Regards,
Li Wang


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
author
#6 lore raw
Quoted 11 lines · Li Wang
Quoted 10 lines · Cyril Hrubis
Quoted 8 lines

Hi!

Quoted 6 lines
Quoted 6 lines

So yes it looks like the actual test needs some runtime defined, although I'm not sure how long it should be. We probably need a reference machine to callibrate this on. I would avoid any emulated CPU and choose a real hardware. I guess one of the RPis e.g. Pi Zero would be a good choice since they are widely available and slow by any modern standards.

Pi Zero is good that it's slow enough that even emulated risc-v will work.

But OTOH might be more practical to measure on RPI4 or RPI3 (maybe more of us has RPI4 or RPI3 personally or in CI). I mean unless others have/will buy Pi Zero you will be forced to do the reference. Also Pi Zero is slow (you need to compile, thus I will not love to do the measurements.

Also emulated risc-v and Pi Zero will always need to set LTP_RUNTIME_MUL, right? Or do we want to do measurements that even these will run without LTP_RUNTIME_MUL? That would help users not having to bother, but increasing limits for fast devices might not be a good idea.

Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
Quoted 1 line

This makes sense.

So I dusted off my Pi Zero and indeed the test timeouts there as well. The ntfs filesystem takes 78s, ext2 29s, exfat 20s. So I would say that

I'm wondering which distribution (and kernel version) did you use on raspi-0?

Yes, 78s, ext2 29s, exfat 20s is faster, but that's due Raspberry Pi Zero using just Broadcom BCM2835 SoC as the first generation Raspberry Pi [1] (32 bit arm). RPI4 uses Broadcom BCM2711 SoC (64-bit quad-core).

Kind regards,
Petr

[1] https://en.wikipedia.org/wiki/Raspberry_Pi#Processor

Quoted 2 lines

I ask this because we might need to consider the oldest supported systems:
- https://linux-test-project.readthedocs.io/en/latest/users/supported_systems.html

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#7 lore raw
In reply to Li Wang

Hi!

Quoted 1 line

I'm wondering which distribution (and kernel version) did you use on raspi-0?

The default raspbian. The difference I guess is that RPi Zero is a single ARMv6 if I'm looking right it's the same CPU as on the original RPi. That's way slower than quad Cortex-A72 on RPi 4.

Quoted 7 lines

My raspi4(ubuntu-24, 6.8.0-1010, Cortex-A72) takes a little faster.

ext2: 12s
ext3: 12s
ext4: 0.4s
ntfs: 46s
exfat: skip

I suppose that this is stil slow on RPi 4 because the rootfs is on a SD card, since the CPU on RPi 4 is way faster than RPi Zero.

Signature · 5 lines
Cyril Hrubis
[email protected]

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#8 lore raw
Quoted 10 lines · Cyril Hrubis

Hi!

Quoted 1 line

I'm wondering which distribution (and kernel version) did you use on

raspi-0?

The default raspbian. The difference I guess is that RPi Zero is a single ARMv6 if I'm looking right it's the same CPU as on the original RPi. That's way slower than quad Cortex-A72 on RPi 4.

Quoted 2 lines

My raspi4(ubuntu-24, 6.8.0-1010, Cortex-A72) takes a little faster.

Quoted 9 lines
Quoted 5 lines

ext2: 12s
ext3: 12s
ext4: 0.4s
ntfs: 46s
exfat: skip

I suppose that this is stil slow on RPi 4 because the rootfs is on a SD card, since the CPU on RPi 4 is way faster than RPi Zero.

Yes, exactly.

@Petr, if you planning to send out V3, I think it is better to set a proper value
for max_runtime in swapon01 simultaneously. Since our CI jobs catch that one timeout out sporadically too.

     7	tst_device.c:96: TINFO: Found free device 0 '/dev/loop0'
     8	tst_test.c:1733: TINFO: LTP version: 20240524

     9	tst_test.c:1617: TINFO: Timeout per run is 0h 01m 00s

    10	tst_supported_fs_types.c:96: TINFO: Kernel supports ext2
    11	tst_supported_fs_types.c:61: TINFO: mkfs.ext2 does exist


    61	tst_test.c:1693: TINFO: === Testing on vfat ===
    62	tst_test.c:1106: TINFO: Formatting /dev/loop0 with vfat opts=''
extra opts=''
    63	tst_test.c:1120: TINFO: Mounting /dev/loop0 to

/mnt/testarea/ltp-ukK7X0nhcs/LTP_swakCd462/mntpoint fstyp=vfat flags=0
64 libswap.c:198: TINFO: create a swapfile size of 1 megabytes (MB)
65 tst_ioctl.c:26: TINFO: FIBMAP ioctl is supported
66 swapon01.c:41: TINFO: create a swapfile size of 128 megabytes (MB)
67 swapon01.c:27: TPASS: tst_syscall(__NR_swapon, SWAP_FILE, 0) passed
68 tst_test.c:1671: TINFO: If you are running on slow machine, try
exporting LTP_TIMEOUT_MUL > 1

    69	tst_test.c:1673: TBROK: Test killed! (timeout?)
Signature · 5 lines
Regards,
Li Wang

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#9 lore raw

PATCH v3 1/1 swapoff01/swapon01: Define max_runtime 1 mins

In reply to Petr Vorel

From: Petr Vorel <[email protected]>

Test run mostly below 1 sec per filesystem, only NTFS is very slow ~ 10-15 sec depending on architecture.

Also this is the only tests in syscalls which fails on due timeout on emulated risc-v with LTP_TIMEOUT_MUL=2,LTP_RUNTIME_MUL=2 (with the default 30s runtime => 1 min due LTP_RUNTIME_MUL=2).

Based on the test consumed time on RPi0 and RPi4, we set runtime to 60s, that should be enough even for slow risc-v and not that high for other archs.

---
 testcases/kernel/syscalls/swapoff/swapoff01.c | 1 +
 testcases/kernel/syscalls/swapon/swapon01.c   | 1 +
 2 files changed, 2 insertions(+)
testcases/kernel/syscalls/swapoff/swapoff01.c +1 -0
index 314630267..965d17cc8 100644
@@ -53,5 +53,6 @@ static struct tst_test test = {
 	.all_filesystems = 1,
 	.needs_root = 1,
 	.test_all = verify_swapoff,
+	.max_runtime = 60,
 	.setup = setup
 };
testcases/kernel/syscalls/swapon/swapon01.c +1 -0
index 49915c32d..eddcd5788 100644
@@ -51,5 +51,6 @@ static struct tst_test test = {
 	.all_filesystems = 1,
 	.needs_cgroup_ctrls = (const char *const []){ "memory", NULL },
 	.test_all = verify_swapon,
+	.max_runtime = 60,
 	.setup = setup
 };
Signature · 5 lines
2.46.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
Reviewed-by on v3 1/1
#10 lore raw

Re: [LTP] [PATCH v3] swapoff01/swapon01: Define max_runtime 1 mins

Hi,

Quoted 36 lines · On Monday, September 9, 2024 4:52:43 AM GMT+2 Li Wang wrote:

From: Petr Vorel <[email protected]>

Test run mostly below 1 sec per filesystem, only NTFS is very slow ~ 10-15 sec depending on architecture.

Also this is the only tests in syscalls which fails on due timeout on emulated risc-v with LTP_TIMEOUT_MUL=2,LTP_RUNTIME_MUL=2 (with the default 30s runtime => 1 min due LTP_RUNTIME_MUL=2).

Based on the test consumed time on RPi0 and RPi4, we set runtime to 60s, that should be enough even for slow risc-v and not that high for other archs.

---
 testcases/kernel/syscalls/swapoff/swapoff01.c | 1 +
 testcases/kernel/syscalls/swapon/swapon01.c   | 1 +
 2 files changed, 2 insertions(+)
testcases/kernel/syscalls/swapoff/swapoff01.c +1 -0
index 314630267..965d17cc8 100644
@@ -53,5 +53,6 @@ static struct tst_test test = {
 	.all_filesystems = 1,
 	.needs_root = 1,
 	.test_all = verify_swapoff,
+	.max_runtime = 60,
 	.setup = setup
 };
testcases/kernel/syscalls/swapon/swapon01.c +0 -0
index 49915c32d..eddcd5788 100644

testcases/kernel/syscalls/swapon/swapon01.c static struct tst_test test = { · line 56

Quoted 6 lines
testcases/kernel/syscalls/swapon/swapon01.c +1 -0
@@ -51,5 +51,6 @@ static struct tst_test test = {
 	.all_filesystems = 1,
 	.needs_cgroup_ctrls = (const char *const []){ "memory", NULL },
 	.test_all = verify_swapon,
+	.max_runtime = 60,
 	.setup = setup
 };

Regards,
Avinesh

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Acked-by on v3 1/1
#11 lore raw

Re: [LTP] [PATCH v3] swapoff01/swapon01: Define max_runtime 1 mins

In reply to Li Wang
Quoted 10 lines · Li Wang

From: Petr Vorel <[email protected]>

Test run mostly below 1 sec per filesystem, only NTFS is very slow ~ 10-15 sec depending on architecture.

Also this is the only tests in syscalls which fails on due timeout on emulated risc-v with LTP_TIMEOUT_MUL=2,LTP_RUNTIME_MUL=2 (with the default 30s runtime => 1 min due LTP_RUNTIME_MUL=2).

Quoted 5 lines

Based on the test consumed time on RPi0 and RPi4, we set runtime to 60s, that should be enough even for slow risc-v and not that high for other archs.

Quoted 34 lines
---
 testcases/kernel/syscalls/swapoff/swapoff01.c | 1 +
 testcases/kernel/syscalls/swapon/swapon01.c   | 1 +
 2 files changed, 2 insertions(+)
testcases/kernel/syscalls/swapoff/swapoff01.c +1 -0
index 314630267..965d17cc8 100644
@@ -53,5 +53,6 @@ static struct tst_test test = {
        .all_filesystems = 1,
        .needs_root = 1,
        .test_all = verify_swapoff,
+       .max_runtime = 60,
        .setup = setup
 };
testcases/kernel/syscalls/swapon/swapon01.c +1 -1
index 49915c32d..eddcd5788 100644
@@ -51,5 +51,6 @@ static struct tst_test test = {
        .all_filesystems = 1,
        .needs_cgroup_ctrls = (const char *const []){ "memory", NULL },
        .test_all = verify_swapon,
+       .max_runtime = 60,
        .setup = setup
 };
--

2.46.0

--
Mailing list info: https://lists.linux.it/listinfo/ltp

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#13 lore raw

Re: [LTP] [PATCH v3] swapoff01/swapon01: Define max_runtime 1 mins

Patch merged, thank you all.

Signature · 5 lines
Regards,
Li Wang

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp