Re: [PATCH v6 06/11] x86/virt/tdx: Optimize tdx_pamt_get/put()

From: Edgecombe, Rick P

Date: Tue Jun 30 2026 - 21:46:35 EST


Oh! You already did some testing.

On Mon, 2026-06-08 at 17:50 +0800, Yan Zhao wrote:
> > How important is this patch? I see "Optimize" but I read "Optional".
> This patch reduces the number of global pamt_lock acquisitions.
>
> Reference testing data with/without the optimization:
> (collected on my SPR test machine)
>
> Booting/teardown of 1 TD (8 vcpus/8G memory) per iteration:
>                 |--------------|-------------|------------|
>                 |    avg (us)  |   max (us)  |   min (us) |
>                 |  w/o  |  w/  |  w/o  | w/  | w/o  |  w/ |
> ----------------|-------|------|-------|-----|------|-----|
> __tdx_pamt_get()|   2   |  0   |  578  | 505 |  2   |  0  |

^ it looks like the old version. Is this on a huge page stack? Or just plain
dynamic PAMT?

> __tdx_pamt_put()|   0   |  0   |  563  | 496 |  0   |  0  |
> ----------------|--------------|-------------|------------|
>
> Boot/teardown of 5 TDs (each TD: 8 vcpus/8G memory) concurrently:
>                 |--------------|-------------|------------|
>                 |    avg (us)  |   max (us)  |   min (us) |
>                 |  w/o  |  w/  |  w/o  | w/  | w/o  |  w/ |
> ----------------|-------|------|-------|-----|------|-----|
> __tdx_pamt_get()|  15   |  0   |  1723 | 1386|  2   |  0  |
> __tdx_pamt_put()|   0   |  0   |   562 |  733|  0   |  0  |
> ----------------|--------------|-------------|------------|


Did you record total time, or number of invocations that we could use to turn
this into some more real world impact?