Received: from list by lists.gnu.org with archive (Exim 4.71) id 1a3bWn-0005Tk-46 for mharc-grub-devel@gnu.org; Mon, 30 Nov 2015 22:22:53 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52345) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a3bWk-0005TN-T1 for grub-devel@gnu.org; Mon, 30 Nov 2015 22:22:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a3bWh-00032o-Ny for grub-devel@gnu.org; Mon, 30 Nov 2015 22:22:50 -0500 Received: from victor.provo.novell.com ([137.65.250.26]:37633 helo=prv3-mh.provo.novell.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a3bWh-00031n-GK for grub-devel@gnu.org; Mon, 30 Nov 2015 22:22:47 -0500 Received: from linux-dsax.tai.apac.novell.com (prv-ext-foundry1int.gns.novell.com [137.65.251.240]) by prv3-mh.provo.novell.com with ESMTP (TLS encrypted); Mon, 30 Nov 2015 20:22:30 -0700 Date: Tue, 1 Dec 2015 11:11:29 +0800 From: Michael Chang To: Andrei Borzenkov Subject: Re: [PATCH] calibrate_tsc(): use the Stall() EFI boot service on GRUB_MACHINE_EFI Message-ID: <20151201031129.GA28205@linux-dsax.tai.apac.novell.com> Mail-Followup-To: Andrei Borzenkov , Vitaly Kuznetsov , The development of GNU GRUB , decui@microsoft.com, pjones@redhat.com, lersek@redhat.com References: <1416992361-4167-1-git-send-email-lersek@redhat.com> <56589925.20207@gmail.com> <87h9k3jvp7.fsf@vitty.brq.redhat.com> <565C7E3A.3090004@gmail.com> <565C889A.6030409@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <565C889A.6030409@gmail.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 137.65.250.26 Cc: The development of GNU GRUB , Vitaly Kuznetsov , decui@microsoft.com, lersek@redhat.com X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2015 03:22:51 -0000 On Mon, Nov 30, 2015 at 08:34:18PM +0300, Andrei Borzenkov wrote: > 30.11.2015 19:50, Andrei Borzenkov пишет: > > 30.11.2015 19:31, Vitaly Kuznetsov пишет: > >> Andrei Borzenkov writes: > >> > >>> 26.11.2014 11:59, Laszlo Ersek пишет: > >>>> HyperV Gen2 virtual machines have no PIT; guest code should rely on UEFI > >>>> services instead. > >>>> > >>> > >>> Could you retest with current master? It now supports multiple methods > >>> to calibrate TSC and should avoid PIT on UEFI systems. > >> > >> Unfortunately, current master (grub-2.02-beta2-561-g346a494) still > >> doesn't work for me, timer keeps running like crazy on Gen2 Hyper-V VMs. > >> > > > > @Michael: I remember you tested version of Vladimir patch on Hyper-V? > > Could you test current master? > > I don't have access to Hyper-V either. My initial patch was tested on Hyper-V from my colleage in Nuremburg. For Vladimir's patch I did tests on my EFI machine and mostly intersted in pmtimer to function properly, as that's new introduced timer to the patch .. > > > if ((grub_inb (GRUB_PIT_SPEAKER_PORT) & GRUB_PIT_SPK_TMR2_LATCH)) { > ret = 1; > /* Wait. */ > while ((grub_inb (GRUB_PIT_SPEAKER_PORT) & GRUB_PIT_SPK_TMR2_LATCH) > == 0x00); > } > > > If PIT is not present all reads should return 0xff so this will always > succeed, right? Linux kernel is using some sanity checks, if loop > terminated too early it assumes calibration failure. Well, yes the detection is bogus, I think the condition should check for return 0x00, which means the timer is counting and can continue to wait for it to finish. if ((grub_inb (GRUB_PIT_SPEAKER_PORT) & GRUB_PIT_SPK_TMR2_LATCH) == 0) { ret = 1; /* Wait. */ while ((grub_inb (GRUB_PIT_SPEAKER_PORT) & GRUB_PIT_SPK_TMR2_LATCH) == 0x00); } Vitaly, could you please help to retest ? Thanks, Michael >