On Thu, Jul 28, 2022 at 02:34:16PM -0400, Robbie Harwood wrote: > From: Peter Jones <pjo...@redhat.com> > > On my laptop running at 2.4GHz, if I run a VM where tsc calibration > using pmtimer will fail presuming a broken pmtimer, it takes ~51 seconds > to do so (as measured with the stopwatch on my phone), with a tsc delta > of 0x1cd1c85300, or around 125 billion cycles. > > If instead of trying to wait for 5-200ms to show up on the pmtimer, we try > to wait for 5-200us, it decides it's broken in ~0x2626aa0 TSCs, aka ~2.4 > million cycles, or more or less instantly. > > Additionally, this reading the pmtimer was returning 0xffffffff anyway, > and that's obviously an invalid return. I've added a check for that and > 0 so we don't bother waiting for the test if what we're seeing is dead > pins with no response at all. > > If "debug" includes "pmtimer", you will see one of the following three > outcomes. If pmtimer gives all 0 or all 1 bits, you will see: > > pmtimer: 0xffffff bad_reads: 1 > pmtimer: 0xffffff bad_reads: 2 > pmtimer: 0xffffff bad_reads: 3 > pmtimer: 0xffffff bad_reads: 4 > pmtimer: 0xffffff bad_reads: 5 > pmtimer: 0xffffff bad_reads: 6 > pmtimer: 0xffffff bad_reads: 7 > pmtimer: 0xffffff bad_reads: 8 > pmtimer: 0xffffff bad_reads: 9 > pmtimer: 0xffffff bad_reads: 10 > timer is broken; giving up. > > This outcome was tested using qemu+kvm with UEFI (OVMF) firmware and > these options: -machine pc-q35-2.10 -cpu Broadwell-noTSX > > If pmtimer gives any other bit patterns but is not actually marching > forward fast enough to use for clock calibration, you will see: > > pmtimer delta is 0x0 (1904 iterations) > tsc delta is implausible: 0x2626aa0 > > This outcome was tested using grub patched to not ignore bad reads using > qemu+kvm with UEFI (OVMF) firmware, and these options: -machine > pc-q35-2.10 -cpu Broadwell-noTSX > > If pmtimer actually works, you'll see something like: > > pmtimer delta is 0xdff > tsc delta is 0x278756 > > This outcome was tested using qemu+kvm with UEFI (OVMF) firmware, and > these options: -machine pc-i440fx-2.4 -cpu Broadwell-noTSX > > I've also tested this outcome on a real Intel Xeon E3-1275v3 on an Intel > Server Board S1200V3RPS using the SDV.RP.B8 "Release" build here: > https://firmware.intel.com/sites/default/files/UEFIDevKit_S1200RP_vB8.zip > > Signed-off-by: Peter Jones <pjo...@redhat.com> > Signed-off-by: Javier Martinez Canillas <javi...@redhat.com> > Signed-off-by: Robbie Harwood <rharw...@redhat.com>
Reviewed-by: Daniel Kiper <daniel.ki...@oracle.com> Daniel _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel