All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marco Gerards <mgerards@xs4all.nl>
To: Colin D Bennett <colin@gibibit.com>
Cc: The development of GRUB 2 <grub-devel@gnu.org>
Subject: Re: [RFC] High resolution time support using x86 TSC
Date: Sun, 20 Jul 2008 20:21:28 +0200	[thread overview]
Message-ID: <87y73wifh3.fsf@xs4all.nl> (raw)
In-Reply-To: <20080704102616.6ce86238@gibibit.com> (Colin D. Bennett's message of "Fri, 4 Jul 2008 10:26:16 -0700")

Colin D Bennett <colin@gibibit.com> writes:

> Hi Marco,
>
> On Thu, 03 Jul 2008 20:52:53 +0200
> Marco Gerards <mgerards@xs4all.nl> wrote:
>
>> Hi Colin,
>> 
>> Colin D Bennett <colin@gibibit.com> writes:
>> 
>> > I have implemented high resolution time support (through the
>> > new grub_get_time_ms() function) using the RDTSC instruction
>> > available on Pentium and higher x86 CPUs.  The TSC value is simply
>> > a 64-bit block cycle counter that is zeroed at bootup, so
>> > grub_main() calls grub_time_init(), which is defined by each
>> > platform.  If a platform links to kern/i386/tsc.c, then the
>> > grub_time_init() function from tsc.c is used, which calibrates the
>> > TSC rate and absolute zero reference using the RTC.
>> What if TSC is not available?
>
> I updated the changelog entry to indicate that running on a 386 or 486
> will fail, since TSC is provided in Pentium+.  Do we support running on
> 386 or 386?  Should I check for this?  If so, the code will have to
> change a bit, and be able to select between the generic implementation
> and the TSC implementation at runtime.
>
> I think this would be best done letting the "grub_get_time_ms"
> implementation be selected by setting a function pointer in
> grub_machine_init() depending on the machine's capabilities.  I would
> have to significantly re-structure my patch, but it might be
> necessary (and could lead to more understandable code?).
> What do you think?

That would be great.  I do not want to drop 486 support just because
of this.  You could even drop back to a lower granularity of the timer
or better: submit code that does the trick for the 486 as well.

--
Marco
 




  reply	other threads:[~2008-07-20 18:20 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
2008-07-04 16:10     ` Vesa Jääskeläinen
2008-07-04 17:26   ` Colin D Bennett
2008-07-20 18:21     ` Marco Gerards [this message]
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=87y73wifh3.fsf@xs4all.nl \
    --to=mgerards@xs4all.nl \
    --cc=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.