Date: Wed, 18 Mar 2026 19:11:14 +0000 From: Colin Percival <cperciva@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: c25839cda69f - stable/14 - intrng: Shuffle unhandled interrupts too Message-ID: <69baf8d2.3891e.67a908ad@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch stable/14 has been updated by cperciva: URL: https://cgit.FreeBSD.org/src/commit/?id=c25839cda69f5c207b7685ec25a32a67914b0708 commit c25839cda69f5c207b7685ec25a32a67914b0708 Author: Colin Percival <cperciva@FreeBSD.org> AuthorDate: 2026-02-14 00:35:26 +0000 Commit: Colin Percival <cperciva@FreeBSD.org> CommitDate: 2026-03-18 19:10:42 +0000 intrng: Shuffle unhandled interrupts too When interrupt vectors are first allocated, they get assigned to CPU #0; at SI_SUB_SMP / SI_ORDER_SECOND (aka once we have multiple CPUs), the intr_irq_shuffle SYSINIT clears their CPU sets with the effect of forcing them to be assigned to new CPUs later. In case where interrupt vectors were allocated *but not yet bound* this code did not run, with the effect that those interrupts would remain pinned to CPU #0 forever. This affected the ena(4) driver, which allocates interrupts for I/O when the device is attached but doesn't set them up until the interface is brought up much later in the boot process (and, crucially, long after intr_irq_shuffle runs). Adjust intr_irq_shuffle to clear the CPU set for an interrupt source even if it currently has no handlers, so that it will be properly assigned to a CPU when it is used later. Reviewed by: andrew, mhorne MFC after: 1 month Sponsored by: Amazon Differential Revision: https://reviews.freebsd.org/D55284 (cherry picked from commit b2ba4131b9b08d6231392c0b798d0ff35809f600) --- sys/kern/subr_intr.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/sys/kern/subr_intr.c b/sys/kern/subr_intr.c index 6198603adfe8..d63a0e3629c5 100644 --- a/sys/kern/subr_intr.c +++ b/sys/kern/subr_intr.c @@ -1271,10 +1271,22 @@ intr_irq_shuffle(void *arg __unused) irq_assign_cpu = true; for (i = 0; i < intr_nirq; i++) { isrc = irq_sources[i]; - if (isrc == NULL || isrc->isrc_handlers == 0 || + if (isrc == NULL || isrc->isrc_flags & (INTR_ISRCF_PPI | INTR_ISRCF_IPI)) continue; + /* + * We can reach this point with isrc_handlers == 0 if a + * driver allocates interrupts but does not set them up + * immediately; for example, a network driver might + * postpone calling bus_setup_intr on I/O IRQ(s) until + * the interface is brought up. + */ + if (isrc->isrc_handlers == 0) { + CPU_ZERO(&isrc->isrc_cpu); + continue; + } + if (isrc->isrc_event != NULL && isrc->isrc_flags & INTR_ISRCF_BOUND && isrc->isrc_event->ie_cpu != CPU_FFS(&isrc->isrc_cpu) - 1)home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69baf8d2.3891e.67a908ad>
