public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jonathan McDowell <noodles@earth.li>
To: Stefan Berger <stefanb@linux.ibm.com>
Cc: linux-integrity@vger.kernel.org,
	Jarkko Sakkinen <jarkko@kernel.org>,
	James Bottomley <James.Bottomley@hansenpartnership.com>,
	Peter Huewe <peterhuewe@gmx.de>, Jason Gunthorpe <jgg@ziepe.ca>,
	linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH] tpm: Workaround failed command reception on Infineon devices
Date: Fri, 4 Oct 2024 15:47:27 +0100	[thread overview]
Message-ID: <Zv___74cyROxZSic@earth.li> (raw)
In-Reply-To: <979629af-e224-4308-a9a1-c66a60003d2d@linux.ibm.com>

On Thu, Oct 03, 2024 at 06:25:14PM -0400, Stefan Berger wrote:
> On 10/3/24 5:59 PM, Stefan Berger wrote:
> > On 10/2/24 1:04 PM, Jonathan McDowell wrote:
> > > (I'm still in the process of testing this to confirm it fixes the
> > > errata I've seen, but I wanted to send it out for comments to make sure
> > > it's a reasonable approach.)
> > > 
> > > Some Infineon devices have a issue where the status register will get
> > > stuck with a quick REQUEST_USE / COMMAND_READY sequence. The work around
> > 
> > Did you tell Infineon about it? Maybe they should have a look at their
> > firmware.

I'm in contact with Infineon, and have their errata under NDA.

> > What are the TPMs in your fleet doing? I heared that some TPMs
> > pre-create keys in the background once users requested a few. I would
> > try to create a few primary keys with different combination of key flags
> 
> Actually make this child keys of primary keys:
> 
> > tsscreateprimary
> Handle 80000000
> > while :; do time tsscreate -hp 80000000 -si  -opem pubkey.pem ; cat
> pubkey.pem; done
> 
> This should give a different key every time and maybe key creation time goes
> up at some point...

We're doing a TPM2_CC_CREATE, but as part of a "seal" operation for some
data, rather than full asymmetric key creation. So I don't think this is
likely to be the cause, but it's given me the idea to see if we are
seeing a spike on a particular command - maybe there's something that's
close to the edge on timings that is occasionally going over. Playing
around with bpftrace seems to give useful data so I'll need to
investigate if I can deploy that to do some monitoring.

Our monitoring is running hourly and does the following TPM2
operations (including the in kernel context switching):

TPM2_CC_SELF_TEST
TPM2_CC_GET_CAPABILITY
TPM2_CC_READ_PUBLIC
TPM2_CC_READ_PUBLIC
TPM2_CC_CREATE
TPM2_CC_LOAD
TPM2_CC_CONTEXT_SAVE
TPM2_CC_FLUSH_CONTEXT
TPM2_CC_CONTEXT_LOAD
TPM2_CC_UNSEAL
TPM2_CC_CONTEXT_SAVE
TPM2_CC_FLUSH_CONTEXT
TPM2_CC_CONTEXT_LOAD
TPM2_CC_FLUSH_CONTEXT
TPM2_CC_CONTEXT_SAVE
TPM2_CC_READ_CLOCK
TPM2_CC_GET_CAPABILITY
TPM2_CC_GET_CAPABILITY
TPM2_CC_GET_CAPABILITY
TPM2_CC_GET_CAPABILITY
TPM2_CC_GET_CAPABILITY
TPM2_CC_GET_CAPABILITY
TPM2_CC_READ_PUBLIC

J.

-- 
If I, um, err. Yeah, it probably rounds down. -- Simon Huggins

  reply	other threads:[~2024-10-04 14:47 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-02 17:03 Problems with TPM timeouts Jonathan McDowell
2024-10-02 17:04 ` [RFC PATCH] tpm: Workaround failed command reception on Infineon devices Jonathan McDowell
2024-10-03 21:59   ` Stefan Berger
2024-10-03 22:25     ` Stefan Berger
2024-10-04 14:47       ` Jonathan McDowell [this message]
2024-10-02 17:31 ` Problems with TPM timeouts James Bottomley
2024-10-02 19:26   ` Jonathan McDowell

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=Zv___74cyROxZSic@earth.li \
    --to=noodles@earth.li \
    --cc=James.Bottomley@hansenpartnership.com \
    --cc=jarkko@kernel.org \
    --cc=jgg@ziepe.ca \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterhuewe@gmx.de \
    --cc=stefanb@linux.ibm.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