From: Mimi Zohar <zohar@linux.vnet.ibm.com>
To: Alexander Steffen <Alexander.Steffen@infineon.com>,
jarkko.sakkinen@linux.intel.com, nayna@linux.vnet.ibm.com,
kgold@linux.vnet.ibm.com, linux-integrity@vger.kernel.org
Subject: Re: [RFC][PATCH 8/9] tpm_tis_spi: add delay between wait state retries
Date: Fri, 12 Jan 2018 09:53:15 -0500 [thread overview]
Message-ID: <1515768795.3420.111.camel@linux.vnet.ibm.com> (raw)
In-Reply-To: <db63c75f-464d-2fbc-3e97-ea3ef162cea5@infineon.com>
On Fri, 2018-01-12 at 09:28 +0100, Alexander Steffen wrote:
> On 11.01.2018 20:46, Mimi Zohar wrote:
> > Hi Alexander,
> >
> > On Fri, 2017-12-08 at 19:46 +0100, Alexander Steffen wrote:
> >> There do not seem to be any real limits one the amount/duration of wait
> >> states that the TPM is allowed to generate. So at least give the TPM some
> >> time to clean up the situation that caused the wait states instead of
> >> retrying the transfers as fast as possible.
> >
> > Without this patch, the TPM performance on the pi is amazing! A
> > thousand extends takes ~6.5 seconds. Unfortunately, the same thousand
> > extends with this patch takes > 2+ minutes. TPM_TIMEOUT (5 msecs) is
> > a really long time. Why so long?
>
> My problem is the lack of specification for the wait state
> functionality. How many wait states may be signaled by the TPM? For how
> long may the TPM signal wait states? Do you know any more details?
First, let me apologize for not thanking you for making these changes
in the first place. With just the burstcount patch, but without your
wait state patches, the pi doesn't boot. I now have a test
environment and can reproduce the problem. :)
With your wait state patches, but without this patch, the time is ~14
seconds per thousand extends, as opposed to the ~6.5 I reported above.
[The ~6.5 seconds is for already measured files. Files that have
already been measured are not re-measured, so the TPM is not extended
again. On other systems, "re-measuring" a 1000 files takes less than
1 sec. I'm not sure why it is taking so long on the pi.]
Without any sleeps, I'm seeing that when it goes into a wait state, it
mostly loops once, every so often 3 times, but printing the counter
introduces delays and probably skews the results. To get more
accurate results, would require aggregating the results and only
printing them after N number of extends. I'll try to get that
information for you next week.
> The current implementation is based on the assumption that wait states
> are the exception rather than the rule, so that longer delays are
> acceptable. And without knowing for how long wait states can happen, I
> chose rather longer delays (with this patch the TPM has several seconds
> to clear wait states) to avoid failing on some unknown TPM
> implementation in some special cases.
>
> What would be a better implementation? No delay and simply retry for
> five seconds?
Perhaps use TPM_POLL_SLEEP (1 msec), which Nayna introduced to sleep
within a max time loop. Instead of using the number of retries, which
is currently defined as 50, define a max end time. You could still
increment the timeout, but instead of "i * TPM_TIMEOUT) use "i *
TPM_POLL_SLEEP". Although usleep_range is a lot better than msleep(),
there is still some overhead. With tpm_msleep(), we don't have a way
of sleeping for less than 1 msec. Perhaps the first time, when "i ==
0", try again without sleeping.
> What TPMs are you using for your tests? At least for the TPMs that I
> have available for my tests (with a FIFO size of ~256 bytes) I would not
> expect any wait states for extend commands.
I'm also surprised. The TPM on the pi isn't on a real SPI bus. The
test is a tight loop, which forces N number of extends. The pi is at
work, but I'm working from home today. :( I'll have to get this info
next week.
Have you tried booting the pi with the "ima_tcb" boot command line
option? Do you have any performance results that you could share?
thanks,
Mimi
next prev parent reply other threads:[~2018-01-12 14:53 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-08 18:46 [RFC][PATCH 0/9] tpm: fix driver so that burstcount can be safely ignored Alexander Steffen
2017-12-08 18:46 ` [RFC][PATCH 1/9] tpm_tis_core: clean up whitespace Alexander Steffen
2018-01-18 17:11 ` Jarkko Sakkinen
2017-12-08 18:46 ` [RFC][PATCH 2/9] tpm_tis_core: access single TIS registers before doing complex transfers Alexander Steffen
2018-01-18 17:16 ` Jarkko Sakkinen
2017-12-08 18:46 ` [RFC][PATCH 3/9] tpm_tis_core: correctly wait for flags to become zero Alexander Steffen
2018-01-18 17:49 ` Jarkko Sakkinen
2018-01-18 17:58 ` Jarkko Sakkinen
2018-01-18 17:59 ` Jarkko Sakkinen
2017-12-08 18:46 ` [RFC][PATCH 4/9] tpm_tis_core: send all data in single operation Alexander Steffen
2017-12-19 9:01 ` Nayna Jain
2018-01-18 18:04 ` Jarkko Sakkinen
2017-12-08 18:46 ` [RFC][PATCH 5/9] tpm_tis_core: use XDATA_FIFO for transfers if available Alexander Steffen
2018-01-18 18:20 ` Jarkko Sakkinen
2017-12-08 18:46 ` [RFC][PATCH 6/9] tpm_tis_spi: fix sending wrong data during wait state handling Alexander Steffen
2018-01-18 18:26 ` Jarkko Sakkinen
2017-12-08 18:46 ` [RFC][PATCH 7/9] tpm_tis_spi: release CS line when wait state handling fails Alexander Steffen
2018-01-18 18:30 ` Jarkko Sakkinen
2017-12-08 18:46 ` [RFC][PATCH 8/9] tpm_tis_spi: add delay between wait state retries Alexander Steffen
2018-01-11 19:46 ` Mimi Zohar
2018-01-12 8:28 ` Alexander Steffen
2018-01-12 14:53 ` Mimi Zohar [this message]
2018-01-15 22:30 ` Mimi Zohar
2018-01-17 17:15 ` Mimi Zohar
2018-01-17 18:58 ` Alexander Steffen
2018-01-18 18:32 ` Jarkko Sakkinen
2017-12-08 18:46 ` [RFC][PATCH 9/9] tpm: ignore burstcount to improve tpm_tis send() performance Alexander Steffen
2017-12-15 12:04 ` [RFC][PATCH 0/9] tpm: fix driver so that burstcount can be safely ignored Jarkko Sakkinen
2017-12-24 20:41 ` Jarkko Sakkinen
2018-01-04 13:11 ` Alexander.Steffen
2018-01-05 6:46 ` Nayna Jain
2018-01-05 7:38 ` Alexander Steffen
2018-01-08 10:50 ` Jarkko Sakkinen
2018-01-08 10:49 ` Jarkko Sakkinen
2017-12-19 8:53 ` Nayna Jain
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=1515768795.3420.111.camel@linux.vnet.ibm.com \
--to=zohar@linux.vnet.ibm.com \
--cc=Alexander.Steffen@infineon.com \
--cc=jarkko.sakkinen@linux.intel.com \
--cc=kgold@linux.vnet.ibm.com \
--cc=linux-integrity@vger.kernel.org \
--cc=nayna@linux.vnet.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