public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: George Anzinger <george@mvista.com>
To: john stultz <johnstul@us.ibm.com>
Cc: lkml <linux-kernel@vger.kernel.org>,
	tim@physik3.uni-rostock.de, albert@users.sourceforge.net,
	Ulrich.Windl@rz.uni-regensburg.de, clameter@sgi.com,
	Len Brown <len.brown@intel.com>,
	linux@dominikbrodowski.de, David Mosberger <davidm@hpl.hp.com>,
	Andi Kleen <ak@suse.de>,
	paulus@samba.org, schwidefsky@de.ibm.com, jimix@us.ibm.com,
	keith maanthey <kmannth@us.ibm.com>, greg kh <greg@kroah.com>,
	Patricia Gaughen <gone@us.ibm.com>,
	Chris McDermott <lcm@us.ibm.com>
Subject: Re: [RFC][PATCH] new timeofday i386 hooks (v.A0)
Date: Thu, 02 Sep 2004 18:44:37 -0700	[thread overview]
Message-ID: <4137CC85.4040802@mvista.com> (raw)
In-Reply-To: <1094159492.14662.325.camel@cog.beaverton.ibm.com>

john stultz wrote:
> All,
> 	This patch implements the minimal i386 architecture hooks to enable the
> new time of day subsystem code. It applies on top of my
> linux-2.6.9-rc1_timeofday-core_A0 patch and with this patch applied, you
> can test the new time of day subsystem on i386. Basically it adds the
> call to timeofday_interrupt_hook() and cuts alot of code out of the
> build. The only new code is the sync_persistant_clock() function which
> is mostly ripped out of do_timer_interrupt(). Pretty un-interesting.
> 
> I look forward to your comments and feedback.
> 
> thanks
> -john
> 
> linux-2.6.9-rc1_timeofday-i386_A0.patch
> =======================================
> diff -Nru a/arch/i386/Kconfig b/arch/i386/Kconfig
> --- a/arch/i386/Kconfig	2004-09-02 13:29:59 -07:00
> +++ b/arch/i386/Kconfig	2004-09-02 13:29:59 -07:00
> @@ -14,6 +14,10 @@
>  	  486, 586, Pentiums, and various instruction-set-compatible chips by
>  	  AMD, Cyrix, and others.
>  
> +config NEWTOD
> +	bool
> +	default y
> +
>  config MMU
>  	bool
>  	default y
> diff -Nru a/arch/i386/kernel/time.c b/arch/i386/kernel/time.c
> --- a/arch/i386/kernel/time.c	2004-09-02 13:29:59 -07:00
> +++ b/arch/i386/kernel/time.c	2004-09-02 13:29:59 -07:00
> @@ -67,6 +67,8 @@
>  
>  #include "io_ports.h"
>  
> +#include <linux/timeofday.h>
> +
>  extern spinlock_t i8259A_lock;
>  int pit_latch_buggy;              /* extern */
>  
> @@ -87,6 +89,7 @@
>  
>  struct timer_opts *cur_timer = &timer_none;
>  
> +#ifndef CONFIG_NEWTOD
>  /*
>   * This version of gettimeofday has microsecond resolution
>   * and better than microsecond precision on fast x86 machines with TSC.
> @@ -169,6 +172,7 @@
>  }
>  
>  EXPORT_SYMBOL(do_settimeofday);
> +#endif
>  
>  static int set_rtc_mmss(unsigned long nowtime)
>  {
> @@ -194,12 +198,39 @@
>   *		Note: This function is required to return accurate
>   *		time even in the absence of multiple timer ticks.
>   */
> +#ifndef CONFIG_NEWTOD
>  unsigned long long monotonic_clock(void)
>  {
>  	return cur_timer->monotonic_clock();
>  }
>  EXPORT_SYMBOL(monotonic_clock);
> +#endif
>  
> +void sync_persistant_clock(struct timespec ts)
> +{
> +	/*
> +	 * If we have an externally synchronized Linux clock, then update
> +	 * CMOS clock accordingly every ~11 minutes. Set_rtc_mmss() has to be
> +	 * called as close as possible to 500 ms before the new second starts.
> +	 */
> +	if (ts.tv_sec > last_rtc_update + 660 &&
> +	    (ts.tv_nsec / 1000)
> +			>= USEC_AFTER - ((unsigned) TICK_SIZE) / 2 &&
> +	    (ts.tv_nsec / 1000)
> +			<= USEC_BEFORE + ((unsigned) TICK_SIZE) / 2) {
> +		/* horrible...FIXME */
> +		if (efi_enabled) {
> +	 		if (efi_set_rtc_mmss(ts.tv_sec) == 0)
> +				last_rtc_update = ts.tv_sec;
> +			else
> +				last_rtc_update = ts.tv_sec - 600;
> +		} else if (set_rtc_mmss(ts.tv_sec) == 0)
> +			last_rtc_update = ts.tv_sec;
> +		else
> +			last_rtc_update = ts.tv_sec - 600; /* do it again in 60 s */
> +	}
> +
I have wondered, and continue to do so, why this is not a timer driven function. 
  It just seems silly to check this every interrupt when we have low overhead 
timers for just this sort of thing.

I wonder about the load calc in the same way...

Now, the question is how do you hook up the timer list.  We MUST be able to 
start a timer that will run for several min to hours and have it expire such 
that the wall time difference is "really" close to what was requested.  This 
requires some "lock up" between the wall clock and the timer subsystem.

What are your thoughts here?

George


-- 
George Anzinger   george@mvista.com
High-res-timers:  http://sourceforge.net/projects/high-res-timers/
Preemption patch: http://www.kernel.org/pub/linux/kernel/people/rml


  parent reply	other threads:[~2004-09-03  1:52 UTC|newest]

Thread overview: 84+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-02 21:07 [RFC] New Time of day proposal (updated 9/2/04) john stultz
2004-09-02 21:09 ` [RFC][PATCH] new timeofday core subsystem (v.A0) john stultz
2004-09-02 21:11   ` [RFC][PATCH] new timeofday i386 hooks (v.A0) john stultz
2004-09-02 21:12     ` [RFC][PATCH] new timeofday i386 timesources (v.A0) john stultz
2004-09-03  1:44     ` George Anzinger [this message]
2004-09-03  2:06       ` [RFC][PATCH] new timeofday i386 hooks (v.A0) john stultz
2004-09-03  8:07       ` Ulrich Windl
2004-09-03 18:09         ` George Anzinger
2004-09-02 22:19   ` [RFC][PATCH] new timeofday core subsystem (v.A0) Christoph Lameter
2004-09-02 22:28     ` john stultz
2004-09-02 22:42       ` Christoph Lameter
2004-09-02 23:14         ` john stultz
2004-09-02 23:39           ` Christoph Lameter
2004-09-03  0:07             ` john stultz
2004-09-03  0:47               ` Christoph Lameter
2004-09-03  1:30                 ` john stultz
2004-09-03  7:43                   ` George Anzinger
2004-09-03 19:32                     ` john stultz
2004-09-03 16:18                   ` Christoph Lameter
2004-09-03 21:00                     ` john stultz
2004-09-03 22:04                       ` Christoph Lameter
2004-09-03 23:00                         ` john stultz
2004-09-04  0:11                           ` Christoph Lameter
2004-09-03  1:39   ` George Anzinger
2004-09-03  1:58     ` john stultz
2004-09-03  6:42     ` Albert Cahalan
2004-09-03  7:24       ` George Anzinger
2004-09-03 19:27         ` john stultz
2004-09-03 22:10           ` George Anzinger
2004-09-03 23:32             ` john stultz
2004-09-04  0:02               ` George Anzinger
2004-09-08 18:07                 ` john stultz
2004-09-09  0:08                   ` George Anzinger
2004-09-09  0:51                     ` john stultz
2004-09-09  3:14                       ` Christoph Lameter
2004-09-09  3:32                         ` john stultz
2004-09-09  4:31                           ` George Anzinger
2004-09-09  6:37                             ` Jesse Barnes
2004-09-09  8:09                               ` George Anzinger
2004-09-09 19:07                             ` john stultz
2004-09-09 20:49                               ` George Anzinger
2004-09-13 21:29                                 ` Christoph Lameter
2004-09-13 22:25                                   ` john stultz
2004-09-13 22:45                                     ` Christoph Lameter
2004-09-14  6:53                                       ` Ulrich Windl
2004-09-14 17:49                                     ` Christoph Lameter
2004-09-15  0:57                                       ` George Anzinger
2004-09-15  3:32                                         ` Christoph Lameter
2004-09-15  8:04                                           ` George Anzinger
2004-09-15  8:54                                             ` Dominik Brodowski
2004-09-15 17:54                                               ` George Anzinger
2004-09-15  9:12                                             ` Andi Kleen
2004-09-15 15:46                                             ` Christoph Lameter
2004-09-15 18:00                                               ` George Anzinger
2004-09-15 18:28                                                 ` Christoph Lameter
2004-09-15  6:46                                         ` Christoph Lameter
2004-09-15 16:32                                           ` john stultz
2004-09-15 16:46                                             ` Christoph Lameter
2004-09-15 17:13                                               ` john stultz
2004-09-15 17:30                                                 ` Christoph Lameter
2004-09-15 18:48                                                   ` john stultz
2004-09-15 19:58                                                     ` George Anzinger
2004-09-15 20:20                                                     ` Christoph Lameter
2004-09-16  7:02                                                     ` Ulrich Windl
2004-09-03 19:18       ` john stultz
2004-09-02 22:09 ` [RFC] New Time of day proposal (updated 9/2/04) Christoph Lameter
2004-09-02 22:22   ` john stultz
2004-09-02 22:47     ` Christoph Lameter
2004-09-03  9:54 ` Dominik Brodowski
2004-09-03 19:41   ` john stultz
2004-09-03 20:26     ` Dominik Brodowski
2004-09-03 21:05       ` john stultz
2004-09-06  6:26       ` Ulrich Windl
2004-09-06 11:56         ` Alan Cox
2004-09-07 16:14         ` Christoph Lameter
2004-09-03 15:17 ` Andi Kleen
2004-09-03 20:11   ` john stultz
2004-09-04 13:00     ` Andi Kleen
2004-09-07 16:10       ` Christoph Lameter
2004-09-07 18:24         ` George Anzinger
2004-09-07 20:55           ` Christoph Lameter
2004-09-07 21:42             ` George Anzinger
2004-09-08  6:26           ` Ulrich Windl
2004-09-08 18:25       ` john stultz

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=4137CC85.4040802@mvista.com \
    --to=george@mvista.com \
    --cc=Ulrich.Windl@rz.uni-regensburg.de \
    --cc=ak@suse.de \
    --cc=albert@users.sourceforge.net \
    --cc=clameter@sgi.com \
    --cc=davidm@hpl.hp.com \
    --cc=gone@us.ibm.com \
    --cc=greg@kroah.com \
    --cc=jimix@us.ibm.com \
    --cc=johnstul@us.ibm.com \
    --cc=kmannth@us.ibm.com \
    --cc=lcm@us.ibm.com \
    --cc=len.brown@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@dominikbrodowski.de \
    --cc=paulus@samba.org \
    --cc=schwidefsky@de.ibm.com \
    --cc=tim@physik3.uni-rostock.de \
    /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