Interrupt counters on struct intr_event#1301
Conversation
|
I do not guarantee I've sufficiently resolved issues brought up via Phabricator, even though I have tried. This seems the way to go. |
| if (!thread && !filter) { | ||
| ++ie->ie_stray; | ||
| return (stray ? ie->ie_stray : 0); | ||
| } |
There was a problem hiding this comment.
Kind of a wishlist item. I'm looking at a device which is known to generate a stray interrupt during start. I would rather like to have it counted, yet returning FILTER_STRAY causes all interrupt controllers to mask the interrupt. Given the device, this would be Bad, as a result the present driver simply always returns FILTER_HANDLED.
| if ((flags & INTR_MULTIPROC) && !(ie->ie_flags & IE_MULTIPROC)) { | ||
| #if defined(INVARIANTS) || defined(DEBUG) | ||
| printf("%s: Requested multi-processor interupt, but got " | ||
| "uniprocessor interrupt\n", name); | ||
| #endif | ||
| return (ENODEV); | ||
| } | ||
| #if defined(INVARIANTS) || defined(DEBUG) | ||
| if (!(flags & INTR_MULTIPROC) && (ie->ie_flags & IE_MULTIPROC)) | ||
| printf("%s: Requested uniprocessor interupt, but got " | ||
| "multi-processor interrupt\n", name); | ||
| #endif | ||
|
|
There was a problem hiding this comment.
Seems something which really should have some way for a driver to indicate, "I'd damn well better get a PPI interrupt, or I'll panic()!"
|
I'm planning to update to FreeBSD's HEAD soon. There will be a rebase in a few hours. |
8bd76cd to
d862657
Compare
| if (!CK_SLIST_EMPTY(&clk_intr_event->ie_handlers)) | ||
| intr_event_handle(clk_intr_event, NULL); |
There was a problem hiding this comment.
|
I don't recall who forced per-processor for PPI counters due to indicating they would veto atomic increment. This does provide the valuable feature of showing which processors the PPI is occurring on. Otherwise you're left unsure whether your PPI interrupt being triggered on a single processor, or several. Also tells you how evenly it is spread. On balance I think this is distinctly superior to INTRNG's choice to use atomic increment. |
|
Note, ARM64 has been tested and was helpful with confirming a fully operational PPI interrupt. x86 and PowerPC are untested. I guess the point here is, why is this information being copied back and forth between the events and the architecture tables, and simply being duplicated in both places? All of this really should be in one place. |
110d7c7 to
e98b020
Compare
|
Thank you for taking the time to contribute to FreeBSD! There is an issue that needs to be resolved:
Note Please review CONTRIBUTING.md, then update and push your branch again. |
|
Upon checking I remember why I originally tried this. Still potentially viable as an alternative solution to a pesky issue. Note, this has simply been rebased and not properly checked. There is a good chance some of the commits have become broken in the interim, so exercise care with this. |
1d67bf7 to
a39d694
Compare
Some interrupt types can be signaled on multiple processors. These need adjustment to their handling (notably adjustment to counter handling). Mark clk_intr_event as being multi-processor (it is). Differential Revision: https://reviews.freebsd.org/D38448
This should ensure devices needing a PPI interrupt receive a PPI interrupt. In debug kernels warn in case of mismatch between request and retrieved intr_event. Differential Revision: https://reviews.freebsd.org/D38448
Announce as these are allocated to assist debugging issues with these counters (as they are a limited resource).
This allows architectures to provide the interrupt names/counters from intr_event, instead of the architecture tables. Since the tables are inferior for normal interrupts, but functional for IPI interrupts this is a substantial step forward. Differential Revision: https://reviews.freebsd.org/D36610
The tables of interrupt names and counts are a layering violation. Moving the SYSCTL_PROC()s to architecture functions as a first step towards moving the handling to the architecture. Differential Revision: https://reviews.freebsd.org/D38454
The tables of interrupt names and counts are a layering violation. Let architecture code handle these as this form causes trouble for architecture interrupt implementations. Differential Revision: https://reviews.freebsd.org/D38454
For most operations using the count of interrupts instead of the raw table size is superior. Notably adding entries is faster. Computing the full table size is quite fast. In the longer term a single variable is smaller too. Differential Revision: https://reviews.freebsd.org/D38116
Clean out the now-unused counters/interrupt names for normal interrupts. The table is now strictly used for IPI interrupts, so all of this support can go. Differential Revision: https://reviews.freebsd.org/D38451
This allows architectures to provide the interrupt names/counters from intr_event, instead of the architecture tables. Since the tables are inferior for normal interrupts, but functional for IPI interrupts this is a substantial step forward. Differential Revision: https://reviews.freebsd.org/D36610
These are now strictly being used for counting IPI interrupts, thus can be removed from monoprocessor builds.
The tables of interrupt names and counts are a layering violation. Let architecture code handle these as this form causes trouble for architecture interrupt implementations. Differential Revision: https://reviews.freebsd.org/D38454
Since all interrupt table implementations use the same index variable to indicate current table size, use that instead of size variables. Differential Revision: https://reviews.freebsd.org/D38116
This allows architectures to provide the interrupt names/counters from intr_event, instead of the architecture tables. Since the tables are inferior for normal interrupts, but functional for IPI interrupts this is a substantial step forward. Differential Revision: https://reviews.freebsd.org/D36610
These counters are now used strictly for IPI/PPI interrupts. Purge support for normal interrupts as those are now *strictly* on intr_event. The comment at the nintrcnt computation was incorrect. Multiple hypervisor drivers use a per-core set of interrupts, but generally only one hypervisor driver will be loaded. Differential Revision: https://reviews.freebsd.org/D38453
The tables of interrupt names and counts are a layering violation. Let architecture code handle these as this form causes trouble for architecture interrupt implementations. Differential Revision: https://reviews.freebsd.org/D38454
Since all interrupt table implementations use the same index variable to indicate current table size, use that instead of size variables. Differential Revision: https://reviews.freebsd.org/D38116
This allows architectures to provide the interrupt names/counters from intr_event, instead of the architecture tables. Since the tables are inferior for normal interrupts, but functional for IPI interrupts this is a substantial step forward. Differential Revision: https://reviews.freebsd.org/D36610
The counters/names are now used strictly for IPI/PPI interrupts. Rather more of the source was shared between IPI and normal interrupts, so relatively little disappears. Differential Revision: https://reviews.freebsd.org/D38452
The sysctl()s are now handled by the architecture. The tables were a layering violation and have been removed. Let architecture implementations modify their handling depending on their needs. Differential Revision: https://reviews.freebsd.org/D38454
These are now strictly being used for counting IPI interrupts, thus can be removed from monoprocessor builds.
The "???" interrupt doesn't appear useful any more, so remove it. Differential Revision: https://reviews.freebsd.org/D37869
clk_intr_event is a clock interrupt, not a generalized interrupt. As such everything should be in clock.h/kern_clock.c instead of interrupt.h/kern_intr.c.
clk_intr_event was added strictly for ACPI. While additional uses could be added in the future, presently this is ACPI-only. Remove it from non-ACPI kernels. Correct the uses of intr_event_handle(). If no handlers are added by ACPI, invoking intr_event_handle() is incorrect as it is stray. Fixes: aba10e1 ("Allow swi_sched() to be called from NMI context.") Differential Revision: https://reviews.freebsd.org/D40776
If swi_add() is used to initialize an event without adding a handler, the name should be used as the device name. Otherwise there can be mysterious unnamed events lying around.
Comparable to the current situation. Minor savings, one caller simply passes the count directly through. Differential Revision: https://reviews.freebsd.org/D38449
This needs checking. I'm unsure of why the notyet is still here, but removing it /might/ be bad. Differential Revision: https://reviews.freebsd.org/D38449
Filter function can return more than just FILTER_STRAY. As such a filter might return FILTER_STRAY | FILTER_HANDLED to indicate stray counters should be incremented, but the interrupt should NOT be masked.
Reading event names doesn't require exclusive access. Differential Revision: https://reviews.freebsd.org/D38450
Some interrupt types can be signaled on multiple processors. These need adjustment to their handling (notably adjustment to counter handling). Mark clk_intr_event as being multi-processor. I'm doubting this is correct. Kind of makes sense to have SWIs have per-processor counters, on the flip side they do move. This should likely either be squashed back into the rest of the commit, or dropped. Differential Revision: https://reviews.freebsd.org/D38448
Every architecture has counters just outside
struct intr_event. As such it seems appropriate to try to move them ontostruct intr_eventto reduce differences between architectures.There is also an issue of the interface between architecture and core. The core has been implementing
hw.intrcntandhw.intrnames, yet forcing architectures to handle the tables behind these. This results in rather troublesome mixing.