Subject: Re: Bug in x86 ioapic interrupt code for devices with shared interrupts?
To: None <tls@rek.tjls.com>
From: None <jonathan@dsg.stanford.edu>
List: tech-kern
Date: 03/03/2006 14:25:44
Thor,

I see that FreeBSD has, for some years now, had code at the very
front of bge_intr() looking like:

	bge_statusword =
	  atomic_read_and_clear(&sc->bge_rdata->bge_status_block.bge_status)


the remainder of bge_intr() then uses bge_statusword to decide what
work, if any, to do during the current invocation.

(I suspect the atomic instruction is extraneous, introduced due to
backporting fixes from an SMP-safe FreeBSD-5 driver without particular
care to whether FreeBSD-4 needs the SMP-safeness; tho' from this far
away, it's hard to be certain


OpenBSD has simliar code, without the SMP-safe-atomic-operation
accretions:

	/* Make sure this is really our interrupt. */
	if (!(sc->bge_rdata->bge_status_block.bge_status &
	    BGE_STATFLAG_UPDATED))
		return (0);


Given that mere mortals can't get either vendor design docs on this
chip family, or solid design-level insight into the (poorly-designed)
open-source drivers, I'd somewhat prefer to copy the solutino seen in
the {Free,Open}BSD variants of bge(4).

Anyway.... I'll try to squeeze testing one patch or other, or both,
onwhatever set of bge's I can dregde up, into my already- overcommited
weekend.  Or by Wednesday for sure.