Page MenuHomeFreeBSD

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

Authored by ehem_freebsd_m5p.com on Jun 2 2022, 2:40 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Dec 12, 3:09 AM
Unknown Object (File)
Mon, Dec 9, 3:07 AM
Unknown Object (File)
Nov 6 2024, 2:39 PM
Unknown Object (File)
Nov 6 2024, 2:38 PM
Unknown Object (File)
Nov 6 2024, 2:38 PM
Unknown Object (File)
Nov 5 2024, 2:23 AM
Unknown Object (File)
Nov 5 2024, 2:23 AM
Unknown Object (File)
Nov 5 2024, 2:23 AM

Details

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 Not Applicable
Unit
Tests Not Applicable

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.

This revision was not accepted when it landed; it landed in state Needs Review.May 9 2024, 11:21 PM
This revision was automatically updated to reflect the committed changes.