public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Richard Palethorpe <rpalethorpe@suse.de>
To: Li Wang <liwang@redhat.com>
Cc: Andrea Cervesato <acervesato@suse.de>, ltp@lists.linux.it
Subject: Re: [LTP] [PATCH 1/2] setitimer01: add interval timer test
Date: Tue, 15 Nov 2022 11:04:36 +0000	[thread overview]
Message-ID: <87zgcsqxoc.fsf@suse.de> (raw)
In-Reply-To: <CAEemH2d=65BMhY4RFXHS1d5dkbq7v2QDskfE_5b_WnttDXT+Fg@mail.gmail.com>

Hello,

Li Wang <liwang@redhat.com> writes:

> On Tue, Nov 15, 2022 at 6:00 PM Li Wang <liwang@redhat.com> wrote:
>
>  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?
>
> Or, we do nothing on this, just let the test report TFAIL, because that
> is not what this test can control.
>
>  
>  
>  How about increasing the time_sec on virtual machine?

It could happen on bare metal as well.

>
>  Seems no perfect way to completely resolve but only reducing
>  the odds of happening. 
>
>  Or do you have another better suggestion?

TBH I don't know if it will happen. An acceptable outcome for me is to
print the time at the beginning and end of the test. Then if the test
fails we can see if it was due to a time jump and start investigating
what the kernel is supposed to do in this case.

The alternative is to find out now what the kernel should do. We could
also write a test which deliberately changes the system time during an
interval. Depending how motivated you are.

>
>  --- 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


-- 
Thank you,
Richard.

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

  reply	other threads:[~2022-11-15 11:12 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-12  4:01 [LTP] [PATCH 1/2] setitimer01: add interval timer test Li Wang
2022-11-12  4:01 ` [LTP] [PATCH 2/2] getitimer01: add checking for nonzero timer Li Wang
2022-11-14 16:02   ` Richard Palethorpe
2022-11-14 14:32 ` [LTP] [PATCH 1/2] setitimer01: add interval timer test Richard Palethorpe
2022-11-15  4:00   ` Li Wang
2022-11-15  8:44     ` Richard Palethorpe
2022-11-15 10:00       ` Li Wang
2022-11-15 10:08         ` Li Wang
2022-11-15 11:04           ` Richard Palethorpe [this message]
2022-11-16 10:25             ` Li Wang
2022-11-15  9:27     ` Andrea Cervesato via ltp
  -- strict thread matches above, loose matches on Subject: below --
2022-10-25 12:18 Li Wang
2022-11-04  7:08 ` Li Wang
2022-11-07 12:11   ` Richard Palethorpe
2022-11-08  1:14     ` Li Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zgcsqxoc.fsf@suse.de \
    --to=rpalethorpe@suse.de \
    --cc=acervesato@suse.de \
    --cc=liwang@redhat.com \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox