Re: [RFC PATCH v3 08/15] sched/clock, x86: Make __sched_clock_stable forceful

From: Valentin Schneider
Date: Wed Nov 20 2024 - 11:35:06 EST


On 20/11/24 15:59, Peter Zijlstra wrote:
> On Tue, Nov 19, 2024 at 04:34:55PM +0100, Valentin Schneider wrote:
>> Later commits will cause objtool to warn about non __ro_after_init static
>> keys being used in .noinstr sections in order to safely defer instruction
>> patching IPIs targeted at NOHZ_FULL CPUs.
>>
>> __sched_clock_stable is used in .noinstr code, and can be modified at
>> runtime (e.g. KVM module loading). Suppressing the text_poke_sync() IPI has
>
> Wait, what !? loading KVM causes the TSC to be marked unstable?

Ah, maybe not, I saw the below but that's actually the x86 specific stuff
and IIUC can only be builtin:

kvm_init_platform()
`\
kvmclock_init()
`\
kvm_sched_clock_init()
`\
clear_sched_clock_stable()

There is however this:

kvm_arch_vcpu_load()
`\
mark_tsc_unstable()

So plugging a VCPU might do that.