Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 11 Jan 2008 21:32:15 +0100 (CET)
From:      "Oliver B. Warzecha" <obw@amarok.ping.de>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   i386/119574: 7.0-RC1 times out in calibrate_clocks()
Message-ID:  <200801112032.m0BKWFXg001186@karnevil9.amarok.ping.de>
Resent-Message-ID: <200801112110.m0BLA2ER097596@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         119574
>Category:       i386
>Synopsis:       7.0-RC1 times out in calibrate_clocks()
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-i386
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Jan 11 21:10:01 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator:     Oliver B. Warzecha <obw@amarok.ping.de>
>Release:        FreeBSD 7.0-RC1 i386
>Organization:
private
>Environment:
System: FreeBSD karnevil9.amarok.ping.de 7.0-RC1 
GENERIC kernel from CD and self compiled
hint.acpi.0.disabled="1" added to /boot/device.hints
>Description:
The 7.0-RC1 GENERIC kernel fails to recognize that the seconds counter
changes during the loops in calibrate_clocks() in sys/i386/isa/clocks.c

The same machine passes this routine quickly with 6.2-RELEASE-p8. It
is a 200 MHz AMD K6 on an ASUS P55T2P4S board.

Through generous use of debugging printf()'s while searching, I could
limit the possible causes to this lines:
        timeout = 100000000;

        /* Read the mc146818A seconds counter. */
        for (;;) {
                if (!(rtcin(RTC_STATUSA) & RTCSA_TUP)) {
                        sec = rtcin(RTC_SEC);
                        break;
                }
                if (--timeout == 0)
                        goto fail;
        }
//        printf("seconds counter read ... \n");
        /* Wait for the mC146818A seconds counter to change. */
        start_sec = sec;
        for (;;) {
                if (!(rtcin(RTC_STATUSA) & RTCSA_TUP)) {
                        sec = rtcin(RTC_SEC);
                        if (sec != start_sec)
                                break;
                }
                if (--timeout == 0)
                        goto fail;
        }
//        printf("seconds counter changed ... \n");
(my debugging printf()s commented out with C++ comments)
The first output "seconds counter read" gets printed very fast.
After that the machine counts back from 0 to 0 and after some minutes
he falls out of the loop and "seconds counter changed" gets never
printed.

As I noticed that rtcin() was reworked during the change to 7.0,
(http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/i386/isa/clock.c.diff?r1=1.222.2.2;r2=1.239.2.1;f=h)
 it occurred to me that perhaps there might be some condition
in the new code.

As I said, on a 6.2-RELEASE-p8 kernel it all goes smoothly, I just
checked with boot -v:
Calibrating clock(s) ... i8254 clock: 1193296 Hz
CLK_USE_I8254_CALIBRATION not specified - using default frequency
Timecounter "i8254" frequency 1193182 Hz quality 0

It does *not* say "failed, using default i8254 clock [...]" which
would indicate the "fault" label.
	
>How-To-Repeat:
boot 7.0-RC1 GENERIC on the hardware mentioned above (tested it on 
one other machine with "no ACPI" from the the boot CD, but that
 one booted fast and recognized the timer)
>Fix:
One possible workaround would be to reset the timeout variable
to a more sane value, for the first loop it gets set to
100000000. But then this loop seems to work okay, so I have
no idea what a sane value would be. At least it would fail
fast.

For a complete fix I have no idea than to revert to the 6.2-code.
But I think, this may be out of the question.
>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200801112032.m0BKWFXg001186>