<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-size:small">Hi Jan,</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Oct 11, 2019 at 4:24 PM Li Wang <<a href="mailto:liwang@redhat.com">liwang@redhat.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div style="font-size:small"><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Oct 9, 2019 at 10:43 PM Jan Stancek <<a href="mailto:jstancek@redhat.com" target="_blank">jstancek@redhat.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">read_all is currently retrying only for short time period and it's<br>
retrying to queue for same worker. If that worker is busy, it easily<br>
hits timeout.<br>
<br>
For example 'kernel_page_tables' on aarch64 can take long time to open/read:<br>
  # time dd if=/sys/kernel/debug/kernel_page_tables of=/dev/null count=1 bs=1024<br>
  1+0 records in<br>
  1+0 records out<br>
  1024 bytes (1.0 kB, 1.0 KiB) copied, 13.0531 s, 0.1 kB/s<br>
<br>
  real    0m13.066s<br>
  user    0m0.000s<br>
  sys     0m13.059s<br>
<br>
Rather than retrying to queue for specific worker, pick any that can accept<br>
the work and keep trying until we succeed or hit test timeout.<br></blockquote></div></div></blockquote><div><br></div><div><div class="gmail_default" style="font-size:small">RFC:</div><br></div><div><div class="gmail_default" style="font-size:small">Base on your patch, I'm thinking to achieve a new macro TST_INFILOOP_FUNC which can repeat the @FUNC infinitely. Do you feel it satisfies your requirements to some degree or meaningful to LTP?</div></div><div><div class="gmail_default" style="font-size:small"></div><div class="gmail_default" style="font-size:small">+/**<br>+ * TST_INFILOOP_FUNC() - Infinitely retry a function with an increasing delay.<br>+ * @FUNC - The function which will be retried<br>+ * @ERET - The value returned from @FUNC on success<br>+ *<br>+ * This macro will call @FUNC in an infinite loop with a delay. If @FUNC<br>+ * returns @ERET then the loop exits. The delay between retries starts at one<br>+ * microsecond and is then doubled each iteration until it exceeds one second.<br>+ * When the delay exceeds one-second @FUNC keep repeat until get success or hit<br>+ * test timeout.<br>+ */<br>+#define TST_INFILOOP_FUNC(FUNC, ERET) \<br>+       TST_RETRY_FN_EXP_BACKOFF(FUNC, ERET, -1)<br>+<br> #define TST_RETRY_FN_EXP_BACKOFF(FUNC, ERET, MAX_DELAY)        \<br>-({     int tst_delay_ = 1;                                             \<br>+({     int tst_delay_ = 1, tst_max_delay_ = MAX_DELAY;                 \<br>+       if (MAX_DELAY < 0)                                              \<br>+                tst_max_delay_ *= MAX_DELAY;                           \<br>        for (;;) {                                                      \<br>                typeof(FUNC) tst_ret_ = FUNC;                           \<br>                if (tst_ret_ == ERET)                                   \<br>                        break;                                          \<br>-               if (tst_delay_ < MAX_DELAY * 1000000) {                 \<br>-                       usleep(tst_delay_);                             \<br>+               usleep(tst_delay_);                                     \<br>+               if (tst_delay_ < tst_max_delay_ * 1000000) {            \<br>                        tst_delay_ *= 2;                                \<br>                } else {                                                \<br>-                       tst_brk(TBROK, #FUNC" timed out");              \<br>+                        if (MAX_DELAY > 0)                             \<br>+                               tst_brk(TBROK, #FUNC" timed out");      \<br>                }                                                       \<br>        }                                                               \<br>        ERET;                                                           \</div></div></div><div><br></div><div><div class="gmail_default" style="font-size:small">Add pastebin to better readable: <a href="http://pastebin.test.redhat.com/805437">http://pastebin.test.redhat.com/805437</a></div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>Regards,<br></div><div>Li Wang<br></div></div></div></div>