From: "Jarkko Sakkinen" <jarkko@kernel.org>
To: "Pengyu Ma" <mapengyu@gmail.com>
Cc: <linux-integrity@vger.kernel.org>,
<James.Bottomley@hansenpartnership.com>,
<roberto.sassu@huawei.com>, "Peter Huewe" <peterhuewe@gmx.de>,
"Jason Gunthorpe" <jgg@ziepe.ca>,
"open list" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 0/4] tpm: lazy flush for the session null key
Date: Mon, 16 Sep 2024 08:16:04 +0300 [thread overview]
Message-ID: <D47GBS5ZGNPC.3IRSGEBQGJURI@kernel.org> (raw)
In-Reply-To: <CALSz7m1WG7fZ9UuO0URgCZEDG7r_wB4Ev_4mOHJThH_d1Ed1nw@mail.gmail.com>
On Mon Sep 16, 2024 at 5:33 AM EEST, Pengyu Ma wrote:
> After applied your patches, the boot time is ~15 seconds.
> Less than 20 sec, but still much more than 7 sec when disabling HMAC.
Great, and thank you for testing this. I did expect it to fully address
the issue but it is on the direct path. It took me few days to get my
testing environment right before moving forward [1], mainly to get
bpftrace included, thus the delay.
Do you mind if I add tested-by for the for this one?
Before the patch set the in-kernel TPM sequences were along the lines
of:
1. Load the null key.
2. Load the auth session.
3. Do stuff with overhead from encryption.
4. Save the session.
5. Save the null key.
With the changes:
1. Load the session.
2. Do stuff with overhead from encryption.
3. Save the session.
Each swapped session gets an increasing count. If the count grows over
treshold measured by the difference of the count in the latest loaded
session and the session currently being saved, then TPM throws out
a context gap error. It has a limited resolution for this.
As long as /dev/tpm0 is not opened by any process, there is only one
session open (or at least fixed pre-determined number moving forward).
This means that context gap error cannot occur, as the only session
saved is the auth session.
I'll implement a patch on top of this, which does exactly this: track
the number of open /dev/tpm{rm0}. Only when the device is open, the
auth session is flushed.
With this change the sequence reduces to:
1. Do stuff with overhead from encryption.
Since the results are promising (thanks to you), I create a new version
of this patch set with this additional fix. There's no chance to reach
the same exact boot-up time as without encryption but I think we might
be able to reach a reasonable cost.
[1] https://codeberg.org/jarkko/linux-tpmdd-test
BR, Jarkko
next prev parent reply other threads:[~2024-09-16 5:16 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-15 18:04 [PATCH 0/4] tpm: lazy flush for the session null key Jarkko Sakkinen
2024-09-15 18:04 ` [PATCH 1/4] tpm: remove file header documentation from tpm2-sessions.c Jarkko Sakkinen
2024-09-15 18:04 ` [PATCH 2/4] tpm: address tpm2_create_null_primary() return value Jarkko Sakkinen
2024-09-15 18:04 ` [PATCH 3/4] tpm: address tpm2_create_primary() failure Jarkko Sakkinen
2024-09-15 18:04 ` [PATCH 4/4] tpm: flush the session null key only when required Jarkko Sakkinen
2024-09-15 18:12 ` [PATCH 0/4] tpm: lazy flush for the session null key Jarkko Sakkinen
[not found] ` <CALSz7m0ehXM+dU3z0xYPLQkHbyfyMjoCOoMLdBgRcUu1pnT_ww@mail.gmail.com>
2024-09-16 2:33 ` Pengyu Ma
2024-09-16 5:16 ` Jarkko Sakkinen [this message]
2024-09-16 5:53 ` Pengyu Ma
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=D47GBS5ZGNPC.3IRSGEBQGJURI@kernel.org \
--to=jarkko@kernel.org \
--cc=James.Bottomley@hansenpartnership.com \
--cc=jgg@ziepe.ca \
--cc=linux-integrity@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mapengyu@gmail.com \
--cc=peterhuewe@gmx.de \
--cc=roberto.sassu@huawei.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