From: Mike Crowe <mac@mcrowe.com>
To: libc-alpha@sourceware.org
Subject: Re: [PATCH 6/7] nptl/tst-rwlock: Use clock_gettime/timespec rather than gettimeofday/timeval
Date: Wed, 20 Mar 2019 21:34:05 +0000 [thread overview]
Message-ID: <20190320213405.2qvmy4qaputhh76b@mcrowe.com> (raw)
In-Reply-To: <8bff34e7-d471-8dfa-0959-f7535a7cad57@linaro.org>
On Tuesday 05 March 2019 at 15:02:21 -0300, Adhemerval Zanella wrote:
> On 27/02/2019 15:23, Mike Crowe wrote:
> > In preparation for adding pthread_rwlock_clockrdlock and
> > pthread_rwlock_clockwrlock, convert various tests to only use clock_gettime
> > and struct timespec.
> >
> > * support/timespec.h: Create header to provide timespec helper functions
> > from sysdeps/pthread/posix-timer.h for tests to use.
> >
> > * nptl/tst-rwlock6.c: Fix small bug in timeout-checking code that could
> > erroneously pass if the function incorrectly took more than a second.
> >
> > * nptl/tst-rwlock6.c: Use clock_gettime(2) rather than gettimeofday(2) and
> > then converting to timespec in preparation for testing
> > pthread_rwlock_clockrdclock and pthread_rwlock_clockwrlock.
> >
> > * nptl/tst-rwlock9.c, nptl/tst-rwlock7.c: Likewise.
>
> I am seeing this issue sporadically on i686-linux-gnu with 6/7 patches
> applied:
>
> $ ./testrun.sh nptl/tst-rwlock7 --direct
> 0: got timedrdlock
> child: timedwrlock failed with ETIMEDOUT
> child: timedwrlock failed with EINVAL
> 1: got timedrdlock
> child: timedwrlock failed with ETIMEDOUT
> child: timedwrlock failed with EINVAL
> 2: got timedrdlock
> child: timedwrlock failed with ETIMEDOUT
> 2nd timedwrlock did not return EINVAL
> failure in round 2
Sorry, I hadn't spotted this part of your email until today. Luckily it's
clear what I got wrong and why I didn't see it on AArch64 and x86_64:
> > + struct timespec ts_invalid;
> > + (void) clock_gettime (CLOCK_REALTIME, &ts_invalid);
> > + ts_invalid.tv_sec += 10;
> > /* Note that the following operation makes ts invalid. */
> > - ts.tv_nsec += 1000000000;
> > + ts_invalid.tv_nsec += 1000000000000;
I got so used to converting from µs to ns that I added three extra zeroes
unnecessarily here. It fits in a 64-bit long, but not a 32-bit one.
Thanks. I shall do more testing on 32-bit targets.
Mike.
next prev parent reply other threads:[~2019-03-20 21:34 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-27 18:23 [PATCH 0/7] Implement proposed POSIX _clockwait variants of existing _timedwait functions Mike Crowe
2019-02-27 18:23 ` [PATCH 1/7] nptl: Add clockid parameter to futex timed wait calls Mike Crowe
2019-03-05 12:39 ` Adhemerval Zanella
2019-03-10 8:59 ` Mike Crowe
2019-03-11 11:50 ` Adhemerval Zanella
2019-02-27 18:23 ` [PATCH 2/7] nptl: Add POSIX-proposed sem_clockwait Mike Crowe
2019-02-27 18:35 ` Joseph Myers
2019-03-05 13:31 ` Adhemerval Zanella
2019-03-10 16:17 ` Mike Crowe
2019-03-19 17:07 ` Adhemerval Zanella
2019-03-14 14:09 ` Yann Droneaud
2019-03-14 14:39 ` Mike Crowe
2019-02-27 18:23 ` [PATCH 3/7] nptl: Add POSIX-proposed pthread_cond_clockwait Mike Crowe
2019-03-05 16:45 ` Adhemerval Zanella
2019-05-04 20:22 ` Mike Crowe
2019-02-27 18:23 ` [PATCH 4/7] nptl: pthread_rwlock: Move timeout validation into _full functions Mike Crowe
2019-03-05 16:48 ` Adhemerval Zanella
2019-02-27 18:23 ` [PATCH 5/7] nptl/tst-rwlock14: Test pthread/rwlock_timedwrlock correctly Mike Crowe
2019-03-05 17:36 ` Adhemerval Zanella
2019-02-27 18:23 ` [PATCH 6/7] nptl/tst-rwlock: Use clock_gettime/timespec rather than gettimeofday/timeval Mike Crowe
2019-03-05 18:02 ` Adhemerval Zanella
2019-03-20 21:34 ` Mike Crowe [this message]
2019-03-14 14:44 ` Yann Droneaud
2019-02-27 18:23 ` [PATCH 7/7] nptl: Add POSIX-proposed pthread_rwlock_clockrdlock & pthread_rwlock_clockwrlock Mike Crowe
2019-03-07 12:59 ` Adhemerval Zanella
2019-03-05 12:35 ` [PATCH 0/7] Implement proposed POSIX _clockwait variants of existing _timedwait functions Adhemerval Zanella
2019-03-06 21:15 ` Joseph Myers
2019-03-10 9:12 ` Mike Crowe
2019-03-11 23:13 ` Joseph Myers
2019-03-13 21:42 ` Mike Crowe
2019-03-14 11:30 ` Adhemerval Zanella
2019-03-15 13:25 ` Yann Droneaud
2019-03-15 13:36 ` Mike Crowe
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
List information: https://www.gnu.org/software/libc/involved.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190320213405.2qvmy4qaputhh76b@mcrowe.com \
--to=mac@mcrowe.com \
--cc=libc-alpha@sourceware.org \
/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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).