public inbox for cygwin-patches@cygwin.com
 help / color / mirror / Atom feed
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin-patches@cygwin.com
Subject: Re: Fix nanosleep returning negative rem
Date: Thu, 22 Jul 2021 10:01:07 +0200	[thread overview]
Message-ID: <YPklw5blHYSEN7O5@calimero.vinschen.de> (raw)
In-Reply-To: <2271051beb734ce984ed71eab4180746@metastack.com>

On Jul 21 16:02, David Allsopp wrote:
> 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.

Weird.  I pushed your patch.

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

As timers go, the timer behind the NtCreateTimer scenes is a simple
interrupt based timer with a default resolution of 15 ms.


Thanks,
Corinna

      parent reply	other threads:[~2021-07-22  8:01 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
2021-07-21 17:57           ` Lavrentiev, Anton (NIH/NLM/NCBI) [C]
2021-07-22  8:01           ` Corinna Vinschen [this message]

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=YPklw5blHYSEN7O5@calimero.vinschen.de \
    --to=corinna-cygwin@cygwin.com \
    --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).