public inbox for linux-integrity@vger.kernel.org
 help / color / mirror / Atom feed
From: Lino Sanfilippo <l.sanfilippo@kunbus.com>
To: Jarkko Sakkinen <jarkko@kernel.org>,
	Lino Sanfilippo <LinoSanfilippo@gmx.de>,
	peterhuewe@gmx.de, jgg@ziepe.ca
Cc: jsnitsel@redhat.com, hdegoede@redhat.com, oe-lkp@lists.linux.dev,
	lkp@intel.com, peter.ujfalusi@linux.intel.com,
	peterz@infradead.org, linux@mniewoehner.de,
	linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org,
	lukas@wunner.de, p.rosenberger@kunbus.com
Subject: Re: [PATCH 1/2] tpm, tpm_tis: Handle interrupt storm
Date: Fri, 26 May 2023 02:37:30 +0200	[thread overview]
Message-ID: <b2c597c1-e596-55d9-1c1d-aec36ec30744@kunbus.com> (raw)
In-Reply-To: <CSUM65JDEX5D.8GL20PUI2XDV@suppilovahvero>



On 24.05.23 17:30, Jarkko Sakkinen wrote:
> ATTENTION: This e-mail is from an external sender. Please check attachments and links before opening e.g. with mouseover.
> 
> 
> On Wed May 24, 2023 at 6:58 AM EEST, Jarkko Sakkinen wrote:
>>>     rc = tpm_tis_read32(priv, TPM_INT_STATUS(priv->locality), &interrupt);
>>>     if (rc < 0)
>>> -           return IRQ_NONE;
>>> +           goto unhandled;
>>>
>>>     if (interrupt == 0)
>>> -           return IRQ_NONE;
>>> +           goto unhandled;
>>>
>>>     set_bit(TPM_TIS_IRQ_TESTED, &priv->flags);
>>>     if (interrupt & TPM_INTF_DATA_AVAIL_INT)
>>> @@ -780,10 +829,14 @@ static irqreturn_t tis_int_handler(int dummy, void *dev_id)
>>>     rc = tpm_tis_write32(priv, TPM_INT_STATUS(priv->locality), interrupt);
>>>     tpm_tis_relinquish_locality(chip, 0);
>>>     if (rc < 0)
>>> -           return IRQ_NONE;
>>> +           goto unhandled;
>>>
>>>     tpm_tis_read32(priv, TPM_INT_STATUS(priv->locality), &interrupt);
>>>     return IRQ_HANDLED;
>>> +
>>> +unhandled:
>>> +   tpm_tis_process_unhandled_interrupt(chip);
>>> +   return IRQ_HANDLED;
>>>  }
> 
> Some minor glitches I noticed.
> 
> You could simplify the flow by making the helper to return IRQ_NONE.
> 
> E.g.
> 
>         tpm_tis_relinquish_locality(chip, 0);
>         if (rc < 0)
>                 return tpm_tis_process_unhandled_interrupt(chip);

Agreed, this way we could spare a few lines in the interrupt handler (but note
that the implementation only returns IRQ_HANDLED never IRQ_NONE. This is to prevent
the generic irq code from doing its own interrupt storm handling before the TPM driver
had a chance to fall back to polling).

> 
> I'd recommend changing the function name simply tpm_tis_rollback_interrupt().

> Also tpm_tis_handle_irq_storm() is a pretty bad function name
> because handle also can mean anything. You are resetting to the
> polling mode, right?
> 
> So perhaps that could be e.g. tpm_tis_reenable_polling? I'm open
> for any other name but it really needs to give a hint what the
> function does.

tpm_tis_reenable_polling() sounds good to me.


Regards,
Lino



  reply	other threads:[~2023-05-26  0:37 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-22 14:31 [PATCH 1/2] tpm, tpm_tis: Handle interrupt storm Lino Sanfilippo
2023-05-22 14:31 ` [PATCH 2/2] tpm, tpm_tis: reuse code in disable_interrupts() Lino Sanfilippo
2023-05-22 22:45   ` Jerry Snitselaar
2023-05-23  7:08   ` Péter Ujfalusi
2023-05-23 19:07   ` Jarkko Sakkinen
2023-05-23 20:52     ` Lino Sanfilippo
2023-05-24  1:29       ` Jarkko Sakkinen
2023-05-22 22:44 ` [PATCH 1/2] tpm, tpm_tis: Handle interrupt storm Jerry Snitselaar
2023-05-23  6:48 ` Péter Ujfalusi
2023-05-23  7:07   ` Péter Ujfalusi
2023-05-23  7:44   ` Lukas Wunner
2023-05-23  9:14     ` Péter Ujfalusi
2023-05-23  9:20       ` Hans de Goede
2023-05-23  9:35       ` Péter Ujfalusi
2023-05-23 10:35         ` Lino Sanfilippo
2023-05-23 15:19         ` Lukas Wunner
2023-05-23 10:41       ` Lino Sanfilippo
2023-05-23 15:16       ` Lukas Wunner
2023-05-24  9:08         ` Hans de Goede
2023-05-29 10:44         ` Michael Niewöhner
2023-05-23 19:35   ` Jarkko Sakkinen
2023-05-23 18:53 ` Jarkko Sakkinen
2023-05-23 19:00   ` Jarkko Sakkinen
2023-05-23 19:46     ` Lukas Wunner
2023-05-24  1:44       ` Jarkko Sakkinen
2023-05-23 20:50     ` Lino Sanfilippo
2023-05-23 19:12   ` Jarkko Sakkinen
2023-05-23 22:32     ` Jerry Snitselaar
2023-05-24  1:21       ` Jarkko Sakkinen
2023-05-23 19:37   ` Lukas Wunner
2023-05-24  1:46     ` Jarkko Sakkinen
2023-05-23 20:46   ` Lino Sanfilippo
2023-05-29  6:46     ` Péter Ujfalusi
2023-05-29 13:15       ` Lino Sanfilippo
2023-06-06 16:42         ` Jarkko Sakkinen
2023-05-30 17:56       ` Jerry Snitselaar
2023-06-06 16:35         ` Jarkko Sakkinen
2023-06-06 16:45       ` Jarkko Sakkinen
2023-05-24  3:58 ` Jarkko Sakkinen
2023-05-24  3:59   ` Jarkko Sakkinen
2023-05-24  7:29   ` Lukas Wunner
2023-05-24 15:30   ` Jarkko Sakkinen
2023-05-26  0:37     ` Lino Sanfilippo [this message]
2023-05-30 10:31     ` Lino Sanfilippo
2023-05-25 23:45   ` Lino Sanfilippo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b2c597c1-e596-55d9-1c1d-aec36ec30744@kunbus.com \
    --to=l.sanfilippo@kunbus.com \
    --cc=LinoSanfilippo@gmx.de \
    --cc=hdegoede@redhat.com \
    --cc=jarkko@kernel.org \
    --cc=jgg@ziepe.ca \
    --cc=jsnitsel@redhat.com \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@mniewoehner.de \
    --cc=lkp@intel.com \
    --cc=lukas@wunner.de \
    --cc=oe-lkp@lists.linux.dev \
    --cc=p.rosenberger@kunbus.com \
    --cc=peter.ujfalusi@linux.intel.com \
    --cc=peterhuewe@gmx.de \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox