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

From: Lino Sanfilippo
Date: Tue May 23 2023 - 06:35:48 EST


Hi,

On 23.05.23 11:35, Péter Ujfalusi wrote:
> ATTENTION: This e-mail is from an external sender. Please check attachments and links before opening e.g. with mouseover.
>
>
> 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
>

Thanks a lot for testing.

The patch was originally created to fix a reported interrupt storm:

https://lore.kernel.org/linux-integrity/d80b180a569a9f068d3a2614f062cfa3a78af5a6.camel@xxxxxxxxxx/

My hope was that it could also fix the issues seen with ThinkPad L490 and ThinkStation P360. But
in some of your test cases there seems to be no storm at all, so this patch wont help. So for now
I am afraid we have to keep the DMI quirks to handle these devices. I will adjust the commit
message accordingly.


Thanks,
Lino



> --
> Péter