NetBSD Problem Report #43568

From paul@whooppee.com  Sun Jul  4 12:41:28 2010
Return-Path: <paul@whooppee.com>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by www.NetBSD.org (Postfix) with ESMTP id ECCC963BA6F
	for <gnats-bugs@gnats.NetBSD.org>; Sun,  4 Jul 2010 12:41:27 +0000 (UTC)
Message-Id: <20100704124127.2C68492657@quicky.whooppee.com>
Date: Sun,  4 Jul 2010 05:41:27 -0700 (PDT)
From: paul@whooppee.com
Reply-To: paul@whooppee.com
To: gnats-bugs@gnats.NetBSD.org
Subject: Need to ignore un-responsive ioapic
X-Send-Pr-Version: 3.95

>Number:         43568
>Category:       kern
>Synopsis:       Need to ignore un-responsive ioapic
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pgoyette
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Jul 04 12:45:00 +0000 2010
>Closed-Date:    Tue Apr 05 13:45:41 +0000 2011
>Last-Modified:  Tue Apr 05 14:40:03 +0000 2011
>Originator:     Paul Goyette
>Release:        NetBSD 5.99.31
>Organization:
-------------------------------------------------------------------------
| Paul Goyette     | PGP Key fingerprint:     | E-mail addresses:       |
| Customer Service | FA29 0E3B 35AF E8AE 6651 | paul at whooppee.com    |
| Network Engineer | 0786 F758 55DE 53BA 7731 | pgoyette at juniper.net |
| Kernel Developer |                          | pgoyette at netbsd.org  |
-------------------------------------------------------------------------
>Environment:


System: NetBSD quicky.whooppee.com 5.99.31 NetBSD 5.99.31 (QUICKY (XFX nForce 790i ULTRA) 2010-06-20 00:30:00) #0: Sat Jun 19 18:19:27 PDT 2010 paul@speedy.whooppee.com:/build-out/netbsd-local/obj/amd64/sys/arch/amd64/compile/QUICKY amd64
Architecture: x86_64
Machine: amd64
>Description:
	Some BIOS report ioapic devices that don't actually exist.  We
	should ignore these, as is done on other xxxBSD systems.
>How-To-Repeat:
	One example where this happens is on a SuperMmicro server board
	H8QGi-F.
>Fix:
	The following patch detects the non-existence of the ioapic (by
	checking the return value of the read size/version register) and
	does not add the device to internal tables if it is not present.


Index: ioapic.c
===================================================================
RCS file: /cvsroot/src/sys/arch/x86/x86/ioapic.c,v
retrieving revision 1.44
diff -u -p -r1.44 ioapic.c
--- ioapic.c	18 Aug 2009 16:41:03 -0000	1.44
+++ ioapic.c	3 Jul 2010 22:39:34 -0000
@@ -279,8 +279,6 @@ ioapic_attach(device_t parent, device_t 
 		return;
 	}

