Page MenuHomeFreeBSD

intr/x86: replace use of vector in interface with intsrc
Needs ReviewPublic

Authored by ehem_freebsd_m5p.com on Jun 2 2022, 2:40 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Apr 20, 1:54 PM
Unknown Object (File)
Dec 20 2023, 2:34 AM
Unknown Object (File)
Dec 10 2023, 1:20 AM
Unknown Object (File)
Oct 11 2023, 8:17 PM
Unknown Object (File)
Aug 14 2023, 11:06 AM
Unknown Object (File)
Jun 25 2023, 5:34 AM
Unknown Object (File)
May 24 2023, 12:41 AM
Unknown Object (File)
Mar 5 2023, 5:41 PM

Details

Reviewers
kib
markj
jhb
Summary

Several x86 interrupt core functions were already operating on intsrc
structures. Now switch the remaining 4 to intsrc for consistency.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 56192
Build 53080: arc lint + arc unit

Event Timeline

Came up as part of guess what. Upon examination it turns out the Xen event channel (interrupt equivalent) code only needs to preserve the interrupt number for calling intr_add_handler() and intr_describe(). Add variants which instead accept the struct intsrc and the Xen code could simply discard the interrupt number.

The one issue is where the isrc == NULL check should be? Should the _intsrc variants be able to deal with being passed NULL sources?

I should add, intr_bind() and intr_config_intr() also seem good candidates for this treatment. I though cannot cite any places which would currently benefit from the functionality.

Came up as part of guess what. Upon examination it turns out the Xen event channel (interrupt equivalent) code only needs to preserve the interrupt number for calling intr_add_handler() and intr_describe(). Add variants which instead accept the struct intsrc and the Xen code could simply discard the interrupt number.

Given that the amount of churn involved looks to be minimal, and since some of the public functions here already operate on intsrcs, I would suggest simply changing the existing functions to take an intsrc, and then handle lookups in nexus. intr_lookup_source() is already used extensively in consumers.

The one issue is where the isrc == NULL check should be? Should the _intsrc variants be able to deal with being passed NULL sources?

Existing intr_* functions which take an intsrc do not perform such a check, so I would not attempt to handle NULL in the new variants either.

Updating per @markj's comment. I'm unsure whether any portions of the nexus code can assume the interrupt number is valid and skip the == NULL check.

ehem_freebsd_m5p.com retitled this revision from intr/x86: add intsrc variants of functions to intr/x86: replace use of vector in interface with intsrc.Jun 4 2022, 12:01 AM
ehem_freebsd_m5p.com edited the summary of this revision. (Show Details)
ehem_freebsd_m5p.com added a subscriber: royger.

Looks reasonable to me.

This revision is now accepted and ready to land.Jun 5 2022, 3:25 PM

Available in a form handy to git at https://gitlab.com/ehem/freebsd-src.git branches "D35386" and "D35406". I suspect I'll be asking @royger to push fairly soon though.

Due to D36901 getting in first, intr_bind() has disappeared and the portion of D35386 adjusting the interface disappears.

I'm awfully tempted to switch the order of intr_add_handler()'s first two arguments to make the interface more consistent. This also moves x86 closer to INTRNG (the opposite could be done, but I feel INTRNG got this one right).

No activity since I don't have a commit bit of my own.

Due to D36901 getting in first, intr_bind() disappeared. As threatened, I really like intr_add_handler()'s first two arguments being in the opposite order. Not only does this seem more consistent with the rest of the interface, but this also matches INTRNG (the domain argument is now the only difference).

This revision now requires review to proceed.Feb 20 2024, 8:14 PM

Update to better reflect current state of FreeBSD tree. My repository had several patches, one of which had modified intr_describe(). As such this better reflects current state.