From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1KEsCl-0006HG-7K for mharc-grub-devel@gnu.org; Fri, 04 Jul 2008 16:48:31 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KEsCj-0006H3-NA for grub-devel@gnu.org; Fri, 04 Jul 2008 16:48:29 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KEsCj-0006Gq-Ev for grub-devel@gnu.org; Fri, 04 Jul 2008 16:48:29 -0400 Received: from [199.232.76.173] (port=51863 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KEsCj-0006Gl-3w for grub-devel@gnu.org; Fri, 04 Jul 2008 16:48:29 -0400 Received: from mta-out.inet.fi ([195.156.147.13]:48470 helo=kirsi2.rokki.sonera.fi) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KEsCi-0001wP-Tl for grub-devel@gnu.org; Fri, 04 Jul 2008 16:48:29 -0400 Received: from [127.0.0.1] (88.193.32.97) by kirsi2.rokki.sonera.fi (8.5.014) id 4869ED3A00264018 for grub-devel@gnu.org; Fri, 4 Jul 2008 23:48:26 +0300 Message-ID: <486E8C9E.9080107@nic.fi> Date: Fri, 04 Jul 2008 23:48:30 +0300 From: =?UTF-8?B?VmVzYSBKw6TDpHNrZWzDpGluZW4=?= User-Agent: Thunderbird 2.0.0.14 (Windows/20080421) MIME-Version: 1.0 To: The development of GRUB 2 References: <20080623075438.5861e6d1@gibibit.com> <878wwi6bqy.fsf@xs4all.nl> <20080704112801.470827ea@gibibit.com> <486E7EE7.6080509@nic.fi> <20080704133829.11b5a75d@gibibit.com> In-Reply-To: <20080704133829.11b5a75d@gibibit.com> X-Enigmail-Version: 0.95.6 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: Quoted-Printable X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 3) Subject: Re: [RFC] TSC patch v2 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Jul 2008 20:48:29 -0000 Colin D Bennett wrote: > On Fri, 04 Jul 2008 22:49:59 +0300 > Vesa J=C3=A4=C3=A4skel=C3=A4inen wrote: >=20 >> Hi Colin, >> >> Colin D Bennett wrote: >>> Here is an updated version of the TSC patch. >>> >>> I addressed the issues in your comments with the exception of >>> supporting x86 CPUs that don't have a TSC (386 and 486). >>> >>> I eliminated the grub_time_init() function and the call to it in >>> grub_main() in favor of having grub_machine_init() simply call >>> grub_tsc_calibrate(). The i386-pc and i386-efi platforms use the >>> TSC. >> Please still use grub_time_init(). Detect TSC, if it is there >> calibrate and adapt for it. If it is not there, use RTC. >=20 > Should grub_time_init() be a CPU or machine independent function? > Should it use conditional compilation to be usable on different CPUs? > Or should grub_time_init() be specific to i386 kernels at this point? > (Since we don't have anything to initialize for non-TSC-supporting > platforms.) In your patch you just change call of grub_tsc_calibrate() to=20 grub_time_init(). And in grub_time_init() you check cpuflags if tsc is=20 available or not. If tsc is available you call grub_tsc_calibrate(). And=20 if you are planning to use function pointers then you set proper=20 function pointers accordingly. > If grub_time_init() is specific to the i386 CPU, then grub_time_init() > should check whether the CPU has TSC support, and if so, > grub_tsc_calibrate() should be called, and calls to grub_get_time_ms() > should be directed to the TSC implementation. If no TSC support is > available, then no calibration is done, and calls to grub_get_time_ms() > should be directed to the generic get_time_ms() implementation that > uses grub_get_rtc() to do its job. You can even make it something like: - check for cpu flags (eg. detect method) - if tsc, set function pointers rtc (init=3Dtsc, getters=3Dtsc) - if no tsc set function pointers to rtc (init=3Drtc, getters=3Drtc) - call function pointer init > I want to make sure that I clearly understand what you want, since I > have made major re-designs of the TSC support in GRUB in an attempt to > do what you want. Just in the past couple of days I have spent about 8 > hours getting the TSC patch where it is now. (I know that seems > like a lot since it's not that much code, but I am just beginning to ge= t > familiar with the GRUB kernel organization, so simple changes have been > taking me a long time.) Sure... This is why it is good to discuss and design these things on=20 mailing list :)