All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jun Sun <jsun@mvista.com>
To: "Maciej W. Rozycki" <macro@ds2.pg.gda.pl>
Cc: Ralf Baechle <ralf@linux-mips.org>,
	linux-mips@linux-mips.org, jsun@mvista.com
Subject: Re: [patch] Generic time trailing clean-ups
Date: Mon, 11 Aug 2003 11:34:28 -0700	[thread overview]
Message-ID: <20030811113428.F9020@mvista.com> (raw)
In-Reply-To: <Pine.GSO.3.96.1030811144812.19197C-100000@delta.ds2.pg.gda.pl>; from macro@ds2.pg.gda.pl on Mon, Aug 11, 2003 at 03:02:16PM +0200

On Mon, Aug 11, 2003 at 03:02:16PM +0200, Maciej W. Rozycki wrote:
> Hello,
> 
>  Here is hopefully the final part (for now) of the generic time changes.
> It addresses the following problems:
> 
> -	 */
> -	if (!jiffies) {
> -		timerhi = timerlo = 0;
> -		mips_hpt_init(count);
> +	 *
> +	 * The first timer interrupt comes late as interrupts are
> +	 * enabled long after timers are initialized.  Therefore the
> +	 * high precision timer is fast, leading to wrong gettimeoffset()
> +	 * calculations.  We deal with it by setting it based on the
> +	 * number of its ticks between the second and the third interrupt.
> +	 * That is still somewhat imprecise, but it's a good estimate.
> +	 * --macro
> +	 */
> +	j = jiffies;
> +	if (j < 4) {
> +		static unsigned int prev_count;
> +		static int hpt_initialized;
> +
> +		switch (j) {
> +		case 0:
> +			timerhi = timerlo = 0;
> +			mips_hpt_init(count);
> +			break;
> +		case 2:
> +			prev_count = count;
> +			break;
> +		case 3:
> +			if (!hpt_initialized) {
> +				unsigned int c3 = 3 * (count - prev_count);
> +
> +				timerhi = 0;
> +				timerlo = c3;
> +				mips_hpt_init(count - c3);
> +				hpt_initialized = 1;
> +			}
> +			break;
> +		default:
> +			break;
> +		}
>  	}
> 

The first gettimeoffset() call is way after many jiffies (~50 normally?).  Such
an estimate is not necessary.

Also note jiffies can wrap around.  

Jun

  reply	other threads:[~2003-08-11 18:34 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-08-11 13:02 [patch] Generic time trailing clean-ups Maciej W. Rozycki
2003-08-11 18:34 ` Jun Sun [this message]
2003-08-12 13:34   ` Maciej W. Rozycki
2003-08-12 17:05     ` Jun Sun
2003-08-13 12:25       ` Maciej W. Rozycki
2003-08-13 16:45         ` Jun Sun
2003-08-14 11:31           ` Maciej W. Rozycki
2003-08-14 16:13             ` Jun Sun
2003-08-14 16:35               ` Maciej W. Rozycki
2003-08-14 16:52                 ` Jun Sun
2003-08-16 12:32                   ` Maciej W. Rozycki

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=20030811113428.F9020@mvista.com \
    --to=jsun@mvista.com \
    --cc=linux-mips@linux-mips.org \
    --cc=macro@ds2.pg.gda.pl \
    --cc=ralf@linux-mips.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.