On 2026-05-15 12:19 PM, Sean Christopherson wrote: > Prefer the TSC over kvmclock for sched_clock if the TSC is constant, > nonstop, and not marked unstable via command line. I.e. use the same > criteria as tweaking the clocksource rating so that TSC is preferred over > kvmclock. Per the below comment from native_sched_clock(), sched_clock > is more tolerant of slop than clocksource; using TSC for clocksource but > not sched_clock makes little to no sense, especially now that KVM CoCo > guests with a trusted TSC use TSC, not kvmclock. > > /* > * Fall back to jiffies if there's no TSC available: > * ( But note that we still use it if the TSC is marked > * unstable. We do this because unlike Time Of Day, > * the scheduler clock tolerates small errors and it's > * very important for it to be as fast as the platform > * can achieve it. ) > */ > > The only advantage of using kvmclock is that doing so allows for early > and common detection of PVCLOCK_GUEST_STOPPED, but that code has been > broken for over two years with nary a complaint, i.e. it can't be > _that_ valuable. And as above, certain types of KVM guests are losing > the functionality regardless, i.e. acknowledging PVCLOCK_GUEST_STOPPED > needs to be decoupled from sched_clock() no matter what. Has it been broken for two years because of pvclock_clocksource_read_nowd()? Thank you very much! Dongli Zhang
- [PATCH v3 36/41] x86/kvmclock: Get local APIC bus freq... Sean Christopherson
- Re: [PATCH v3 36/41] x86/kvmclock: Get local APIC... Woodhouse, David
- Re: [PATCH v3 36/41] x86/kvmclock: Get local ... Sean Christopherson
- [PATCH v3 31/41] x86/tsc: Pass KNOWN_FREQ and RELIABLE... Sean Christopherson
- Re: [PATCH v3 31/41] x86/tsc: Pass KNOWN_FREQ and... Woodhouse, David
- [PATCH v3 24/41] timekeeping: Resume clocksources befo... Sean Christopherson
- Re: [PATCH v3 24/41] timekeeping: Resume clocksou... David Woodhouse
- [PATCH v3 34/41] KVM: x86: Officially define CPUID 0x4... Sean Christopherson
- [PATCH v3 37/41] x86/kvmclock: Use TSC for sched_clock... Sean Christopherson
- Re: [PATCH v3 37/41] x86/kvmclock: Use TSC for sc... David Woodhouse
- Re: [PATCH v3 37/41] x86/kvmclock: Use TSC for sc... Dongli Zhang
- Re: [PATCH v3 37/41] x86/kvmclock: Use TSC fo... Sean Christopherson
- [PATCH v3 41/41] x86/kvmclock: Get CPU base frequency ... Sean Christopherson
- Re: [PATCH v3 41/41] x86/kvmclock: Get CPU base f... David Woodhouse
- Re: [PATCH v3 41/41] x86/kvmclock: Get CPU ba... Sean Christopherson
- [PATCH v3 38/41] x86/paravirt: kvmclock: Setup kvmcloc... Sean Christopherson
- Re: [PATCH v3 38/41] x86/paravirt: kvmclock: Setu... David Woodhouse
- [PATCH v3 39/41] x86/paravirt: Move using_native_sched... Sean Christopherson
- Re: [PATCH v3 39/41] x86/paravirt: Move using_nat... David Woodhouse
- [PATCH v3 40/41] x86/tsc: Add standalone helper for ge... Sean Christopherson
- Re: [PATCH v3 40/41] x86/tsc: Add standalone help... Paolo Bonzini

