mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-08-15 23:53:51 +00:00

There have been a few bugs and/or misunderstandings about the reference
counting, and startup/shutdown behaviors in the IRQ core and related CPU
hotplug code. These 4 test cases try to capture a few interesting cases.
* irq_disable_depth_test: basic request/disable/enable sequence
* irq_free_disabled_test: request/disable/free/re-request sequence -
this catches errors on previous revisions of my work
* irq_cpuhotplug_test: exercises managed-affinity IRQ + CPU hotplug.
This captures a problematic test case which was fixed recently.
This test requires CONFIG_SMP and a hotpluggable CPU#1.
* irq_shutdown_depth_test: exercises similar behavior from
irq_cpuhotplug_test, but directly using irq_*() APIs instead of going
through CPU hotplug. This still requires CONFIG_SMP, because
managed-affinity is stubbed out (and not all APIs are even present)
without it.
Note the use of 'imply SMP': ARCH=um doesn't support SMP, and kunit is
often exercised there. Thus, 'imply' will force SMP on where possible
(such as ARCH=x86_64), but leave it off where it's not.
Behavior on various SMP and ARCH configurations:
$ tools/testing/kunit/kunit.py run 'irq_test_cases*' --arch x86_64 --qemu_args '-smp 2'
[...]
[11:12:24] Testing complete. Ran 4 tests: passed: 4
$ tools/testing/kunit/kunit.py run 'irq_test_cases*' --arch x86_64
[...]
[11:13:27] [SKIPPED] irq_cpuhotplug_test
[11:13:27] ================= [PASSED] irq_test_cases ==================
[11:13:27] ============================================================
[11:13:27] Testing complete. Ran 4 tests: passed: 3, skipped: 1
# default: ARCH=um
$ tools/testing/kunit/kunit.py run 'irq_test_cases*'
[11:14:26] [SKIPPED] irq_shutdown_depth_test
[11:14:26] [SKIPPED] irq_cpuhotplug_test
[11:14:26] ================= [PASSED] irq_test_cases ==================
[11:14:26] ============================================================
[11:14:26] Testing complete. Ran 4 tests: passed: 2, skipped: 2
Without commit 788019eb55
("genirq: Retain disable depth for managed
interrupts across CPU hotplug"), this fails as follows:
[11:18:55] =============== irq_test_cases (4 subtests) ================
[11:18:55] [PASSED] irq_disable_depth_test
[11:18:55] [PASSED] irq_free_disabled_test
[11:18:55] # irq_shutdown_depth_test: EXPECTATION FAILED at kernel/irq/irq_test.c:147
[11:18:55] Expected desc->depth == 1, but
[11:18:55] desc->depth == 0 (0x0)
[11:18:55] ------------[ cut here ]------------
[11:18:55] Unbalanced enable for IRQ 26
[11:18:55] WARNING: CPU: 1 PID: 36 at kernel/irq/manage.c:792 __enable_irq+0x36/0x60
...
[11:18:55] [FAILED] irq_shutdown_depth_test
[11:18:55] #1
[11:18:55] # irq_cpuhotplug_test: EXPECTATION FAILED at kernel/irq/irq_test.c:202
[11:18:55] Expected irqd_is_activated(data) to be false, but is true
[11:18:55] # irq_cpuhotplug_test: EXPECTATION FAILED at kernel/irq/irq_test.c:203
[11:18:55] Expected irqd_is_started(data) to be false, but is true
[11:18:55] # irq_cpuhotplug_test: EXPECTATION FAILED at kernel/irq/irq_test.c:204
[11:18:55] Expected desc->depth == 1, but
[11:18:55] desc->depth == 0 (0x0)
[11:18:55] ------------[ cut here ]------------
[11:18:55] Unbalanced enable for IRQ 27
[11:18:55] WARNING: CPU: 0 PID: 38 at kernel/irq/manage.c:792 __enable_irq+0x36/0x60
...
[11:18:55] [FAILED] irq_cpuhotplug_test
[11:18:55] # module: irq_test
[11:18:55] # irq_test_cases: pass:2 fail:2 skip:0 total:4
[11:18:55] # Totals: pass:2 fail:2 skip:0 total:4
[11:18:55] ================= [FAILED] irq_test_cases ==================
[11:18:55] ============================================================
[11:18:55] Testing complete. Ran 4 tests: passed: 2, failed: 2
Signed-off-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/all/20250522210837.4135244-1-briannorris@chromium.org
171 lines
3.9 KiB
Plaintext
171 lines
3.9 KiB
Plaintext
# SPDX-License-Identifier: GPL-2.0-only
|
|
menu "IRQ subsystem"
|
|
# Options selectable by the architecture code
|
|
|
|
# Make sparse irq Kconfig switch below available
|
|
config MAY_HAVE_SPARSE_IRQ
|
|
bool
|
|
|
|
# Legacy support, required for itanic
|
|
config GENERIC_IRQ_LEGACY
|
|
bool
|
|
|
|
# Enable the generic irq autoprobe mechanism
|
|
config GENERIC_IRQ_PROBE
|
|
bool
|
|
|
|
# Use the generic /proc/interrupts implementation
|
|
config GENERIC_IRQ_SHOW
|
|
bool
|
|
|
|
# Print level/edge extra information
|
|
config GENERIC_IRQ_SHOW_LEVEL
|
|
bool
|
|
|
|
# Supports effective affinity mask
|
|
config GENERIC_IRQ_EFFECTIVE_AFF_MASK
|
|
depends on SMP
|
|
bool
|
|
|
|
# Support for delayed migration from interrupt context
|
|
config GENERIC_PENDING_IRQ
|
|
bool
|
|
|
|
# Support for generic irq migrating off cpu before the cpu is offline.
|
|
config GENERIC_IRQ_MIGRATION
|
|
bool
|
|
|
|
# Alpha specific irq affinity mechanism
|
|
config AUTO_IRQ_AFFINITY
|
|
bool
|
|
|
|
# Interrupt injection mechanism
|
|
config GENERIC_IRQ_INJECTION
|
|
bool
|
|
|
|
# Tasklet based software resend for pending interrupts on enable_irq()
|
|
config HARDIRQS_SW_RESEND
|
|
bool
|
|
|
|
# Generic configurable interrupt chip implementation
|
|
config GENERIC_IRQ_CHIP
|
|
bool
|
|
select IRQ_DOMAIN
|
|
|
|
# Generic irq_domain hw <--> linux irq number translation
|
|
config IRQ_DOMAIN
|
|
bool
|
|
|
|
# Support for simulated interrupts
|
|
config IRQ_SIM
|
|
bool
|
|
select IRQ_WORK
|
|
select IRQ_DOMAIN
|
|
|
|
# Support for hierarchical irq domains
|
|
config IRQ_DOMAIN_HIERARCHY
|
|
bool
|
|
select IRQ_DOMAIN
|
|
|
|
# Support for obsolete non-mapping irq domains
|
|
config IRQ_DOMAIN_NOMAP
|
|
bool
|
|
select IRQ_DOMAIN
|
|
|
|
# Support for hierarchical fasteoi+edge and fasteoi+level handlers
|
|
config IRQ_FASTEOI_HIERARCHY_HANDLERS
|
|
bool
|
|
|
|
# Generic IRQ IPI support
|
|
config GENERIC_IRQ_IPI
|
|
bool
|
|
depends on SMP
|
|
select IRQ_DOMAIN_HIERARCHY
|
|
|
|
# Generic IRQ IPI Mux support
|
|
config GENERIC_IRQ_IPI_MUX
|
|
bool
|
|
depends on SMP
|
|
|
|
# Generic MSI hierarchical interrupt domain support
|
|
config GENERIC_MSI_IRQ
|
|
bool
|
|
select IRQ_DOMAIN_HIERARCHY
|
|
|
|
# irqchip drivers should select this if they call iommu_dma_prepare_msi()
|
|
config IRQ_MSI_IOMMU
|
|
bool
|
|
|
|
config IRQ_TIMINGS
|
|
bool
|
|
|
|
config GENERIC_IRQ_MATRIX_ALLOCATOR
|
|
bool
|
|
|
|
config GENERIC_IRQ_RESERVATION_MODE
|
|
bool
|
|
|
|
# Snapshot for interrupt statistics
|
|
config GENERIC_IRQ_STAT_SNAPSHOT
|
|
bool
|
|
|
|
# Support forced irq threading
|
|
config IRQ_FORCED_THREADING
|
|
bool
|
|
|
|
config SPARSE_IRQ
|
|
bool "Support sparse irq numbering" if MAY_HAVE_SPARSE_IRQ
|
|
help
|
|
|
|
Sparse irq numbering is useful for distro kernels that want
|
|
to define a high CONFIG_NR_CPUS value but still want to have
|
|
low kernel memory footprint on smaller machines.
|
|
|
|
( Sparse irqs can also be beneficial on NUMA boxes, as they spread
|
|
out the interrupt descriptors in a more NUMA-friendly way. )
|
|
|
|
If you don't know what to do here, say N.
|
|
|
|
config GENERIC_IRQ_DEBUGFS
|
|
bool "Expose irq internals in debugfs"
|
|
depends on DEBUG_FS
|
|
select GENERIC_IRQ_INJECTION
|
|
default n
|
|
help
|
|
|
|
Exposes internal state information through debugfs. Mostly for
|
|
developers and debugging of hard to diagnose interrupt problems.
|
|
|
|
If you don't know what to do here, say N.
|
|
|
|
# Clear forwarded VM interrupts during kexec.
|
|
# This option ensures the kernel clears active states for interrupts
|
|
# forwarded to virtual machines (VMs) during a machine kexec.
|
|
config GENERIC_IRQ_KEXEC_CLEAR_VM_FORWARD
|
|
bool
|
|
|
|
config IRQ_KUNIT_TEST
|
|
bool "KUnit tests for IRQ management APIs" if !KUNIT_ALL_TESTS
|
|
depends on KUNIT=y
|
|
default KUNIT_ALL_TESTS
|
|
imply SMP
|
|
help
|
|
This option enables KUnit tests for the IRQ subsystem API. These are
|
|
only for development and testing, not for regular kernel use cases.
|
|
|
|
If unsure, say N.
|
|
|
|
endmenu
|
|
|
|
config GENERIC_IRQ_MULTI_HANDLER
|
|
bool
|
|
help
|
|
Allow to specify the low level IRQ handler at run time.
|
|
|
|
# Cavium Octeon is the last system to use this deprecated option
|
|
# Do not even think of enabling this on any new platform
|
|
config DEPRECATED_IRQ_CPU_ONOFFLINE
|
|
bool
|
|
depends on CAVIUM_OCTEON_SOC
|
|
default CAVIUM_OCTEON_SOC
|