Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 15 Jan 2008 03:19:23 GMT
From:      Leo Bicknell <bicknell@ufp.org>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   kern/119675: apic_hpet0 probe causes divide by zero kernel panic
Message-ID:  <200801150319.m0F3JNxf049573@www.freebsd.org>
Resent-Message-ID: <200801150330.m0F3U2bA037107@freefall.freebsd.org>

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

>Number:         119675
>Category:       kern
>Synopsis:       apic_hpet0 probe causes divide by zero kernel panic
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jan 15 03:30:02 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator:     Leo Bicknell
>Release:        7.0-RC1
>Organization:
>Environment:
Reproduce with 7.0-RC1 i386 or amd64 install disks.
>Description:
When probing apic_hpet0 the kernel divides by zero and panics, preventing boot.  Disabling ACPI disables the probe, and hence is a work around, but also means other features (e.g. the second core) are disabled.

I noticed this was documented in http://unix.derkeiler.com/Mailing-Lists/FreeBSD/stable/2007-05/msg00704.html (regarding a 6.x version) and not solved.  The code of interest is in /usr/src/sys/dev/apica/acpi_hpet.c:

	/* Read basic statistics about the timer. */
	val = bus_read_4(sc->mem_res, HPET_OFFSET_PERIOD);
	freq = (1000000000000000LL + val / 2) / val;
	if (bootverbose) {
		val = bus_read_4(sc->mem_res, HPET_OFFSET_INFO);
		device_printf(dev,
		    "vend: 0x%x rev: 0x%x num: %d hz: %jd opts:%s%s\n",
		    val >> 16, val & 0xff, (val >> 18) & 0xf, freq,
		    ((val >> 15) & 1) ? " leg_route" : "",
		    ((val >> 13) & 1) ? " count_size" : "");
	}

On this particular machine (Gigabyte GA-54SLI-S4 Motherboard w/Athlon 64 x2 4200) val = 0, so the second line causes a divide by zero error.

On this machine in the motherboard BIOS I can set the "high precision timer" to enabled or disabled, 32 bit or 64 bit mode.  I have tried all 4 combinations, all produce the same result.

I can use the hardware causing this problem as a test case for at least a week or two, if someone can get back to me relatively quickly I can attempt to perform more tests for you and/or get other info fairly promptly.

>How-To-Repeat:
It appears to me from looking at the CVS diff that booting any i386 or amd64 image on this hardware will cause the problem.  Based on google searching it appears while not common, this does affect more than one chipset and motherboard.

>Fix:
Obviously commenting out the division and hand setting the freq value "fixes" the problem in that the machine will boot, but I suspect this leaves a completely broken hpet0 device.  Disabling ACPI disables the probe, allowing boot, but means none of the other APCI goodness is available.

>Release-Note:
>Audit-Trail:
>Unformatted:



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