Subject: Bug in x86 ioapic interrupt code for devices with shared interrupts?
To: None <port-amd64@netbsd.org, port-i386@netbsd.org>
From: Thor Lancelot Simon <tls@rek.tjls.com>
List: port-i386
Date: 03/01/2006 14:46:32
One of the NetBSD Foundation servers is a dual-Opteron with an onboard
dual Broadcom gigabit chip.  This chip, as far as I can tell from some
experiments, gets seriously disturbed by the driver's tendency to
acknowledge interrupts even if they're not actually from the device.

But there aren't any such interrupts, in usual operation, until I plug in
an LSI MegaRAID card in one of the system's PCI-X slots.  Then, this
happens:

	1) The MegaRAID gets the same *IRQ* assigned as the first
	   function on the Broadcom chip (which we probe as bge0).

	2) However, these devices are on *different* ioapics (this
	   system has three) so, as far as I can tell, the x86
	   interrupt code _should_ not ever deliver interrupts from
	   the MegaRAID to the driver for the bge, or vice-versa.

	3) Nonetheless, that is precisely what appears to happen,
	   with the consequence that the bge quickly locks up.  It
	   may be the case that the reverse is happening as well,
	   but I haven't managed to test this.

The system is running a uniprocessor amd64 kernel with options MPACPI
and MPACPI_SCANPCI.  It is currently in transit to a new location, so
I can't post a dmesg, but I believe the above gives all the relevant
details.

I wonder if some problem like this one is responsible for other interrupt
problems on the amd64 port as well.  I thought we did not use the IRQ for
anything if ioapic was in use, and the code does basically look that way
to me, but since on this system bge0's driver seems to catch interrupts
for amr0 (which has the same IRQ but is on a *different* ioapic) it seems
like there must be some bug I cannot immediately see.

There have been a number of bug reports involving onboard bge on amd64
over the past few years which I think have the same root cause as this
one -- whatever that cause may be.

-- 
  Thor Lancelot Simon	                                     tls@rek.tjls.com

  "We cannot usually in social life pursue a single value or a single moral
   aim, untroubled by the need to compromise with others."      - H.L.A. Hart