<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-size:small">Cyril Hrubis <<a href="mailto:chrubis@suse.cz" target="_blank">chrubis@suse.cz</a>> wrote:<br></div></div><div class="gmail_quote"><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
> > -       if (pair->exec_time_p < rem_p) {<br>
> > +       if (rem_p >= 1) {<br>
> ><br>
> <br>
> I hit a new problem while testing new pty03, that seems here<br>
> will fall into an infinite loop and test timed out finally. The printf<br>
> shows rem_p will be overflow I haven't figured out why.<br>
> <br>
> But with comparing with 0.9, it always gets passed on to the same system.<br>
<br>
That is strange, since we do:<br>
<br>
        rem_p = 1 - tst_remaining_runtime()/pair->time_exec_start;<br></blockquote><div><br></div><div><div class="gmail_default" style="font-size:small">I guess the root cause is that 'pair->time_exec_start' has a possibility</div><div class="gmail_default" style="font-size:small">to reach zero. in pty03 it has ".tcnt = 9" which made the tst_fzsync_pair_reset()</div><div class="gmail_default" style="font-size:small">to be re-run many times, but in that function 'pair->time_exec_start' will </div><div class="gmail_default" style="font-size:small">be set only based on the original .max_runtime, with time elapsed the remaining</div><div class="gmail_default" style="font-size:small">time tends to be zero. </div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">debug log</div><div class="gmail_default" style="font-size:small">--------------</div><div class="gmail_default" style="font-size:small">../../../include/tst_fuzzy_sync.h:651: TINFO: rem_p is 0.000000<br>../../../include/tst_fuzzy_sync.h:651: TINFO: rem_p is 0.000000<br>../../../include/tst_fuzzy_sync.h:651: TINFO: rem_p is 1.000000<br>../../../include/tst_fuzzy_sync.h:654: TINFO: Exceeded execution time, requesting exit<br>pty03.c:132: TPASS: Did not crash with PPS TTY discipline<br>pty03.c:106: TINFO: Creating PTY with CAIF line discipline<br>../../../include/tst_fuzzy_sync.h:651: TINFO: rem_p is -nan<br>pty03.c:91: TCONF: You don't appear to have the CAIF TTY line discipline: EINVAL (22)<br>pty03.c:106: TINFO: Creating PTY with GSM line discipline<br>../../../include/tst_fuzzy_sync.h:651: TINFO: rem_p is -nan<br>../../../include/tst_fuzzy_sync.h:651: TINFO: rem_p is -nan<br>../../../include/tst_fuzzy_sync.h:651: TINFO: rem_p is -nan<br></div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
<br>
And the tst_remaining_runtime() should return 0 once the time is up so<br>
the end result should be that rem_p will end up 1 sooner or later.<br></blockquote><div><br></div><div><div class="gmail_default" style="font-size:small">Yes, the pair->time_exec_start will be reset to 0 as well then</div><div class="gmail_default" style="font-size:small">becomes the denominator. That makes rem_p get an overflowed</div><div class="gmail_default" style="font-size:small">negative number, then the test falls into an infinite loop from this moment.</div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Anyways we can as well use the value from tst_remainig_runtime()<br>
directly instead as:</blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
diff --git a/include/tst_fuzzy_sync.h b/include/tst_fuzzy_sync.h<br>
index bef424002..db5bec7a4 100644<br>
--- a/include/tst_fuzzy_sync.h<br>
+++ b/include/tst_fuzzy_sync.h<br>
@@ -634,7 +634,8 @@ static inline void tst_fzsync_wait_b(struct tst_fzsync_pair *pair)<br>
  */<br>
 static inline int tst_fzsync_run_a(struct tst_fzsync_pair *pair)<br>
 {<br>
-       float rem_p = 1 - tst_remaining_runtime() / pair->exec_time_start;<br>
+       int remaining_runtime = tst_remaining_runtime();<br>
+       float rem_p = 1 - remaining_runtime / pair->exec_time_start;<br>
<br>
        if ((SAMPLING_SLICE < rem_p) && (pair->sampling > 0)) {<br>
                tst_res(TINFO, "Stopped sampling at %d (out of %d) samples, "<br>
@@ -644,7 +645,7 @@ static inline int tst_fzsync_run_a(struct tst_fzsync_pair *pair)<br>
                tst_fzsync_pair_info(pair);<br>
        }<br>
<br>
-       if (rem_p >= 1) {<br>
+       if (!remaining_runtime) {<br>
                tst_res(TINFO,<br>
                        "Exceeded execution time, requesting exit");<br>
                tst_atomic_store(1, &pair->exit);<br>
<br>
<br>
Does that fix your problem?<br></blockquote><div><br></div><div class="gmail_default" style="font-size:small">This amendment is more readable but does not solve the original problem.</div></div><div><br></div>-- <br><div dir="ltr"><div dir="ltr"><div>Regards,<br></div><div>Li Wang<br></div></div></div></div>