• J
    Revert "x86/tsc: Try to adjust TSC if sync test fails" · 1a33c395
    Jiufei Xue 提交于
    This reverts commit cc4db268.
    
    When we do hot-add and enable vCPU, the time inside the VM jumps and
    then VM stucks.
    The dmesg shows like this:
    [   48.402948] CPU2 has been hot-added
    [   48.413774] smpboot: Booting Node 0 Processor 2 APIC 0x2
    [   48.415155] kvm-clock: cpu 2, msr 6b615081, secondary cpu clock
    [   48.453690] TSC ADJUST compensate: CPU2 observed 139318776350 warp.  Adjust: 139318776350
    [  102.060874] clocksource: timekeeping watchdog on CPU0: Marking clocksource 'tsc' as unstable because the skew is too large:
    [  102.060874] clocksource:                       'kvm-clock' wd_now: 1cb1cfc4bf8 wd_last: 1be9588f1fe mask: ffffffffffffffff
    [  102.060874] clocksource:                       'tsc' cs_now: 207d794f7e cs_last: 205a32697a mask: ffffffffffffffff
    [  102.060874] tsc: Marking TSC unstable due to clocksource watchdog
    [  102.070188] KVM setup async PF for cpu 2
    [  102.071461] kvm-stealtime: cpu 2, msr 13ba95000
    [  102.074530] Will online and init hotplugged CPU: 2
    
    This is because the TSC for the newly added VCPU is initialized to 0
    while others are ahead. Guest will do the TSC ADJUST compensate and
    cause the time jumps.
    
    Commit bd8fab39("KVM: x86: fix maintaining of kvm_clock stability
    on guest CPU hotplug") can fix this problem.  However, the host kernel
    version may be older, so do not ajust TSC if sync test fails, just mark
    it unstable.
    Signed-off-by: NJiufei Xue <jiufei.xue@linux.alibaba.com>
    Reviewed-by: NJoseph Qi <joseph.qi@linux.alibaba.com>
    1a33c395
tsc_sync.c 11.0 KB