From: Joerg Vehlow <lkml@jv-coder.de>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] open_posix/timer_getoverrun/2-3: Fix test for systems with low timer precision
Date: Wed, 16 Oct 2019 10:42:26 +0200 [thread overview]
Message-ID: <77c71c80-0ca2-6f67-d628-d337a13539d7@jv-coder.de> (raw)
In-Reply-To: <20191016083822.GA11593@dustball.usersys.redhat.com>
> I didn't change timer resolution, I only used larger interval values
> as multiple of timer resolution:
> ? intervalnsec = largeX * timer_resolution
>
ah ok
> I'd prefer we tweak the tolerance rather than make test run longer.
> I'm thinking just allow ~50ms of extra overruns, and don't be so
> strict about absolute number of overruns. (KVM guests and s390 lpars
> tend to suffer from higher steal time).
>
> diff --git
> a/testcases/open_posix_testsuite/conformance/interfaces/timer_getoverrun/2-3.c
> b/testcases/open_posix_testsuite/conformance/interfaces/timer_getoverrun/2-3.c
>
> index 96b7d01e6ffe..66f8b583a5a6 100644
> ---
> a/testcases/open_posix_testsuite/conformance/interfaces/timer_getoverrun/2-3.c
> +++
> b/testcases/open_posix_testsuite/conformance/interfaces/timer_getoverrun/2-3.c
> @@ -94,11 +94,17 @@ int main(void)
>
> ??????? valuensec = tsres.tv_nsec;
> ??????? intervalnsec = 2 * valuensec;
> -?????? //expectedoverruns = (1000000000 - valuensec) / intervalnsec;
> ??????? expectedoverruns = 1000000000 / intervalnsec - 1;
>
> +?????? /*
> +??????? * waking up from sleep isn't instant, we can overshoot.
> +??????? * Allow up to ~50ms worth of extra overruns.
> +??????? */
> +?????? fudge = 50000000 / intervalnsec + 1;
> +
> ??????? printf("value = %d sec, interval = %d nsec, "
> -????????????? "expected overruns = %d\n", 1, intervalnsec,
> expectedoverruns);
> +????????????? "expected overruns = %d, fudge = %d\n", 1,
> +????????????? intervalnsec, expectedoverruns, fudge);
>
> ??????? its.it_interval.tv_sec = 0;
> ??????? its.it_interval.tv_nsec = intervalnsec;
> @@ -146,7 +152,6 @@ int main(void)
> ???????? * extra expiries after the nanosleep completes so do
> ???????? * a range check.
> ???????? */
> -?????? fudge = expectedoverruns / 100;
> ??????? if (overruns >= expectedoverruns && overruns <
> expectedoverruns + fudge) {
> ??????????????? printf("Test PASSED\n");
> ??????????????? return PTS_PASS;
>
I wonder if there was a way to do this more accurate, like busy waiting
while signals
are blocked. But I would also be fine with your solution.
next prev parent reply other threads:[~2019-10-16 8:42 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-11 5:31 [LTP] [PATCH] open_posix/timer_getoverrun/2-3: Fix test for systems with low timer precision Joerg Vehlow
2019-10-15 15:08 ` Jan Stancek
2019-10-16 5:39 ` Joerg Vehlow
2019-10-16 8:38 ` Jan Stancek
2019-10-16 8:42 ` Joerg Vehlow [this message]
2019-10-16 9:51 ` [LTP] [PATCH] timer_getoverrun/2-3: increase tolerance for overshoot Jan Stancek
2019-10-17 12:54 ` Cyril Hrubis
2019-10-18 7:58 ` Jan Stancek
2019-10-18 8:02 ` Joerg Vehlow
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=77c71c80-0ca2-6f67-d628-d337a13539d7@jv-coder.de \
--to=lkml@jv-coder.de \
--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