Skip to contentSkip to conversation

syscalls/fork13: Rewrite to new API + add .max_runtime

PATCH In review Cyril Hrubis 2 participants 3 messages Jun 16, 2022 – Jun 20, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 syscalls/fork13: Rewrite to new API + add .max_runtime

This fixes a problem we had for years, the test can run for more than half an hour on slow systems and it used to timeout quite often.

This commit introduces a max_runtime with a 10 minute limit which is more than enough for the test to complete on a modern hardware but at the same time it limits the runtime to a sensible value on older hardware and embedded.

---
 README.md                               |   2 +-
 runtest/syscalls                        |   2 +-
 testcases/kernel/syscalls/fork/fork13.c | 168 ++++++++++--------------
 3 files changed, 71 insertions(+), 101 deletions(-)
README.md +1 -1
index 7764eb81a..3a0fd7f96 100644
@@ -150,7 +150,7 @@ $ testcases/bin/abort01
 Some have arguments
 
 ```
-$ testcases/bin/fork13 -i 37
+$ testcases/bin/mesgq\_nstest -m none
 ```
 
 The vast majority of test cases accept the -h (help) switch
runtest/syscalls +1 -1
index 88c31db06..36fc50aeb 100644
@@ -372,7 +372,7 @@ fork08 fork08
 fork09 fork09
 fork10 fork10
 fork11 fork11
-fork13 fork13 -i 1000000
+fork13 fork13
 fork14 fork14
 
 fpathconf01 fpathconf01
testcases/kernel/syscalls/fork/fork13.c +69 -99

208 lines not on this page · raw message

Signature · 5 lines
2.35.1


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

Hi Cyril,

Quoted 2 lines

This fixes a problem we had for years, the test can run for more than half an hour on slow systems and it used to timeout quite often.

+1

Quoted 4 lines

This commit introduces a max_runtime with a 10 minute limit which is more than enough for the test to complete on a modern hardware but at the same time it limits the runtime to a sensible value on older hardware and embedded.

+1

Original implementation was quite nicely written (at least some parts were reused), which clearly demonstrates advantages of new LTP API.

LGTM.

I'd just formatted the doc differently:

/*\
* [Description]
*
* A race in pid generation that causes pids to be reused immediately *
* From the mainline commit 5fdee8c4a5e1800489ce61963208f8cc55e42ea1:
*
* A program that repeatedly forks and waits is susceptible to having
* the same pid repeated, especially when it competes with another
* instance of the same program. This is really bad for bash
* implementation. Furthermore, many shell scripts assume that pid
* numbers will not be used for some length of time.
*
* [Race Description]
* ---------------------------------------------------------------------
* A B
*
* // pid == offset == n // pid == offset == n + 1
* test_and_set_bit(offset, map->page)
* test_and_set_bit(offset, map->page);
* pid_ns->last_pid = pid;
* pid_ns->last_pid = pid;
* // pid == n + 1 is freed (wait())
*

 *                                     // Next fork()...
 *                                     last = pid_ns->last_pid; // == n
 *                                     pid = last + 1;

* --------------------------------------------------------------------- */

Kind regards,
Petr

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

Hi!

Quoted 1 line

I'd just formatted the doc differently:

Fixed and pushed, thanks for the review.

Signature · 5 lines
Cyril Hrubis
[email protected]

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