Re: [PATCH v16 12/13] x86/tsc: Switch to native sched clock

Nikunj A. Dadhania
2025-01-09T06:32:27Z

On 1/8/2025 10:32 PM, Sean Christopherson wrote:
> On Wed, Jan 08, 2025, Borislav Petkov wrote:
>> On Wed, Jan 08, 2025 at 06:00:59AM -0800, Sean Christopherson wrote:

> For TDX guests, the TSC is _always_ "secure". So similar to singling out kvmclock,
> handling SNP's STSC but not the TDX case again leaves the kernel in an inconsistent
> state. Which is why I originally suggested[*] fixing the sched_clock mess in a
> generically;
> doing so would avoid the need to special case SNP or TDX in code> that doesn't/shouldn't care about SNP or TDX.

That is what I have attempted in this patch[1] where irrespective of SNP/TDX, whenever
TSC is picked up as a clock source, sched-clock will start using TSC instead of any
PV sched clock. This does not have any special case for STSC/SNP/TDX.

> [*] https://lore.kernel.org/all/ZurCbP7MesWXQbqZ@google.com

Regards
Nikunj

1. https://lore.kernel.org/kvm/20250106124633.1418972-13-nikunj@amd.com/