-
Notifications
You must be signed in to change notification settings - Fork 3.4k
fix INTRNG interrupt release #1281
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ehem
wants to merge
6
commits into
freebsd:main
Choose a base branch
from
ehem:intrfix
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
9fce87a
intrng: allocate event during isrc setup
ehem d276365
intrng: change isrc_free_irq()'s return to void
ehem 19f0238
intrng: destroy event when deregistering source
ehem 384a66a
intrng: invalidate ->isrc_index and ->isrc_count when releasing counters
ehem 67e532d
kern/intr: have intr_event_destroy() return success on NULL event
ehem 2a32e20
kern/intr: declare intr_event_destroy() __result_use_check
ehem File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change is wrong. We want this to be an error. It's a programming error to call this with NULL.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ones in
sys/netpfil/pf/are unlikely to trigger this. The only present way for them to trigger this is for something to scribble zeros over memory or some other sort of memory corruption. My concern is they're all callingintr_event_destroy()during shutdown, then either doingMPASS(rc == 0);or returning the error to the caller. If this isn't a debug kernel then the error could simply be lost (sys/netpfil/pf/if_pfsync.c:vnet_pfsync_uninit()). If this is a debug kernel, is apanic()truly a desirable result? I suspect these callers would instead prefer:As the rest of their shutdowns can still occur.
The situation for INTRNG (
sys/kern/subr_intr.c) is very different. INTRNG does lazy event allocation. Afterintr_isrc_register()returns,->isrc_eventis stillNULL.->isrc_eventdoesn't become non-NULLuntilisrc_add_handler()is called. As such:Will reliably output
intr_isrc_deregister() returned: 22. So there is a disagreement in the implementation about whatintr_event_destroy(NULL)should do/return. Since I'm looking at a driver which needsintr_isrc_deregister()to work, this is blocking for me.I suppose you could modify
isrc_event_destroy()to doif (isrc->isrc_event != NULL) return(0);. My concern with this is you're testing the same value twice and giving exactly opposite results for a problematic value. I cannot abide this, it is just too ugly (I will hold my nose and ignore it if someone else implements, but I will not implement).Another viable approach would be to remove lazy event allocation from INTRNG. I don't think lazy event allocation significantly helps INTRNG. I also observe major downsides to lazy event allocation (both here and other places you must first test
->isrc_event, you cannot assume non-NULL). I think it was a mistake to allow PowerPC and INTRNG to use lazy event allocation.Issue is this would basically invalidate the premise behind
INTR_SOLOand someone would be rather annoyed with that (D35607).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, one other approach I would be willing to implement. It would be acceptable to me to revert 39888ed and then have
isrc_event_destroy()check forisrc->isrc_event == NULL. It is the double checking forNULLwhich I have a problem with.I though would be quite happy if lazy event allocation was deprecated, and assured removing that would be accepted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In different terms, this situation is highly similar to c1287a3, Yes, it might be an error, but handing the error off to the caller drastically escalates the damage. Whereas handling it mitigates things.