Repository navigation
qemu: a TPM command completes inside the start write within 1 ms (0013) - #915
Merged
Merged
Conversation
The START write hands the command to the thread pool as before and waits up to 1 ms, BQL held, for the worker; a short command is done when the guest first reads START, and a slow one or a TPM that does not answer completes on the main loop as before. qemu/Dockerfile's qtest check holds both. The budget entry is written before the run. Part of #860 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The first login −13.3 [−19.9, −6.7] (lab 47234042415, 60 a side), the restored login within noise (lab 47234045520). The ledger with the TPM kprobes: 23 of a boot's 326 commands sleep in tpm_transmit instead of all of them (lab 47234050891). Closes #860 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Running every TPM command inside tpm-crb's START write took −30.4 ms off the first login, and was rejected because it holds the BQL for swtpm's whole time (#851, lever 3). This keeps most commands inside the write, and holds the BQL for 1 ms at most (#860).
What changes
qemu/patches/0013.qemu/Dockerfilegains a qtest check for both halves:docs/boot-time.md. There is a carried record, a log entry, and 0013's row inqemu/README.md.Measured
Bench, spin's shape, 2026-12-03. Both arms run
main's kernel and differ only in QEMU:main's from parts run 47231873254, and 0013's from parts run 47231867269.tpm_transmit, of 326 (ledger, lab 47234050891, 5 a side)tpm_transmita bootThe commands that still slept were the boot's first, before the pool had a worker, and those swtpm took longer than 1 ms to answer (up to 2.2 ms). No command on the login's path took over 20 ms.
The gain is under the unbounded version's −30.4 ms. That number was measured with an older shirudo, on a 1236 ms login where today's is 915 ms. The two versions weren't run side by side.
The ledger ran from a one-off branch:
mainplus245984e, which adds the TPM kprobes and is marked not for main. I deleted the branch after the run.Prior art
I found no bounded or polled completion of a TPM command in qemu-devel, QEMU's GitLab or swtpm's issues. Cloud Hypervisor's synchronous version has the opposite problem: when swtpm takes over 100 ms, the guest's TPM fails for good (cloud-hypervisor/cloud-hypervisor#9053, still open).
Closes #860
🤖 Generated with Claude Code