Re: [RFC PATCH 03/21] x86/virt/tdx: Add SEAMCALL wrapper tdh_mem_page_demote()
From: Edgecombe, Rick P
Date: Tue Jul 01 2025 - 17:15:55 EST
On Thu, 2025-05-15 at 10:28 -0700, Rick Edgecombe wrote:
> > I did a brief test on my SPR, where the host was not busy :
> > tdh_mem_page_demote() was called 142 times, with each invocation taking
> > around
> > 10us.
>
> 10us doesn't seem too bad? Makes me think to not loop and instead just do a
> single retry with interrupts disabled. We should definitely add the data based
> reasoning to the log.
>
> The counter point is that the SEAMCALL must be supporting
> TDX_INTERRUPTED_RESTARTABLE for a reason. And the reason probably is that it
> sometimes takes longer than someone that was reasonable. Maybe we should ask
> TDX
> module folks if there is any history.
Circling back here. After some research/discussion it seems demote should not
take too long such that it should need the option to return
TDX_INTERRUPTED_RESTARTABLE. Even in the dynamic PAMT case. The details of how
to get this changed and documented are still ongoing, but for v2 I say we close
this by expecting it to never return TDX_INTERRUPTED_RESTARTABLE. For now it can
be a VM_BUG_ON() case, with the expectation that TDX module will update to make
the logic valid. Sound good?