Re: [PATCH 1/2] tpm, tpm_tis: Handle interrupt storm

From: Péter Ujfalusi
Date: Tue May 23 2023 - 05:34:37 EST


Hi,

sorry for the unwrapped lines...

On 23/05/2023 12:14, Péter Ujfalusi wrote:
>
>
> On 23/05/2023 10:44, Lukas Wunner wrote:
>> On Tue, May 23, 2023 at 09:48:23AM +0300, Péter Ujfalusi wrote:
>>> On 22/05/2023 17:31, Lino Sanfilippo wrote:
>> [...]
>>> This looked promising, however it looks like the UPX-i11 needs the DMI
>>> quirk.
>>
>> Why is that? Is there a fundamental problem with the patch or is it
>> a specific issue with that device?
>
> The flood is not detected (if there is a flood at all), interrupt stops
> working after about 200 interrupts - in the latest boot at 118th.
> I can check this later, likely tomorrow.

With the patches and this diff:

diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c
index 8f4f2cb5520f..6a910d3277d5 100644
--- a/drivers/char/tpm/tpm_tis_core.c
+++ b/drivers/char/tpm/tpm_tis_core.c
@@ -795,6 +795,7 @@ static void tpm_tis_process_unhandled_interrupt(struct tpm_chip *chip)

priv->last_unhandled_irq = jiffies;

+ pr_warn("[PETER] %s: unhandled_irqs: %d\n", __func__, priv->unhandled_irqs);
if (priv->unhandled_irqs > MAX_UNHANDLED_IRQS)
tpm_tis_handle_irq_storm(chip);
}


In some boot I don't get a print at all and reboot takes
2 minutes (tpm timeout), or as it happened now:

# dmesg | grep tpm
[ 4.306999] tpm_tis MSFT0101:00: 2.0 TPM (device-id 0x1B, rev-id 22)
[ 4.325868] [PETER] tpm_tis_process_unhandled_interrupt: unhandled_irqs: 1
[ 4.325908] [PETER] tpm_tis_process_unhandled_interrupt: unhandled_irqs: 2
...
[ 4.329579] [PETER] tpm_tis_process_unhandled_interrupt: unhandled_irqs: 91
[ 5.129056] [PETER] tpm_tis_process_unhandled_interrupt: unhandled_irqs: 1
...
[ 5.129561] [PETER] tpm_tis_process_unhandled_interrupt: unhandled_irqs: 10

# cat /proc/interrupts | grep tpm
28: 0 0 0 133 IR-IO-APIC 28-fasteoi tpm0

Reboot takes in all cases 2 minutes to pass the timeout for the TPM2_CC_SHUTDOWN

--
Péter