All of lore.kernel.org
 help / color / mirror / Atom feed
From: Colin D Bennett <colin@gibibit.com>
To: grub-devel@gnu.org
Subject: Re: [RFC] High resolution time support using x86 TSC
Date: Fri, 4 Jul 2008 08:58:31 -0700	[thread overview]
Message-ID: <20080704085831.4bfa826b@gibibit.com> (raw)
In-Reply-To: <878wwi6bqy.fsf@xs4all.nl>

[-- Attachment #1: Type: text/plain, Size: 2721 bytes --]

On Thu, 03 Jul 2008 20:52:53 +0200
Marco Gerards <mgerards@xs4all.nl> wrote:

> Hi Colin,
> 
> Colin D Bennett <colin@gibibit.com> writes:
> 
> > +	* kern/i386/linuxbios/init.c (grub_get_time_ms):
> > +	Define grub_get_time_ms() to always return 0.  This should
> > be fixed
> > +	when RTC functionality is implemented.
> > +	(grub_time_init): Define this required function as a
> > no-op. Inserted
> > +	a comment to remind us delete this function when proper
> > time support 
> > +	is added to i386-linuxbios.
> > +
> > +	* kern/main.c (grub_main): Call grub_time_init() right
> > after
> > +	grub_machine_init().
> 
> I think this should go into grub_machine_init?  Why didn't you just
> add it there?

Originally, I had grub_machine_init() call grub_tsc_calibrate(), but
these are comments Vesa made to me about that code:

Vesa Jääskeläinen <dachaac@gmail.com> wrote
on Mon, 16 Jun 2008 20:34:54 +0300:

> Colin D Bennett wrote:
> > This week I implemented high resolution timer support using the x86
> > TSC (see attached patch <grub_tsc_2008-06-10.patch>).  It is
> > calibrated at GRUB startup using the RTC as a reference. The core
> > TSC function is ``grub_get_tsc()`` -- corresponding to
> > ``grub_get_rtc()``, but returning a uint64 value representing the
> > number of CPU cycles elapsed since boot.
> > 
> > In most situations, you will want to use ``grub_get_time_ms()`` to
> > get the system time in milliseconds based on the TSC value.  The
> > calibration function ``grub_tsc_calibrate()``, calculates the
> > proper scale factor and absolute offset so that the millisecond
> > value represents real time.
> > 
> > The ``grub_get_time_ms()`` function is implemented for non-x86
> > platforms to simply call ``grub_get_time_ms_generic()`` (defined in
> > kern/misc.c), which uses the RTC to get the time in milliseconds.  
> 
> We would probably want to leave that generic out from kernel, and let 
> every platform either use this generic code or implement their own 
> mechanism to do the job. Perhaps we should make own folder for
> generic stuff that can be included for arch specific build if there
> is no better replacement.
> 
> How about calling function like grub_time_init() which would then be 
> platform specific? Then platform can implement whatever way to
> calibrate (if needed) as long as it provides this grub_get_time_ms()
> function (also being platform specific). This would make
> initialization non-specific to arch while leaving more room for
> implementation.

Therefore, I thought this was the right way to do it.  Do you want me
to instead call grub_time_init() from grub_machine_init()?

Regards,
Colin

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

  reply	other threads:[~2008-07-04 15:59 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-23 14:54 [RFC] High resolution time support using x86 TSC Colin D Bennett
2008-07-03 18:52 ` Marco Gerards
2008-07-04 15:58   ` Colin D Bennett [this message]
2008-07-04 16:10     ` Vesa Jääskeläinen
2008-07-04 17:26   ` Colin D Bennett
2008-07-20 18:21     ` Marco Gerards
2008-07-04 18:28   ` [RFC] TSC patch v2 Colin D Bennett
2008-07-04 19:49     ` Vesa Jääskeläinen
2008-07-04 20:38       ` Colin D Bennett
2008-07-04 20:48         ` Vesa Jääskeläinen
2008-07-20 18:45     ` Marco Gerards
2008-07-28 17:05       ` [PATCH] High resolution time/TSC patch v3 Colin D Bennett
2008-07-28 17:59         ` Robert Millan
2008-07-31 19:08         ` Marco Gerards
2008-07-31 19:24           ` Robert Millan
2008-07-31 20:07             ` Marco Gerards
2008-07-31 20:35               ` Robert Millan
2008-08-03 19:48         ` Robert Millan
2008-08-03 23:53           ` TSC on coreboot (Re: [PATCH] High resolution time/TSC patch v3) Robert Millan
2008-08-04  2:14             ` Colin D Bennett
2008-08-04  9:09               ` Robert Millan
2008-08-04 20:21             ` Marco Gerards
2008-08-05 11:59         ` [PATCH] High resolution time/TSC patch v3 Marco Gerards
2008-08-05 20:24           ` Robert Millan

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=20080704085831.4bfa826b@gibibit.com \
    --to=colin@gibibit.com \
    --cc=grub-devel@gnu.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.