FreeBSD Bugzilla – Attachment 194354 Details for
Bug 229106
intr_event_handle is unsafe with respect to interrupt handler list
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
code changes to greately increase likelihood of the race
interrupt-storm.intr_event_handle-race.diff (text/plain), 3.34 KB, created by
Andriy Gapon
on 2018-06-18 11:36:38 UTC
(
hide
)
Description:
code changes to greately increase likelihood of the race
Filename:
MIME Type:
Creator:
Andriy Gapon
Created:
2018-06-18 11:36:38 UTC
Size:
3.34 KB
patch
obsolete
>Index: sys/dev/usb/controller/ohci_pci.c >=================================================================== >--- sys/dev/usb/controller/ohci_pci.c (revision 334947) >+++ sys/dev/usb/controller/ohci_pci.c (working copy) >@@ -206,6 +206,12 @@ ohci_pci_probe(device_t self) > } > > static int >+ohci_pci_dummy_filter(void *unused __unused) >+{ >+ return (FILTER_HANDLED); >+} >+ >+static int > ohci_pci_attach(device_t self) > { > ohci_softc_t *sc = device_get_softc(self); >@@ -308,7 +314,7 @@ ohci_pci_attach(device_t self) > > #if (__FreeBSD_version >= 700031) > err = bus_setup_intr(self, sc->sc_irq_res, INTR_TYPE_BIO | INTR_MPSAFE, >- NULL, (driver_intr_t *)ohci_interrupt, sc, &sc->sc_intr_hdl); >+ ohci_pci_dummy_filter, NULL, sc, &sc->sc_intr_hdl); > #else > err = bus_setup_intr(self, sc->sc_irq_res, INTR_TYPE_BIO | INTR_MPSAFE, > (driver_intr_t *)ohci_interrupt, sc, &sc->sc_intr_hdl); >@@ -320,7 +326,7 @@ ohci_pci_attach(device_t self) > } > err = ohci_init(sc); > if (!err) { >- err = device_probe_and_attach(sc->sc_bus.bdev); >+ //err = device_probe_and_attach(sc->sc_bus.bdev); > } > if (err) { > device_printf(self, "USB init failed\n"); >Index: sys/kern/kern_intr.c >=================================================================== >--- sys/kern/kern_intr.c (revision 334947) >+++ sys/kern/kern_intr.c (working copy) >@@ -32,6 +32,8 @@ __FBSDID("$FreeBSD$"); > #include "opt_ddb.h" > #include "opt_kstack_usage_prof.h" > >+#define QUEUE_MACRO_DEBUG_TRASH >+ > #include <sys/param.h> > #include <sys/bus.h> > #include <sys/conf.h> >Index: sys/x86/x86/io_apic.c >=================================================================== >--- sys/x86/x86/io_apic.c (revision 334947) >+++ sys/x86/x86/io_apic.c (working copy) >@@ -149,6 +149,11 @@ static int enable_extint; > SYSCTL_INT(_hw_apic, OID_AUTO, enable_extint, CTLFLAG_RDTUN, &enable_extint, 0, > "Enable the ExtINT pin in the first I/O APIC"); > >+static u_int stuck_irq; >+SYSCTL_INT(_hw_apic, OID_AUTO, stuck_irq, CTLFLAG_RWTUN, &stuck_irq, 0, >+ "Make this interrupt appear to constantly fire after " >+ "it fires for the first time"); >+ > static void > _ioapic_eoi_source(struct intsrc *isrc, int locked) > { >@@ -157,13 +162,29 @@ _ioapic_eoi_source(struct intsrc *isrc, int locked > volatile uint32_t *apic_eoi; > uint32_t low1; > >+ src = (struct ioapic_intsrc *)isrc; >+ io = (struct ioapic *)isrc->is_pic; >+ > lapic_eoi(); >+ >+ if (src->io_irq == stuck_irq) { >+ /* >+ * Virtually re-raise the interrupt using >+ * IRQ Pin Assertion Register (0x20) >+ * after EOI-ing it. >+ */ >+ volatile uint32_t *apic_irq_assert; >+ >+ apic_irq_assert = (volatile uint32_t *) >+ ((volatile char *)io->io_addr + 0x20); >+ *apic_irq_assert = src->io_intpin; >+ } >+ > if (!lapic_eoi_suppression) > return; >- src = (struct ioapic_intsrc *)isrc; >+ > if (src->io_edgetrigger) > return; >- io = (struct ioapic *)isrc->is_pic; > > /* > * Handle targeted EOI for level-triggered pins, if broadcast >@@ -270,6 +291,19 @@ ioapic_enable_source(struct intsrc *isrc) > intpin->io_masked = 0; > } > mtx_unlock_spin(&icu_lock); >+ >+ if (intpin->io_irq == stuck_irq) { >+ /* >+ * Virtually re-raise the interrupt using >+ * IRQ Pin Assertion Register (0x20) >+ * after unmasking it. >+ */ >+ volatile uint32_t *apic_irq_assert; >+ >+ apic_irq_assert = (volatile uint32_t *) >+ ((volatile char *)io->io_addr + 0x20); >+ *apic_irq_assert = intpin->io_intpin; >+ } > } > > static void
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 229106
: 194354