[PATCH v3 0/2] virt: tdx-guest: Fix and speed up the wait for a Quote
From: Moe Mahhouk via B4 Relay
Date: Sat Oct 24 2026 - 15:18:48 EST
Getting a TDX Quote takes at least one second, because
wait_for_quote_completion() sleeps a full second before each status
check, while a local Quote Generation Service answers in a few
milliseconds. Patch 2 polls with an exponential backoff instead.
In v1, Kiryl noticed that the same loop gets a real timeout wrong.
Patch 1 fixes that on its own, so that it can be backported; patch 2
then replaces the loop.
The GHCI SetupEventNotifyInterrupt mechanism would avoid polling
altogether, but it relies on the VMM implementing that service. This
series keeps the existing polling model, which works with any VMM.
Jun Miao posted a patch for the same latency in September [1]. It polls
every 2 ms with read_poll_timeout() and lowers the timeout to 1 s, and
has had no review so far. This series keeps the 30 s timeout and backs
off instead of polling at a fixed rate. Patch 1 is needed for released
kernels either way.
[1] https://lore.kernel.org/all/20260917102202.750895-1-jun.miao@xxxxxxxxx/
Testing on mainline a804c5742 in a TDX guest (KVM host v7.0, QEMU
11.1.2, TDX module 1.5.34, Intel QGS, guest HZ=250), through
configfs-tsm:
- Latency, 40 back-to-back Quotes: 1021-1024 ms each before, 6-12 ms
(median 8 ms) with the series. msleep_interruptible() rounds up to
jiffies; v1's usleep_range() got 2-3 ms.
- Timeout, with a QGS socket that accepts and never answers. QEMU fails
such a request itself after 30 s, so for this test getquote_timeout
was lowered to 5 s: without patch 1 the request fails with -EIO and
no message, with it -ETIMEDOUT and "GetQuote request timedout". With
the default 30 s and the old loop, QEMU's error lands in the last
sleep and is reported as -ETIMEDOUT, the second case in patch 1.
- SIGTERM to a reader waiting on such a request: it exits within one
10 ms tick of /proc/uptime with the series, as before it; with v1 it
took 110 ms.
- W=1 build of drivers/virt/coco/tdx-guest/ and checkpatch.pl --strict
are clean.
The patches and this cover letter were written with an AI coding
assistant, Claude (Claude Code, model Claude Opus 5.5), which also ran
the tests.
---
Changes in v3:
- Patch 1: Cc stable (Sathyanarayanan)
- Patch 2: say in the comment and the changelog that
msleep_interruptible() rounds up to whole jiffies, so at HZ=250 the
first steps are one tick each (Sathyanarayanan). No code change.
- Collected Reviewed-by tags (Kiryl, Sathyanarayanan)
- Link to v2: https://patch.msgid.link/20261022-tdx-guest-quote-poll-v2-0-7543c6eb2d36@xxxxxxxxxxxxx
Changes in v2:
- New patch 1: fix the timeout detection on its own, for backporting
(Kiryl)
- Patch 2: msleep_interruptible() with a 1-100 ms backoff instead of
usleep_range(), which sleeps uninterruptibly (Kiryl)
- Patch 2: secs_to_jiffies() for the deadline
- Test and tool notes moved from the changelog to this cover letter
(Kiryl)
- Link to v1: https://patch.msgid.link/20261021-tdx-guest-quote-poll-v1-1-919a87812ecb@xxxxxxxxxxxxx
---
Moe Mahhouk (2):
virt: tdx-guest: Fix timeout detection in wait_for_quote_completion()
virt: tdx-guest: Poll Quote status with exponential backoff
drivers/virt/coco/tdx-guest/tdx-guest.c | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
---
base-commit: 7be4bc52fd9e0e55dc9a2e0232b89427d2c4b614
change-id: 20261021-tdx-guest-quote-poll-0f7bfc59900b
Best regards,
--
Moe Mahhouk <moe@xxxxxxxxxxxxx>