lkml.org 
[lkml]   [2022]   [May]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] tpm: sleep at least <...> ms in tpm_msleep()
From
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.
[unhandled content-type:application/pkcs7-signature]
\
 
 \ /
  Last update: 2022-05-27 23:38    [W:4.591 / U:0.812 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site