public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Ulrich Windl" <Ulrich.Windl@rz.uni-regensburg.de>
To: linux-kernel@vger.kernel.org
Subject: patch: 2.4.0/2.5.0: nanoseconds time resolution
Date: Mon, 22 Jan 2001 09:10:29 +0100	[thread overview]
Message-ID: <3A6BF8F9.26580.FB55D37@localhost> (raw)

[-- Attachment #1: Mail message body --]
[-- Type: text/plain, Size: 1155 bytes --]

Hello,

I have spend some time making a patch against the Linux kernel to 
switch to nanoseconds time resolution together with several time-
related updates. I really need support for architectures other than 
i386, specifically a routine that has a very fine and accurate time 
resolution (just using ns == 1000*us isn't the best choice).

For the 2.4.0 patch the ia64, sh, mips64, and parisc architectures are 
completely not done, and the other architectures are either untested or 
done sub-optiomal.

Therefore I put together a simple "hacking document" (see attachment) 
to guide you when trying to port the code.  More text can be found in 
Documentation/kernel-time.txt after the patch, or in the distribution 
for Linux 2.2 (PPSkit-1.0.2.tar*) So please spend an hour or two to 
help me out there. I hope I'm not forced to drop the project.

Unless you can convince me not to have a /proc/sys/kernel/time 
directory, I'd also suggest to accept the patch for 
/usr/src/linux/include/sysctl.h for the standard kernel. Currently I 
have allocated "50" for the "time" entry. I'd like to have a stable 
number for the future.

Regards,
Ulrich Windl



[-- Attachment #2: Text from file 'hacking' --]
[-- Type: text/plain, Size: 3006 bytes --]

=====================================================================
A sketch on what to consider when implementing the new time framework
on new architectures (like ia64, mips64, parisc, sh).
=====================================================================
(See
http://ftp.kernel.org/pub/linux/daemons/ntp/PPS/PPS-2.4.0-pre3.tar.bz2
for an implementation for i386)

* Add new config variables to `config.in' and `defconfig' (CONFIG_NTP,
  CONFIG_NTP_PPS, CONFIG_NTP_PPS_SERIAL)

* use `<time.h>' instead of `<timex.h>' or `<sched.h>' to access
  kernel time.

* The kernel knows how to convert kernel time to CMOS time, don't mess
  with time zones yourself

* time is kept in nanoseconds. `do_fast_gettimeoffset()' is replaced
  with `do_exact_nanotime()' that returns nanoseconds passed since
  occurrence of the last timer interrupt. `do_slow_gettimeoffset()' is
  replaced with `do_poor_nanotime()' accordingly.

* `do_gettimeofday()' and `do_settimeofday()' are implemented in the
  architecture-independent module, messing with all the status
  updates.  The common code uses the `do_nanotime()' callback to call
  the architectures' code (allowing code selection during runtime or
  boot-up).

* `set_rtc_mmss()' is called `update_rtc()' now, and it sets the
  complete date and time (not just minutes). A new `ktime_to_rtc()'
  converts kernel time to broken down time components suitable to
  write to CMOS RTC.  `mktime()' is also architecture-independent
  now. The new `rtc_to_ktime()' is used after reading the RTC to get
  kernel time.

* a new `timevar_init()' initializes all the time variables.

* `struct timex' has been changed significantly while trying to
  preserve binary compatibility as far as possible.

* time routines are in `kernel/time.c' now, and `xtime', the kernel's
  representation of time, is protected by `rwlock_t xtime_lock'.  A
  new `rtc_runs_localtime' determines if time-zone corrections have to
  be made for RTC time updates. A new data type `l_fp', a 64bit
  quantity, is used for some internal time variables (needed by the
  NTP clock model).

* a new sysctl interface allows controlling of some time variables,
  most notably the time zone and `rtc_runs_localtime'.  While
  adjusting `time_tick' (the former `tick') is deprecated for NTP
  applications, it allows fine compensation of systematic clock
  errors.

* When the kernel time is set, the RTC update procedure is triggered.

* Old routines are implemented using POSIX-alike `do_clock_gettime()'
  and `do_clock_settime()'. There's also a `do_clock_getres()' that
  gives quite realistic (not optimistic) estimates.

* `adjtimex()' has been significantly reworked, just as most of the
  other time-keeping routines.

* Updating the RTC is controlled by new variables: `rtc_update_slave',
  when non-zero, controls after how many seconds the RTC has to be
  updated. Internally `last_rtc_update' keeps the time of the last
  update.  Upon update the `rtc_update_slave' is cleared on success.

             reply	other threads:[~2001-01-22  8:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200101230355.f0N3tQU24971@saturn.cs.uml.edu>
2001-01-22  8:10 ` Ulrich Windl [this message]
2001-01-23  7:37   ` patch: 2.4.0/2.5.0: nanoseconds time resolution Ulrich Windl

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=3A6BF8F9.26580.FB55D37@localhost \
    --to=ulrich.windl@rz.uni-regensburg.de \
    --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