[LTP] [PATCH 1/2] setitimer01: add interval timer test

Li Wang liwang@redhat.com
Tue Nov 15 11:00:59 CET 2022


Richard Palethorpe <rpalethorpe@suse.de> wrote:


> >
> >  Practically speaking we have to assume a large amount of time has passed
> >  when using ITIMER_REAL. It has to be *much* larger than a VM is likely
> >  to be paused for and then successfully resumed. Or the amount of time a
> >  clock may be corrected by (for e.g. with NTP).
> >
> > Hmm, not sure if I understand correctly above, will that
> > timer value be out of the range but reasonable?
> >
> > Or is there any additional situation we should cover?
>
> Sorry that is confusing.
>
> The question is what happens if the clock jumps backwards?
>
> I don't see anything which says it_value.tv_sec can't go out of
> range. OTOH I would expect it to compensate for large jumps in time.
>
> If the test randomly fails because it_value.tv_sec > time_sec then what
> action will we take?
>

How about increasing the time_sec on virtual machine?

Seems no perfect way to completely resolve but only reducing
the odds of happening.

Or do you have another better suggestion?

--- a/testcases/kernel/syscalls/setitimer/setitimer01.c
+++ b/testcases/kernel/syscalls/setitimer/setitimer01.c
@@ -142,6 +142,11 @@ static void setup(void)

        time_sec  = 9 + time_step / 1000;
        time_usec = 3 * time_step;
+
+       if (tst_is_virt(VIRT_ANY)) {
+               tst_res(TINFO, "Running in a VM, multiply the time_sec by
10.");
+               time_sec *= 10;
+       }
 }


-- 
Regards,
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20221115/cb05d5b9/attachment.htm>


More information about the ltp mailing list