Subject: MPACPI interrupt problem found + fix
To: None <port-i386@NetBSD.org>
From: Reinoud Zandijk <reinoud@netbsd.org>
List: port-amd64
Date: 09/03/2006 19:25:58
--8t9RHnE3ZwKMSgU+
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Dear folks,

as some of you might remember i had a serious problem running=20
GENERIC.MPACPI on my hyperthreading P4 where GENERIC works fine and=20
GENERIC.MP just crashes.

The problem manifested itself as generating 140.000 interrupts (!) per=20
second slowing down the machine and esp. harddisc access etc.=20
significantly. Doing a binary search on the source i eventually found the=
=20
offending patch of the function mpacpi_nonpci_intr :

----------------------------
revision 1.38
date: 2006/08/12 16:19:13;  author: fvdl;  state: Exp;  lines: +3 -2
Record the ACPI global int in the interrupt structure for ISA interrupt
overrided (e.g. the SCI interrupt), so that it may be found correctly by
the ACPI interrupt establish function, should the number be different
=66rom the original source.
-----------------------------

cvs rdiff -u -r 1.37 -r 1.38 src/sys/arch/x86/x86/mpacpi.c
Index: src/sys/arch/x86/x86/mpacpi.c
diff -u src/sys/arch/x86/x86/mpacpi.c:1.37=20
src/sys/arch/x86/x86/mpacpi.c:1.38
--- src/sys/arch/x86/x86/mpacpi.c:1.37  Thu Jul 20 05:05:26 2006
+++ src/sys/arch/x86/x86/mpacpi.c       Sat Aug 12 16:19:13 2006
@@ -1,4 +1,4 @@
-/*     $NetBSD: mpacpi.c,v 1.37 2006/07/20 05:05:26 kochi Exp $        */
+/*     $NetBSD: mpacpi.c,v 1.38 2006/08/12 16:19:13 fvdl Exp $ */
=20
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
=20
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mpacpi.c,v 1.37 2006/07/20 05:05:26 kochi Exp =
$");
+__KERNEL_RCSID(0, "$NetBSD: mpacpi.c,v 1.38 2006/08/12 16:19:13 fvdl Exp $=
");
=20
 #include "acpi.h"
 #include "opt_acpi.h"
@@ -249,6 +249,7 @@
                mpi->ioapic_pin =3D pin;
                mpi->sflags |=3D MPI_OVR;
                mpi->redir =3D 0;
+               mpi->global_int =3D isa_ovr->Interrupt;
                switch (isa_ovr->Polarity) {
                case MPS_INTPO_ACTHI:
                        mpi->redir &=3D ~IOAPIC_REDLO_ACTLO;
----------------------

Removing the line makes the spurious interrupts go away. My GENERIC.MPACPI=
=20
config had the following changes :

Index: sys/arch/i386/conf/GENERIC.MPACPI
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/src/sys/arch/i386/conf/GENERIC.MPACPI,v
retrieving revision 1.59
diff -u -r1.59 GENERIC.MPACPI
--- sys/arch/i386/conf/GENERIC.MPACPI   4 Jul 2006 00:30:22 -0000       1.59
+++ sys/arch/i386/conf/GENERIC.MPACPI   3 Sep 2006 17:11:16 -0000
@@ -8,11 +8,11 @@
 options        MULTIPROCESSOR
=20
 options        APM_NO_IDLE
-#options       DIAGNOSTIC      # STRONGLY RECOMMENDED
+options        DIAGNOSTIC      # STRONGLY RECOMMENDED
 #options       LOCKDEBUG
 #options       MPDEBUG
 #options       MPVERBOSE
-#options       DEBUG
+options        DEBUG
 options        ACPIVERBOSE
=20
 ioapic*                at mainbus? apid ?
@@ -64,6 +64,11 @@
 # badly if isa is disabled.
 # no isapnp
 # no isa
+no device at isapnp?
+no device at isa?
+#no eso* at pci?               # XXX needs ISA for i386 or amd64
+#no isapnp
+#no isa
=20
 # Disable non-acpi mainboard devices
 # XXX: Is this list complete?
---------------------------

I dont know if the `no device at isa' and/or the `no device on isapnp' is=
=20
the curlput but it saves seconds in boot time as it never finds anything=20
each time and is unlikely to provide the problem.

Any ideas as how to fix this in a generic way?

Thanks in advance,
Reinoud

P.S. I am NOT subscribed to port-i386 or port-amd64 yet so please forward=
=20
it to me too.


--8t9RHnE3ZwKMSgU+
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.1 (NetBSD)

iQEVAwUBRPsQH4KcNwBDyKpoAQJUQgf9GsWHsj1sDtnrQFcNYxzMAj59xcNOOCR7
31f/3oAizmB0ddofK17JX7LIKrP6YDUlzu69Ch8ZKHWkiwpe7V+4xcb7TXGwDd+G
F1373QnBJJCskCSB0ogZeGULhXQqloV9GJpfhkrLWmckPIxIxVBkbs3Z2y0hurUi
vvStxXESCLc66eneXXWXbSaj6pdDEQrFHlsO/btsXke39RmdGUa3MggabEnu2qn6
jH5i6jb9xK/pLyRresJlD7ZqHZ3HWwnTflg+L56GIv58qc1avZiunqKv11HG9xcz
cwtJxebKpXWFKcEAC5uiUX0PeFSXF59w5x/VMxYVSxC7Q5ZX5MkjTA==
=Silv
-----END PGP SIGNATURE-----

--8t9RHnE3ZwKMSgU+--