Linux PARISC architecture development
 help / color / mirror / Atom feed
From: Stan Sieler <sieler@allegro.com>
To: Philipp.H.Rumpf@mathe.stud.uni-erlangen.de (Philipp Rumpf)
Cc: parisc-linux@thepuffingroup.com
Subject: Re: [parisc-linux] Progress
Date: Wed, 24 Nov 1999 11:00:39 -0800 (PST)	[thread overview]
Message-ID: <199911241900.LAA30325@opus.allegro.com> (raw)
In-Reply-To: <19991124110032.I1009@mathe.stud.uni-erlangen.de> from "Philipp Rumpf" at Nov 24, 1999 11:00:32 AM

Re:

> Look at the loop.  What we do is basically
> 
> 	cr16 = mfctl(16);
> 	while(((cr16+loops)-mfctl(16))>0);

You definitely don't want to do the above!

Even ignoring the possibility of an interrupt that takes us away
for awhile, there's the simple possibility that cr16 might
roll over during your loop.
(On a 100 MHz machine, with it ticking once per clock,
it rolls over about once every 40 seconds or so.)
This means you have an non-0 (although low) probability that your
loop may screw you up royally!

For example, if CR16 was 10 ticks away from rolling over, and
you wanted to delay for 9 ticks there's a non-0 probability
that it will rollover in between checks... poof, a 40 second delay
occurs in your loop! (Perhaps more, if you don't happen to grab
the cr16 within an acceptable window of time at the end of the 40 seconds.)

Detailing the above:

   cr16 = mfctl (16);    (and get's max-10)
   cr16 + 9 = max - 1
   after 4 to 20 loops, depending upon cr16 implementation on the machine,
   you *could* get to:
       while (  ((max - 1) - (max - 2)) > 0)
   and then loop back and get
       while (  ((max - 1) - (0)      ) > 0)

The likelihood of this (an observed rollover fouling you up) would be
greatly minimized if you added code to note the delta in each two
successive reads of cr16 and terminating if the delta became negative
or quite large.

> And what exactly would be the advantage ?

Not having sporadic hangs of 40 seconds?  (or more) 

-- 
Stan Sieler                                           sieler@allegro.com
www.allegro.com/sieler/wanted/index.html          www.allegro.com/sieler

  reply	other threads:[~1999-11-24 18:59 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-11-18 23:16 [parisc-linux] Progress John David Anglin
1999-11-19  3:30 ` Philipp Rumpf
1999-11-21 23:07   ` John David Anglin
1999-11-22  1:12     ` John David Anglin
1999-11-22  8:24       ` Philipp Rumpf
1999-11-22  9:59         ` Alan Cox
1999-11-22 15:54           ` Philipp Rumpf
1999-11-22  7:30     ` Philipp Rumpf
1999-11-22 18:11       ` John David Anglin
1999-11-22 18:27         ` Stan Sieler
1999-11-22 18:42           ` Philipp Rumpf
1999-11-22 18:33         ` Philipp Rumpf
1999-11-22 20:55           ` John David Anglin
1999-11-23 11:47             ` Philipp Rumpf
1999-11-23 16:19               ` John David Anglin
1999-11-23 18:03                 ` Philipp Rumpf
1999-11-23 19:01                   ` John David Anglin
1999-11-23 21:11                   ` Stan Sieler
1999-11-24 10:00                     ` Philipp Rumpf
1999-11-24 19:00                       ` Stan Sieler [this message]
1999-11-24 19:33                         ` Philipp Rumpf
1999-11-24 20:55                           ` [parisc-linux] Progress - Update John David Anglin
1999-11-24 21:05                             ` Philipp Rumpf
1999-11-24 21:27                               ` Kirk Bresniker
1999-11-24 21:37                                 ` Philipp Rumpf
1999-11-24 22:38                                   ` Frank Rowand
1999-11-24 23:24                                     ` Cache Flushes Grant Grundler
1999-11-25  0:31                             ` [parisc-linux] Progress - Update John David Anglin
1999-11-25  1:17                               ` Alan Cox
1999-11-25 13:24                                 ` Philipp Rumpf
1999-11-25 23:47                                   ` John David Anglin
1999-11-30 18:17                                     ` John David Anglin
1999-11-30 18:21                                       ` Alan Cox
1999-11-30 18:32                                       ` Philipp Rumpf
1999-11-30 19:31                                         ` Alan Cox
1999-11-30 20:14                                           ` Mark Klein
1999-11-30 23:40                                             ` John David Anglin
1999-12-01 15:41                                               ` Philipp Rumpf
1999-12-01 18:03                                                 ` Alan Cox
1999-12-01 18:29                                                   ` Alex deVries
1999-12-01 18:34                                                     ` Alan Cox
1999-12-02  2:51                                                     ` Philipp Rumpf
1999-12-01 18:33                                                   ` John David Anglin
1999-12-01 18:54                                                     ` Alan Cox
1999-12-01 18:55                                                     ` Grant Grundler
1999-11-26 13:40                             ` Matthew Wilcox
1999-11-23 15:59       ` [parisc-linux] Progress Paul Bame
1999-11-23 16:33         ` John David Anglin
1999-11-23 17:05           ` Paul Bame
1999-11-23 20:15         ` John David Anglin

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=199911241900.LAA30325@opus.allegro.com \
    --to=sieler@allegro.com \
    --cc=Philipp.H.Rumpf@mathe.stud.uni-erlangen.de \
    --cc=parisc-linux@thepuffingroup.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