On Thu, May 11, 2023 at 01:22:19PM +0200, Lino Sanfilippo wrote: > Since beside the one reported by Peter Zijlstra > (https://lore.kernel.org/linux-integrity/CSJ0AD1CFYQP.T6T68M6ZVK49@suppilovahvero/T/#t) > we have another interrupt storm here, it is probably the best to handle those in general > and to disable interrupts in this case to fall back to polling (this is also what Jerry > suggested in the thread above). > > I will try to provide a patch for this. In tpm_tis_probe_irq_single(), after you've requested the irq, you could convert it to a struct irq_desc (via irq_to_desc() from <linux/irqnr.h>) and cache that pointer in priv. Then in tis_int_handler(), you could access the irqs_unhandled member of struct irq_desc (from <linux/irqdesc.h>) and check if it exceeds, say, 5000. If it does, schedule a work_struct which calls disable_interrupts(). You can't call that from the IRQ handler because devm_free_irq() waits for the IRQ handler to finish, so you'd deadlock. You *can* of course clear the TPM_GLOBAL_INT_ENABLE bit from the IRQ handler, though it's unclear to me if that's sufficient to quiesce the interrupt line. By reusing the genirq subsystem's irqs_unhandled infrastructure, you avoid having to reimplement all of that. Thanks, Lukas