mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: Andy Whitcroft <apw@shadowen.org>
Cc: johnstul@us.ibm.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] timer tsc ensure we allow for initial tsc and tsc sync
Date: Tue, 31 Jan 2006 15:21:13 -0800	[thread overview]
Message-ID: <20060131152113.14781abf.akpm@osdl.org> (raw)
In-Reply-To: <43DE14F0.5070208@shadowen.org>

Andy Whitcroft <apw@shadowen.org> wrote:
>
> From: John Stultz <johnstul@us.ibm.com>
> 
> Suppress lost tick detection until we are fully initialised.
> This prevents any modifications to the high resolution timers
> from causing non-linearities in the flow of time.  For example on
> an SMP system we resyncronise the TSC values for all processors.
> This results in a TSC reset which will be seen as a huge apparent
> tick loss.  This can cause premature expiry of timers and in extreme
> cases can cause the soft lockup detection to fire.
> 
> Acked-by: Andy Whitcroft <apw@shadowen.org>
> 
> diff --git a/arch/i386/kernel/timers/timer_tsc.c b/arch/i386/kernel/timers/timer_tsc.c
> --- a/arch/i386/kernel/timers/timer_tsc.c
> +++ b/arch/i386/kernel/timers/timer_tsc.c
> @@ -45,6 +45,15 @@ static unsigned long last_tsc_high; /* m
>  static unsigned long long monotonic_base;
>  static seqlock_t monotonic_lock = SEQLOCK_UNLOCKED;
>  
> +/* Avoid compensating for lost ticks before TSCs are synched */
> +static int detect_lost_ticks;
> +static int __init start_lost_tick_compensation(void)
> +{
> +	detect_lost_ticks = 1;
> +	return 0;
> +}
> +late_initcall(start_lost_tick_compensation);
> +
>  /* convert from cycles(64bits) => nanoseconds (64bits)
>   *  basic equation:
>   *		ns = cycles / (freq / ns_per_sec)
> @@ -196,7 +205,8 @@ static void mark_offset_tsc_hpet(void)
>  
>  	/* lost tick compensation */
>  	offset = hpet_readl(HPET_T0_CMP) - hpet_tick;
> -	if (unlikely(((offset - hpet_last) > hpet_tick) && (hpet_last != 0))) {
> +	if (unlikely(((offset - hpet_last) > hpet_tick) && (hpet_last != 0))
> +					&& detect_lost_ticks) {

Simple enough.  John, so you feel that this is 2.6.16 material?

Note that the time changes in -mm will blow this change away, so I'd be
needing a fresh version of this patch against next-mm, please.

  reply	other threads:[~2006-01-31 23:19 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-20 12:53 Andy Whitcroft
2006-01-27 22:11 ` john stultz
2006-01-30 13:30   ` Andy Whitcroft
2006-01-31 23:21     ` Andrew Morton [this message]
2006-01-31 23:28       ` john stultz
2006-01-31 23:40         ` Andrew Morton

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=20060131152113.14781abf.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=apw@shadowen.org \
    --cc=johnstul@us.ibm.com \
    --cc=linux-kernel@vger.kernel.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

all inboxes | Powered by JetHome®