linux/drivers/char
Lino Sanfilippo 481c2d1462 tpm,tpm_tis: Disable interrupts after 1000 unhandled IRQs
After activation of interrupts for TPM TIS drivers 0-day reports an
interrupt storm on an Inspur NF5180M6 server.

Fix this by detecting the storm and falling back to polling:
Count the number of unhandled interrupts within a 10 ms time interval. In
case that more than 1000 were unhandled deactivate interrupts entirely,
deregister the handler and use polling instead.

Also print a note to point to the tpm_tis_dmi_table.

Since the interrupt deregistration function devm_free_irq() waits for all
interrupt handlers to finish, only trigger a worker in the interrupt
handler and do the unregistration in the worker to avoid a deadlock.

Note: the storm detection logic equals the implementation in
note_interrupt() which uses timestamps and counters stored in struct
irq_desc. Since this structure is private to the generic interrupt core
the TPM TIS core uses its own timestamps and counters. Furthermore the TPM
interrupt handler always returns IRQ_HANDLED to prevent the generic
interrupt core from processing the interrupt storm.

Cc: stable@vger.kernel.org # v6.4+
Fixes: e644b2f498 ("tpm, tpm_tis: Enable interrupt test")
Reported-by: kernel test robot <yujie.liu@intel.com>
Closes: https://lore.kernel.org/oe-lkp/202305041325.ae8b0c43-yujie.liu@intel.com/
Suggested-by: Lukas Wunner <lukas@wunner.de>
Signed-off-by: Lino Sanfilippo <l.sanfilippo@kunbus.com>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
2023-07-17 19:40:27 +00:00
..
agp parisc: Flush gatt writes and adjust gatt mask in parisc_agp_mask_memory() 2023-05-22 18:30:52 +02:00
hw_random hwrng: imx-rngc - switch to DEFINE_SIMPLE_DEV_PM_OPS 2023-06-23 16:15:37 +08:00
ipmi Driver core changes for 6.4-rc1 2023-04-27 11:53:57 -07:00
mwave char/mwave: Adjust io port register size 2021-12-03 14:27:06 +01:00
tpm tpm,tpm_tis: Disable interrupts after 1000 unhandled IRQs 2023-07-17 19:40:27 +00:00
xilinx_hwicap xilinx_hwicap: make icap_class a static const structure 2023-06-23 10:27:23 +02:00
xillybus char: xillybus: make xillybus_class a static const structure 2023-06-23 10:27:26 +02:00
adi.c
apm-emulation.c apm-emulation: drop unexpected word "the" in the comments 2022-06-27 16:15:27 +02:00
applicom.c applicom: Fix PCI device refcount leak in applicom_init() 2023-01-20 13:05:39 +01:00
applicom.h
bsr.c bsr: fix build problem with bsr_class static cleanup 2023-06-26 11:05:16 +02:00
ds1620.c
dsp56k.c dsp56k: make dsp56k_class a static const structure 2023-06-23 10:27:08 +02:00
dtlk.c
hangcheck-timer.c
hpet.c hpet: remove unused writeq/readq function definitions 2022-02-04 16:45:39 +01:00
Kconfig char: add HAS_IOPORT dependencies 2023-05-31 19:17:29 +01:00
lp.c char: lp: make lp_class a static const structure 2023-06-23 10:27:11 +02:00
Makefile char: pcmcia: remove all the drivers 2023-03-09 17:30:27 +01:00
mem.c Char/Misc and other driver subsystem updates for 6.5-rc1 2023-07-03 12:46:47 -07:00
misc.c char: misc: make misc_class a static const structure 2023-06-23 10:27:15 +02:00
mspec.c mm: replace vma->vm_flags direct modifications with modifier calls 2023-02-09 16:51:39 -08:00
nsc_gpio.c
nvram.c
nwbutton.c
nwbutton.h
nwflash.c
pc8736x_gpio.c
powernv-op-panel.c
ppdev.c ppdev: make ppdev_class a static const structure 2023-06-23 10:27:17 +02:00
ps3flash.c
random.c tty, proc, kernfs, random: Use copy_splice_read() 2023-05-24 08:42:16 -06:00
scx200_gpio.c
sonypi.c ACPI: make remove callback of ACPI driver void 2022-11-23 19:11:22 +01:00
tlclk.c
toshiba.c
ttyprintk.c char: ttyprintk: register console 2022-04-22 16:24:47 +02:00
uv_mmtimer.c
virtio_console.c virtio: features, fixes, cleanups 2023-07-03 15:38:26 -07:00