All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ken Goldman <kgold@linux.ibm.com>
To: James Bottomley <James.Bottomley@HansenPartnership.com>,
	Nayna <nayna@linux.vnet.ibm.com>,
	Jarkko Sakkinen <jarkko@kernel.org>,
	Johannes Holland <johannes.holland@infineon.com>
Cc: Mimi Zohar <zohar@linux.ibm.com>,
	linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org,
	peterhuewe@gmx.de, jgg@ziepe.ca
Subject: Re: [PATCH] tpm: sleep at least <...> ms in tpm_msleep()
Date: Fri, 27 May 2022 17:37:40 -0400	[thread overview]
Message-ID: <63d645b0-4385-cd1a-6fab-6e17bf01f08b@linux.ibm.com> (raw)
In-Reply-To: <6df9f7af232bbe10a570e426c2bef0e673ab63fe.camel@HansenPartnership.com>

[-- Attachment #1: Type: text/plain, Size: 1494 bytes --]

On 5/18/2022 4:21 PM, James Bottomley wrote:
> Actually, this is nothing to do with the TIMEOUTS_A-D: those are the
> maximum times before a command should complete.  This is the minimum
> time we should wait between pokes of the TPM to see if it is ready.
> Usually the use case is:
> 
> while (read device status gives not ready)
>     tpm_msleep(something)
> 
> The tpm_msleep gives up CPU control (to prevent huge amounts of busy
> waiting) but before 424eaf910c32 ("tpm: reduce polling time to usecs
> for even finer granularity") we would sleep for an entire tick (time
> taken to make the process runnable) before the next poll, and since
> most TPM commands don't return immediately, that was a gate on how fast
> you could do simple TPM operations (like PCR extend).
> 
> As far as I know, no TCG spec gives any details of the minimum wait
> time between poll cycles, so this is really something the manufacturer
> has to tell us.
> 
> Just for completeness, my soak test did run to completion, but my TPM
> has since failed and dropped off the bus, so simply reverting this
> patch (5ef924d9e2e8) isn't sufficient to fully fix my problem.

[FYI]

The TPM vendors explained that polling interrupts TPM command
processing. This will make commands take longer.

They recommend adaptive sleep time based on (at least) the
command.  E.g., getcapability, pcrread, ... are fast so a short
sleep is appropriate.  create, createprimary are slow so
a longer sleep will have better performance.

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4490 bytes --]

  reply	other threads:[~2022-05-27 21:37 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-10 11:29 [PATCH] tpm: sleep at least <...> ms in tpm_msleep() Johannes Holland
2022-05-11 15:16 ` Jarkko Sakkinen
2022-05-12 12:21   ` Mimi Zohar
2022-05-12 12:32     ` James Bottomley
2022-05-12 16:52       ` Mimi Zohar
2022-05-16 17:57       ` Jarkko Sakkinen
2022-05-18 19:26         ` Nayna
2022-05-18 20:21           ` James Bottomley
2022-05-27 21:37             ` Ken Goldman [this message]
2022-05-16 17:54     ` Jarkko Sakkinen
2022-06-20 15:58       ` Stefan Mahnke-Hartmann
2022-05-11 20:12 ` James Bottomley

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=63d645b0-4385-cd1a-6fab-6e17bf01f08b@linux.ibm.com \
    --to=kgold@linux.ibm.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=jarkko@kernel.org \
    --cc=jgg@ziepe.ca \
    --cc=johannes.holland@infineon.com \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nayna@linux.vnet.ibm.com \
    --cc=peterhuewe@gmx.de \
    --cc=zohar@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.