Subject: port-i386/35839: MP kernel reboots while probing the 2nd cpu
To: None <port-i386-maintainer@netbsd.org, gnats-admin@netbsd.org,>
From: Bernd Ernesti <pr200702@veego.de>
List: netbsd-bugs
Date: 02/25/2007 17:30:01
>Number:         35839
>Category:       port-i386
>Synopsis:       MP kernel reboots while probing the 2nd cpu
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    port-i386-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Feb 25 17:30:00 +0000 2007
>Originator:     Bernd Ernesti
>Release:        NetBSD 4.99.7
>Organization:
	
>Environment:
System: NetBSD 4.99.7
Architecture: i386
Machine: i386
>Description:
	The system reboots when the 2nd cpu is being probed.
>How-To-Repeat:
	Boot a MP kernel on a Gigabyte GA-K8NSC-939 board and notice that
	something cause an reboot while the 2nd cpu is in the procces to
	start.

	The patch attatched to port-i386/35618 was applied to get a working
	ioapic.

	This is the kernel output when this happens. Please note that the
	'cpu?: delay' are some debug aprint_normal followed by an DELAY(3000000)
	to find the place where it crashes.


kenter: 0x00001000
acpi: wakecode is installed at 0x1000, size=376
Loaded initial symtab at 0xc0887af0, strtab at 0xc08d8034, # entries 20481
Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
    2006, 2007
    The NetBSD Foundation, Inc.  All rights reserved.
Copyright (c) 1982, 1986, 1989, 1991, 1993
    The Regents of the University of California.  All rights reserved.

NetBSD 4.99.7 (PARRESUM-ACPI) #37: Sun Feb 25 15:13:13 CET 2007
        bernd@:/src/sys/arch/i386/compile/PARRESUM
total memory = 2047 MB
avail memory = 1991 MB
timecounter: Timecounters tick every 1.000 msec
timecounter: Timecounter "i8254" frequency 1193182 Hz quality 100
Calibrating TSC clock ... TSC clock: 2411856250 Hz
BIOS32 rev. 0 found at 0xfb070
SMBIOS rev. 2.3 @ 0xf0100 (44 entries)
mainbus0 (root)
cpu0 at mainbus0: apid 0 (boot processor)
cpu0: AMD Unknown K7 (Athlon) (686-class), 2411.85 MHz, id 0x20f32
cpu0: features f7dbfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR>
cpu0: features f7dbfbff<PGE,MCA,CMOV,PAT,PSE36,MPC,NOX,MMXX,MMX>
cpu0: features f7dbfbff<FXSR,SSE,SSE2,HTT,LONG,3DNOW2,3DNOW>
cpu0: features2 1<SSE3>
cpu0: "AMD Athlon(tm) 64 X2 Dual Core Processor 4600+"
cpu0: I-cache 64 KB 64B/line 2-way, D-cache 64 KB 64B/line 2-way
cpu0: L2 cache 512 KB 64B/line 16-way
cpu0: ITLB 32 4 KB entries fully associative, 8 4 MB entries fully associative
cpu0: DTLB 32 4 KB entries fully associative, 8 4 MB entries fully associative
cpu0: AMD Power Management features: f<TTP,VID,FID,TS>
cpu0: AMD Cool`n'Quiet Technology 2400 MHz
cpu0: available frequencies (Mhz): 1000 2400
cpu0: testing for erratum 89
cpu0: calibrating local timer
cpu0: apic clock running at 200 MHz
cpu0: 8 page colors
cpu0: kstack at 0xcf335000 for 12288 bytes
cpu0: idle pcb at 0xcf335000, idle sp at 0xcf337f98
cpu1 at mainbus0: apid 1 (application processor)
cpu1: starting
cpu1: delay mp_cpu_start: MP_TRAMPOLINE: 8192, PAGE_SIZE: 4096, ci_apicid: 1
cpuX: delay x86_ipi 1
c

	mp_cpu_start (i386/i386/cpu.c) calls x86_ipi (x86/x86/lapic.c):
x86_ipi(MP_TRAMPOLINE/PAGE_SIZE, ci->ci_apicid, LAPIC_DLMODE_STARTUP)
	And the function in x86_ipi which cause the reboot is:
i82489_writereg(LAPIC_ICRLO, (target & LAPIC_DEST_MASK) | vec | dl | LAPIC_LVL_ASSERT)

	'x86_ipi 1' is a aprint_normal before the i82489_writereg.
	The 'c' in the next line is propably from the next aprint_normal after
	i82489_writereg.

	A full dmesg output without 'options MULTIPROCESSOR' can be found
	on ftp.netbsd.org:/pub/NetBSD/misc/veego/k8nsc/dmesg.boot-verbose
>Fix: