From: Jarkko Sakkinen <jarkko@kernel.org>
To: Breno Leitao <leitao@debian.org>,
Stefan Mahnke-Hartmann <stefan.mahnke-hartmann@infineon.com>
Cc: Peter Huewe <peterhuewe@gmx.de>, Jason Gunthorpe <jgg@ziepe.ca>,
Jonathan Corbet <corbet@lwn.net>,
Shuah Khan <skhan@linuxfoundation.org>,
Randy Dunlap <rdunlap@infradead.org>,
linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org,
surenkj@amazon.com, noodles@meta.com, linux-doc@vger.kernel.org,
kernel-team@meta.com
Subject: Re: [PATCH v3 1/2] tpm: Disable a TPM that stops responding
Date: Fri, 13 Nov 2026 17:40:08 +0200 [thread overview]
Message-ID: <avcvWJMidN7p0LUM@kernel.org> (raw)
In-Reply-To: <avconeIiDzMIq40n@gmail.com>
On Fri, Nov 13, 2026 at 07:14:39AM -0800, Breno Leitao wrote:
> On Fri, Nov 13, 2026 at 04:42:20PM +0200, Jarkko Sakkinen wrote:
> > On Fri, Nov 13, 2026 at 02:38:58AM -0800, Breno Leitao wrote:
> > > @@ -40,6 +40,11 @@ module_param_named(suspend_pcr, tpm_suspend_pcr, uint, 0644);
> > > MODULE_PARM_DESC(suspend_pcr,
> > > "PCR to use for dummy writes to facilitate flush on suspend.");
> > >
> > > +static unsigned int tpm_max_missed_responses = 60;
> >
> > This looks good but I started to think this number. I guess it is high
> > because there's never reset-to-zero for chip->nr_missed_responses.
> >
> > I think three or four trials at most should be enough, and when there
> > is a successful transmission chip->nr_missed_responses should reset.
>
> It does reset. Any command that gets an answer, whatever its return
> code, sets the count back to zero:
>
> if (ret >= 0) {
> chip->nr_missed_responses = 0;
>
> so the TPM is only disabled after 60 timeouts with no answer in between.
Oops, sorry had a blind spot.
This made me thinking that it is unlikely that there would be a sequence
of -ETIME's and then things started suddenly working. It is not a likely
world scenario.
So really TPM_CHIP_FLAG_MISSED_RESPONSE could be the counter: it is set
when -ETIME happens, allowing a single -ETIME failure but not a sequence
of them.
Sorry, this simply did not cross mind earlier.
Second open question: do we want to disable or move into firmware
upgrade mode?
Stefan, could you review this patch set from this angle? I don't feel
I have enough expertise on this topic.
> Some TPMs stop responding at runtime, hours to months after they
> passed probe. The first sign is usually "invalid TPM_STS.x 0xff",
> and from then on every command fails only after the transport
> timeout. A TPM that is already dead at boot fails tpm2_probe() and
> never registers, which is not affected by this patchset/feature.
This is much better. It is as accurate as possible, which is good
enough.
>
> Thanks,
> --breno
Br, Jarkko
next prev parent reply other threads:[~2026-11-13 15:40 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-13 10:38 [PATCH v3 0/2] tpm: Stop retrying TPMs that have stopped working Breno Leitao
2026-11-13 10:38 ` [PATCH v3 1/2] tpm: Disable a TPM that stops responding Breno Leitao
2026-11-13 14:42 ` Jarkko Sakkinen
2026-11-13 15:14 ` Breno Leitao
2026-11-13 15:40 ` Jarkko Sakkinen [this message]
2026-11-13 10:38 ` [PATCH v3 2/2] tpm: Disable TPM on TPM_RC_INITIALIZE Breno Leitao
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=avcvWJMidN7p0LUM@kernel.org \
--to=jarkko@kernel.org \
--cc=corbet@lwn.net \
--cc=jgg@ziepe.ca \
--cc=kernel-team@meta.com \
--cc=leitao@debian.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-integrity@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=noodles@meta.com \
--cc=peterhuewe@gmx.de \
--cc=rdunlap@infradead.org \
--cc=skhan@linuxfoundation.org \
--cc=stefan.mahnke-hartmann@infineon.com \
--cc=surenkj@amazon.com \
/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