diff options
author | ed <ed@FreeBSD.org> | 2011-12-21 16:47:01 +0000 |
---|---|---|
committer | ed <ed@FreeBSD.org> | 2011-12-21 16:47:01 +0000 |
commit | 2cc69e2d2a00b0ef6b1753b9d4c9a7b85866195c (patch) | |
tree | 9a7729894ebcfededac00a312d7ba82fde04992e /sys/boot | |
parent | 1c33a1d2d2e8e17d9025181d92863f8f8c10ba0b (diff) | |
download | FreeBSD-src-2cc69e2d2a00b0ef6b1753b9d4c9a7b85866195c.zip FreeBSD-src-2cc69e2d2a00b0ef6b1753b9d4c9a7b85866195c.tar.gz |
Make the RTC checking for QEMU even more aggressive.
At work, where we use use KVM+QEMU, we notice that pxeboot is pratically
impossible because of network timeouts. This is due to the fact that the
RTC code makes aggressive jumps.
Two RTC reads does not seem to be sufficient. Change the code to check
for 8 identical RTC values.
Sponsored by: Kumina bv
Diffstat (limited to 'sys/boot')
-rw-r--r-- | sys/boot/i386/libi386/time.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/sys/boot/i386/libi386/time.c b/sys/boot/i386/libi386/time.c index 183ac3c..c27dcf6 100644 --- a/sys/boot/i386/libi386/time.c +++ b/sys/boot/i386/libi386/time.c @@ -62,7 +62,7 @@ bios_seconds(void) * Some BIOSes (notably qemu) don't correctly read the RTC * registers in an atomic way, sometimes returning bogus values. * Therefore we "debounce" the reading by accepting it only when - * we got two identical values in succession. + * we got 8 identical values in succession. * * If we pass midnight, don't wrap back to 0. */ @@ -71,14 +71,16 @@ time(time_t *t) { static time_t lasttime; time_t now, check; - int try; + int same, try; - try = 0; + same = try = 0; check = bios_seconds(); do { now = check; check = bios_seconds(); - } while (now != check && ++try < 1000); + if (check != now) + same = 0; + } while (++same < 8 && ++try < 1000); if (now < lasttime) now += 24 * 3600; |