genirq: Provide interrupt injection mechanism
authorThomas Gleixner <tglx@linutronix.de>
Fri, 6 Mar 2020 13:03:47 +0000 (14:03 +0100)
committerThomas Gleixner <tglx@linutronix.de>
Sun, 8 Mar 2020 10:06:42 +0000 (11:06 +0100)
commitacd26bcf362708594ea081ef55140e37d0854ed2
treeea4be8a0c4a40b41ef1ee936868f0cde3a8863d2
parentda90921acc62c71d27729ae211ccfda5370bf75b
genirq: Provide interrupt injection mechanism

Error injection mechanisms need a half ways safe way to inject interrupts as
invoking generic_handle_irq() or the actual device interrupt handler
directly from e.g. a debugfs write is not guaranteed to be safe.

On x86 generic_handle_irq() is unsafe due to the hardware trainwreck which
is the base of x86 interrupt delivery and affinity management.

Move the irq debugfs injection code into a separate function which can be
used by error injection code as well.

The implementation prevents at least that state is corrupted, but it cannot
close a very tiny race window on x86 which might result in a stale and not
serviced device interrupt under very unlikely circumstances.

This is explicitly for debugging and testing and not for production use or
abuse in random driver code.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Tested-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
Acked-by: Marc Zyngier <maz@kernel.org>
Link: https://lkml.kernel.org/r/20200306130623.990928309@linutronix.de
include/linux/interrupt.h
kernel/irq/Kconfig
kernel/irq/chip.c
kernel/irq/debugfs.c
kernel/irq/internals.h
kernel/irq/resend.c