Date: Wed, 21 Dec 2011 16:47:01 +0000 (UTC) From: Ed Schouten <ed@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r228782 - head/sys/boot/i386/libi386 Message-ID: <201112211647.pBLGl1G1077440@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: ed Date: Wed Dec 21 16:47:01 2011 New Revision: 228782 URL: http://svn.freebsd.org/changeset/base/228782 Log: 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 Modified: head/sys/boot/i386/libi386/time.c Modified: head/sys/boot/i386/libi386/time.c ============================================================================== --- head/sys/boot/i386/libi386/time.c Wed Dec 21 16:38:37 2011 (r228781) +++ head/sys/boot/i386/libi386/time.c Wed Dec 21 16:47:01 2011 (r228782) @@ -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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201112211647.pBLGl1G1077440>