On Wed, Jan 08, 2025, Borislav Petkov wrote: > On Wed, Jan 08, 2025 at 06:00:59AM -0800, Sean Christopherson wrote: > > Ideally, if the TSC is the preferred clocksource, then the scheduler will use the > > TSC and not a PV clock irrespective of STSC. But I 100% agree with Boris that > > it needs buy-in from other maintainers (including Paolo), because it's entirely > > possible (likely, even) that there's an angle to scheduling I'm not considering. > > That's exactly why I wanted to have this taken care of only for the STSC side > of things now and temporarily. So that we can finally land those STSC patches > - they've been pending for waaay too long. > > And then ask Nikunj nicely to clean up this whole pv clock gunk, potentially > kill some of those old clocksources which probably don't matter anymore. > > But your call how/when you wanna do this. I'm okay starting with just TDX and SNP guests, but I don't want to special case SNP's Secure TSC anywhere in kvmclock or common TSC/sched code. 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. [*] https://lore.kernel.org/all/ZurCbP7MesWXQbqZ@xxxxxxxxxx > If you want the cleanup first, I'll take only a subset of the STSC set so that > I can unload some of that set upstream. My vote is to apply through "x86/sev: Mark Secure TSC as reliable clocksource", and then split "x86/tsc: Switch Secure TSC guests away from kvm-clock" to grab only the snp_secure_tsc_init() related changes (which is how that patch should be constructed no matter what; adding support for MSR_AMD64_GUEST_TSC_FREQ has nothing to do with kvmclock). And then figure out how to wrangle clocksource and sched_clock in a way that is sane and consistent.