From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1a3gOP-00009d-R7 for mharc-grub-devel@gnu.org; Tue, 01 Dec 2015 03:34:33 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49907) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a3gON-00008a-Ks for grub-devel@gnu.org; Tue, 01 Dec 2015 03:34:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a3gOK-0004Nx-Cv for grub-devel@gnu.org; Tue, 01 Dec 2015 03:34:31 -0500 Received: from mx1.redhat.com ([209.132.183.28]:34767) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a3gOK-0004Nr-7T for grub-devel@gnu.org; Tue, 01 Dec 2015 03:34:28 -0500 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (Postfix) with ESMTPS id B338411371B; Tue, 1 Dec 2015 08:34:27 +0000 (UTC) Received: from vitty.brq.redhat.com.smtpmail-local-domain (vitty.brq.redhat.com [10.34.26.3]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id tB18YO1S012948 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 1 Dec 2015 03:34:25 -0500 From: Vitaly Kuznetsov To: Michael Chang Subject: Re: [PATCH] calibrate_tsc(): use the Stall() EFI boot service on GRUB_MACHINE_EFI 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> <20151201031129.GA28205@linux-dsax.tai.apac.novell.com> Date: Tue, 01 Dec 2015 09:34:24 +0100 In-Reply-To: <20151201031129.GA28205@linux-dsax.tai.apac.novell.com> (Michael Chang's message of "Tue, 1 Dec 2015 11:11:29 +0800") Message-ID: <871tb6k1nz.fsf@vitty.brq.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Andrei Borzenkov , The development of GNU GRUB , 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 08:34:32 -0000 Michael Chang writes: > On Mon, Nov 30, 2015 at 08:34:18PM +0300, Andrei Borzenkov wrote: >> 30.11.2015 19:50, Andrei Borzenkov =D0=BF=D0=B8=D1=88=D0=B5=D1=82: >> > 30.11.2015 19:31, Vitaly Kuznetsov =D0=BF=D0=B8=D1=88=D0=B5=D1=82: >> >> Andrei Borzenkov writes: >> >> >> >>> 26.11.2014 11:59, Laszlo Ersek =D0=BF=D0=B8=D1=88=D0=B5=D1=82: >> >>>> 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 met= hods >> >>> 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. >> >> >> >=20 >> > @Michael: I remember you tested version of Vladimir patch on Hyper-V= ? >> > Could you test current master? >> >=20 > > 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 ..=20 > >>=20 >>=20 >> if ((grub_inb (GRUB_PIT_SPEAKER_PORT) & GRUB_PIT_SPK_TMR2_LATCH)) { >> ret =3D 1; >> /* Wait. */ >> while ((grub_inb (GRUB_PIT_SPEAKER_PORT) & GRUB_PIT_SPK_TMR2_LATCH= ) >> =3D=3D 0x00); >> } >>=20 >>=20 >> 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 fo= r > 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) =3D= =3D 0) { > ret =3D 1; > /* Wait. */ > while ((grub_inb (GRUB_PIT_SPEAKER_PORT) & GRUB_PIT_SPK_TMR2_LATCH= ) > =3D=3D 0x00); > } > > Vitaly, could you please help to retest ? > Sure, just did and with this change timer seems to be working as expected. --=20 Vitaly