Re: [PATCH] x86/tdx: Mark TSC reliable

From: Dave Hansen
Date: Tue Aug 08 2023 - 14:11:11 EST


On 8/8/23 09:23, Kirill A. Shutemov wrote:
...
> On the other hand, other clock sources (such as HPET, ACPI timer,
> APIC, etc.) necessitate VM exits to implement, resulting in more
> fluctuating measurements compared to TSC. Thus, those clock sources
> are not effective for calibrating TSC.

Do we need to do anything to _those_ to mark them as slightly stinky?

> In TD guests, TSC is virtualized by the TDX module, which ensures:
>
> - Virtual TSC values are consistent among all the TD’s VCPUs;
> - Monotonously incrementing for any single VCPU;
> - The frequency is determined by TD configuration. The host TSC is
> invariant on platforms where TDX is available.

I take it this is carved in stone in the TDX specs somewhere. A
reference would be nice.

We've got VMWare and Hyper-V code basically doing the same thing today.
So TDX is in kinda good company. But this still makes me rather
nervous. Do you have any encouraging words about how unlikely future
hardware is to screw this up, especially as TDX-supporting hardware gets
more diverse?