-	ioapic_add(sc);
-
 	aprint_verbose(": pa 0x%jx", (uintmax_t)aaa->apic_address);
 #ifndef _IOAPIC_CUSTOM_RW
 	{
@@ -308,7 +306,13 @@ ioapic_attach(device_t parent, device_t 

 	apic_id = (ioapic_read(sc,IOAPIC_ID)&IOAPIC_ID_MASK)>>IOAPIC_ID_SHIFT;
 	ver_sz = ioapic_read(sc, IOAPIC_VER);
-	
+	if (ver_sz == 0xffffffff) {
+		aprint_error(": failed to read version/size\n");
+		return;
+	}
+
+	ioapic_add(sc);
+
 	sc->sc_apic_vers = (ver_sz & IOAPIC_VER_MASK) >> IOAPIC_VER_SHIFT;
 	sc->sc_apic_sz = (ver_sz & IOAPIC_MAX_MASK) >> IOAPIC_MAX_SHIFT;
 	sc->sc_apic_sz++;
@@ -329,8 +333,9 @@ ioapic_attach(device_t parent, device_t 
 		    aaa->flags & IOAPIC_PICMODE ? "PIC" : "virtual wire");
 	}

-	aprint_verbose(", version %x, %d pins", sc->sc_apic_vers,
-	    sc->sc_apic_sz);
+	aprint_verbose(", version %x, %d pins, vector base %d (%d)",
+	    sc->sc_apic_vers, sc->sc_apic_sz, sc->sc_pic.pic_vecbase,
+	    aaa->apic_vecbase);
 	aprint_normal("\n");

 	sc->sc_pins = malloc(sizeof(struct ioapic_pin) * sc->sc_apic_sz,


>Release-Note:

>Audit-Trail:
From: Paul Goyette <paul@whooppee.com>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: kern/43568: Need to ignore un-responsive ioapic
Date: Tue, 5 Apr 2011 04:47:57 -0700 (PDT)

 Has anyone had a chance to look at this PR at all?  This was from a 
 SuperMicro motherboard that reported an ioapic2 which either didn't 
 exist or was totaly disabled in the current (single-socket) config.

 The suggested patch prevented the ioapic from attaching if it didn't 
 report its size/version information correctly;  this is what other BSD's 
 seem to do in similar situations.  The patch lets the SuperMicro board 
 run correctly, and has hadno ill effects on any of my other systems 
 (with various ASUS and XFX motherboards).

 It's not critical to fix this, but I'd at least like to know if there's 
 any hope of me not having to continue with this non-official patch for 
 my home machines.  :)



 -------------------------------------------------------------------------
 | Paul Goyette     | PGP Key fingerprint:     | E-mail addresses:       |
 | Customer Service | FA29 0E3B 35AF E8AE 6651 | paul at whooppee.com    |
 | Network Engineer | 0786 F758 55DE 53BA 7731 | pgoyette at juniper.net |
 | Kernel Developer |                          | pgoyette at netbsd.org  |
 -------------------------------------------------------------------------

Responsible-Changed-From-To: kern-bug-people->pgoyette
Responsible-Changed-By: pgoyette@NetBSD.org
Responsible-Changed-When: Tue, 05 Apr 2011 13:45:41 +0000
Responsible-Changed-Why:
It's my bug.


State-Changed-From-To: open->closed
State-Changed-By: pgoyette@NetBSD.org
State-Changed-When: Tue, 05 Apr 2011 13:45:41 +0000
State-Changed-Why:
Provided patch incorporated, with modifications.


From: "Paul Goyette" <pgoyette@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/43568 CVS commit: src/sys/arch/x86/x86
Date: Tue, 5 Apr 2011 13:43:33 +0000

 Module Name:	src
 Committed By:	pgoyette
 Date:		Tue Apr  5 13:43:33 UTC 2011

 Modified Files:
 	src/sys/arch/x86/x86: ioapic.c

 Log Message:
 If an ioapic doesn't really exist, don't add it to internal tables.
 This is what other xxxBSDs seem to do in similar circumstances.

 Addresses my PR kern/43568

 OK jruoho@ in private Email


 To generate a diff of this commit:
 cvs rdiff -u -r1.44 -r1.45 src/sys/arch/x86/x86/ioapic.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: Jukka Ruohonen <jruohonen@iki.fi>
To: gnats-bugs@NetBSD.org
Cc: paul@whooppee.com
Subject: Re: kern/43568: Need to ignore un-responsive ioapic
Date: Tue, 5 Apr 2011 15:47:12 +0300

 On Tue, Apr 05, 2011 at 11:50:04AM +0000, Paul Goyette wrote:
 >  The suggested patch prevented the ioapic from attaching if it didn't 
 >  report its size/version information correctly;  this is what other BSD's 
 >  seem to do in similar situations.

 This seems right and harmless to me.

 - Jukka.

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.