mmap16: extend checkpoint wait time during fs fill
PATCH 1/1 mmap16: extend checkpoint wait time during fs fill
I'm seeing this test rarely failing on slower systems:
mmap16 0 TINFO : Using test device LTP_DEV='/dev/loop0' mmap16 0 TINFO : Formatting /dev/loop0 with ext4 opts='-b 1024' extra opts='10240' mmap16 1 TBROK : tst_checkpoint.c:136: mmap16.c:223: tst_checkpoint_wait(0, 10000): errno=ETIMEDOUT(110): Connection timed out mmap16 2 TBROK : tst_checkpoint.c:136: Remaining cases broken mmap16 1 TBROK : tst_checkpoint.c:149: mmap16.c:125: tst_checkpoint_wake(0, 1, 10000): errno=ETIMEDOUT(110): Connection timed out mmap16 2 TBROK : tst_checkpoint.c:149: Remaining cases broken
duration=52 termination_type=exited termination_id=2 corefile=no cutime=0 cstime=132
What appears to be happening is that filling entire fs with 1024 chunks takes longer than 10 seconds, so child hits TBROK while waiting for parent. Parent eventually finishes, but then is unable to wake child, which already finished.
Based on output above it looks like it took ~30 seconds to fill the fs and then we hit 2 timeouts, making total of ~50 seconds. This patch extends this particular checkpoint wait to 60 seconds.
--- testcases/kernel/syscalls/mmap/mmap16.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
testcases/kernel/syscalls/mmap/mmap16.c +5 -1
@@ -220,7 +220,11 @@ static void do_child(void)* kernel writepage is called, that means data corruption. */ TST_SAFE_CHECKPOINT_WAKE (NULL ,0 ); -TST_SAFE_CHECKPOINT_WAIT (NULL ,0 ); + +/* Give parent enough time to consume FS free blocks */ +if (tst_checkpoint_wait (0 ,60 *1000 )) +tst_brkm (TBROK |TERRNO , cleanup, +"wait for parent to fill entire space" );for (offset =FS_BLOCKSIZE ; offset < page_size; offset +=FS_BLOCKSIZE ) addr[offset] ='a' ;
Signature · 1 line
1.8.3.1
PATCH 1/1 mmap16: extend checkpoint wait time during fs fill
Hi!
Review
Quoted 5 lines
(quoted diff) +5
-0+ + /* Give parent enough time to consume FS free blocks */ + if (tst_checkpoint_wait(0, 60*1000)) + tst_brkm(TBROK | TERRNO, cleanup, + "wait for parent to fill entire space");
Hrm, I wonder why I hardcoded the timeout into the library. It would be much better if we could have used the safe variant here.
What about we add TST_SAFE_CHECKPOINT_WAIT2() that would take a timeout parameter. Pretty much the same as we do for WAKE2 that takes a number of processes to wake as a paramter.
Something like this:
include/old/old_checkpoint.h +5 -2
@@ -41,7 +41,10 @@ tst_checkpoint_init(__FILE__, __LINE__, cleanup_fn)#define TST_SAFE_CHECKPOINT_WAIT (cleanup_fn, id) \ - tst_safe_checkpoint_wait(__FILE__, __LINE__, cleanup_fn, id); + tst_safe_checkpoint_wait(__FILE__, __LINE__, cleanup_fn, id, 0); + +#define TST_SAFE_CHECKPOINT_WAIT2 (cleanup_fn, id, msec_timeout) \ + tst_safe_checkpoint_wait(__FILE__, __LINE__, cleanup_fn, id, msec_timeout);#define TST_SAFE_CHECKPOINT_WAKE (cleanup_fn, id) \ tst_safe_checkpoint_wake(__FILE__, __LINE__, cleanup_fn, id, 1);
@@ -51,6 +54,6 @@#define TST_SAFE_CHECKPOINT_WAKE_AND_WAIT (cleanup_fn, id) \ tst_safe_checkpoint_wake(__FILE__, __LINE__, cleanup_fn, id, 1); \ - tst_safe_checkpoint_wait(__FILE__, __LINE__, cleanup_fn, id); + tst_safe_checkpoint_wait(__FILE__, __LINE__, cleanup_fn, id, 0);#endif /* OLD_CHECKPOINT__ */
include/tst_checkpoint.h +4 -1
@@ -21,7 +21,10 @@#include "tst_checkpoint_fn.h" #define TST_CHECKPOINT_WAIT (id) \ - tst_safe_checkpoint_wait(__FILE__, __LINE__, NULL, id); + tst_safe_checkpoint_wait(__FILE__, __LINE__, NULL, id, 0); + +#define TST_CHECKPOINT_WAIT2 (id, msec_timeout) \ + tst_safe_checkpoint_wait(__FILE__, __LINE__, NULL, id, msec_timeout);#define TST_CHECKPOINT_WAKE (id) \ tst_safe_checkpoint_wake(__FILE__, __LINE__, NULL, id, 1);
include/tst_checkpoint_fn.h +2 -1
@@ -45,7 +45,8 @@ int tst_checkpoint_wake(unsigned int id, unsigned int nr_wake, unsigned int msec_timeout);void tst_safe_checkpoint_wait (const char *file,const int lineno, -void (*cleanup_fn)(void ),unsigned int id); +void (*cleanup_fn)(void ),unsigned int id, +unsigned int msec_timeout); void tst_safe_checkpoint_wake(const char *file, const int lineno, void (*cleanup_fn)(void), unsigned int id,
lib/tst_checkpoint.c +9 -3
@@ -126,14 +126,20 @@ int tst_checkpoint_wake(unsigned int id, unsigned int nr_wake, }void tst_safe_checkpoint_wait (const char *file,const int lineno, -void (*cleanup_fn)(void ),unsigned int id) +void (*cleanup_fn)(void ),unsigned int id, +unsigned int msec_timeout) { -int ret =tst_checkpoint_wait (id,DEFAULT_MSEC_TIMEOUT ); +int ret; + +if (!msec_timeout) + msec_timeout =DEFAULT_MSEC_TIMEOUT ; + + ret =tst_checkpoint_wait (id, msec_timeout);if (ret) {tst_brkm (TBROK |TERRNO , cleanup_fn,"%s:%d: tst_checkpoint_wait(%u, %i)" , - file, lineno, id,DEFAULT_MSEC_TIMEOUT ); + file, lineno, id, msec_timeout); } }
Signature · 2 lines
Cyril Hrubis [email protected]
PATCH 1/1 mmap16: extend checkpoint wait time during fs fill
----- Original Message -----
Quoted 16 lines
From: "Cyril Hrubis" <[email protected]>
To: "Jan Stancek" <[email protected]>
Cc: [email protected]
Sent: Monday, 13 February, 2017 11:02:34 AM
Subject: Re: [LTP] [PATCH] mmap16: extend checkpoint wait time during fs fillHi!
Review
Quoted 5 lines
(quoted diff) +5
-0+ + /* Give parent enough time to consume FS free blocks */ + if (tst_checkpoint_wait(0, 60*1000)) + tst_brkm(TBROK | TERRNO, cleanup, + "wait for parent to fill entire space");Hrm, I wonder why I hardcoded the timeout into the library. It would be much better if we could have used the safe variant here.
Quoted 3 lines
What about we add
TST_SAFE_CHECKPOINT_WAIT2()that would take a timeout parameter. Pretty much the same as we do for WAKE2 that takes a number of processes to wake as a paramter.
Fine by me. Can you push it?
I can rebase & push patch using new TST_SAFE_CHECKPOINT_WAIT2().
Regards,
Jan