Page MenuHomeFreeBSD

kern/intr: allow for event allocation outside kern_intr.c
Changes PlannedPublic

Authored by ehem_freebsd_m5p.com on Jun 6 2022, 11:22 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Apr 22, 7:23 AM
Unknown Object (File)
Jan 10 2024, 9:04 AM
Unknown Object (File)
Dec 22 2023, 11:29 PM
Unknown Object (File)
Dec 17 2023, 5:47 PM
Unknown Object (File)
Dec 10 2023, 8:29 PM
Unknown Object (File)
Sep 27 2023, 6:50 PM
Unknown Object (File)
Sep 6 2023, 7:05 AM
Unknown Object (File)
Aug 14 2023, 10:42 AM

Details

Reviewers
markj
jhb
Summary

In some cases it may be better to allocate the intr_event structure
outside of kern_intr. Notably if an interrupt controller needed data
attached to the event instead of the PIC.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 45877
Build 42765: arc lint + arc unit

Event Timeline

The idea is some interrupt controllers are very dynamic. Some need to change their interrupt assignments on suspend/resume. For such controllers it seems to make more sense to keep device information attached to the event structure, rather than the architecture interrupt source structure. This would allow such dynamic controllers to swap interrupts around without needing to copy data attached to the source structure.

sys/kern/kern_intr.c
302–303

I kind of want to put a KASSERT(event != NULL, ("%s(): NULL event passed in", __func__)); at the top of intr_event_initv() and remove these two lines. The event being NULL seems nonsensical.

Any reviews for this? While it will take a while to make use of this, I have a definite use for this. I was actually hoping for progress, not merely silence on this.

If there was a desire to keep all struct intr_event structures in the M_ITHREAD pool, an alternative approach would be to instead add a size argument before the format argument. If the size is zero, allocate sizeof(struct intr_event), if non-zero allocate that much memory (then KASSERT(size >= sizeof(struct intr_event))).

The goal is often data is attached to the various architecture interrupt structures, but in some cases that data is better attached to the event. This is valuable for dynamic interrupt controllers which have to be reprogrammed after system suspend; the events could be shuffled to reflect where the interrupting devices moved to, instead of shuffling the architecture interrupt structures. I don't know for certain whether this would actually improve things, but it certainly looks to have potential.

I'm distinctly unsure of the idea presently. I would like to get things better merged together, but for now other things take priority.