public inbox for cygwin-patches@cygwin.com
 help / color / mirror / Atom feed
From: David Allsopp <David.Allsopp@cl.cam.ac.uk>
To: "cygwin-patches@cygwin.com" <cygwin-patches@cygwin.com>
Subject: RE: Fix nanosleep returning negative rem
Date: Wed, 21 Jul 2021 16:02:29 +0000	[thread overview]
Message-ID: <2271051beb734ce984ed71eab4180746@metastack.com> (raw)
In-Reply-To: <YPfp0WgZUVo0nap7@calimero.vinschen.de>

Corinna Vinschen wrote:
> Sent: 21 July 2021 10:33
> To: cygwin-patches@cygwin.com
> Subject: Re: Fix nanosleep returning negative rem
> 
> On Jul 21 11:30, Corinna Vinschen wrote:
> > I wrote a quick STC using the NT API calls and I can't reproduce the
> > problem with this code either.  The output is either
> >
> >   SignalState: 1 TimeRemaining: -5354077459183
> >
> > or
> >
> >   SignalState: 0 TimeRemaining: 653
> >
> > I never get a small negative value in the latter case.  Can you
> > reproduce your problem with this testcase or tweak it to reproduce it?
> 
> Now I actually attached the code :}

:) Yes, I can reproduce - I didn't even need a loop! Third time:

  dra@Thor /cygdrive/c/Scratch/nanosleep
  $ ./timer
  SignalState: 0 TimeRemaining: -1151

That said, I can get it easily get this on my desktop (AMD Ryzen Threadripper 3990X) but not at all on my laptop (Intel Core i7-8650U). On the laptop, ignoring the couple of signalled cases, 747 runs of timer.c give values between 131597-149947 with a very narrow SD (~4000) whereas on the AMD chip, 738 runs gives a range of -2722 to 149896 with a relatively wider SD of ~23000.

The CI system where this was first seen is an virtualised Intel system so it doesn't appear to be as simple as CPU manufacturer or even core count. That said, I'm not at all familiar with the details of how this works, but I expect the timer for these things is part of the chipset, not the CPU?!

Best,


D

  reply	other threads:[~2021-07-21 16:02 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-20 15:16 David Allsopp
2021-07-21  8:39 ` Corinna Vinschen
2021-07-21  9:07   ` David Allsopp
2021-07-21  9:30     ` Corinna Vinschen
2021-07-21  9:33       ` Corinna Vinschen
2021-07-21 16:02         ` David Allsopp [this message]
2021-07-21 17:57           ` Lavrentiev, Anton (NIH/NLM/NCBI) [C]
2021-07-22  8:01           ` Corinna Vinschen

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=2271051beb734ce984ed71eab4180746@metastack.com \
    --to=david.allsopp@cl.cam.ac.uk \
    --cc=cygwin-patches@cygwin.com \
    /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).