lkml.org 
[lkml]   [2023]   [May]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/2] tpm, tpm_tis: Handle interrupt storm
On Wed, May 24, 2023 at 06:58:08AM +0300, Jarkko Sakkinen wrote:
> On Mon May 22, 2023 at 5:31 PM EEST, Lino Sanfilippo wrote:
> > + /*
> > + * The worker to free the TPM interrupt (free_irq_work) may already
> > + * be scheduled, so make sure it is not scheduled again.
> > + */
> > + if (!(chip->flags & TPM_CHIP_FLAG_IRQ))
> > + return;
> > +
> > + if (time_after(jiffies, priv->last_unhandled_irq + HZ/10))
> > + priv->unhandled_irqs = 1;
> > + else
> > + priv->unhandled_irqs++;
> > +
> > + priv->last_unhandled_irq = jiffies;
> > +
> > + if (priv->unhandled_irqs > MAX_UNHANDLED_IRQS)
> > + tpm_tis_handle_irq_storm(chip);
>
> Why wouldn't we switch to polling mode even when there is a single
> unhandled IRQ?

An unhandled IRQ can be legitimate if the interrupt is shared
with other devices and the IRQ was raised by one of them.

So you only want to switch to polling if there's a significant
amount of unhandled IRQs in a short period of time.

Thanks,

Lukas

\
 
 \ /
  Last update: 2023-05-24 09:30    [W:0.326 / U:0.768 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site