Page MenuHomeFreeBSD

intr/x86: identify IRQ 0 by intsrc instead of vector
AbandonedPublic

Authored by ehem_freebsd_m5p.com on Jun 20 2022, 2:01 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Nov 8, 10:17 PM
Unknown Object (File)
Thu, Nov 6, 2:04 AM
Unknown Object (File)
Sat, Nov 1, 4:39 PM
Unknown Object (File)
Wed, Oct 29, 10:26 AM
Unknown Object (File)
Wed, Oct 29, 10:18 AM
Unknown Object (File)
Sat, Oct 25, 2:19 PM
Unknown Object (File)
Sun, Oct 19, 1:57 PM
Unknown Object (File)
Oct 16 2025, 4:38 AM
Subscribers

Details

Reviewers
markj
jhb
kib
Summary

The uses of vector in intr_execute_handlers() seem a bit out of place.
Since the intsrc can be checked for whether it is IRQ 0, do that
instead.

Diff Detail

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

Event Timeline

In case you hadn't guessed from D35386, I'm trying to remove all uses of the interrupt number from the interface aside from intr_register_source() and intr_lookup_source() (those two require it by their very nature). intr_execute_handlers() is trickier than the other uses.

I'm looking at one software PIC-like driver which doesn't really operate on proper IRQs (the Xen event channel) and the interface of intr_execute_handlers() is a bit of a mismatch. I'm now wondering if switching to vlog() would be plausible.

This seems ok, but I wonder how we can get rid of this hack altogether. clkintr_pending is only used when the intel 8254 timer is used as the system eventtimer (i.e., sc->period != 0) and timecounter, so it's entirely unused on contemporary hardware.

WRT to vlog(), I don't see any problem with using that here...

Yeah I was wondering about that. My goal though is getting rid of references to vector, not getting rid of the hack. Ideally this could be handled in a filter function. Perhaps that approach wasn't used in 2003 (ecee5704ed50) since the situation with filters versus handlers wasn't in a stable state.

The value of doing this may simply be to mitigate bugs if someone tries to use an incompletely initialized struct intsrc and mistakenly passes 0. Also during bring-up a driver might use 0 as a placeholder and this could make early bring-up easier. Even though the real issue should be fixed, this still has value.