• Radim Krčmář's avatar
    x86: kvmclock: abolish PVCLOCK_COUNTS_FROM_ZERO · 72c930dc
    Radim Krčmář authored
    Newer KVM won't be exposing PVCLOCK_COUNTS_FROM_ZERO anymore.
    The purpose of that flags was to start counting system time from 0 when
    the KVM clock has been initialized.
    We can achieve the same by selecting one read as the initial point.
    
    A simple subtraction will work unless the KVM clock count overflows
    earlier (has smaller width) than scheduler's cycle count.  We should be
    safe till x86_128.
    
    Because PVCLOCK_COUNTS_FROM_ZERO was enabled only on new hypervisors,
    setting sched clock as stable based on PVCLOCK_TSC_STABLE_BIT might
    regress on older ones.
    
    I presume we don't need to change kvm_clock_read instead of introducing
    kvm_sched_clock_read.  A problem could arise in case sched_clock is
    expected to return the same value as get_cycles, but we should have
    merged those clocks in that case.
    Signed-off-by: default avatarRadim Krčmář <rkrcmar@redhat.com>
    Acked-by: default avatarMarcelo Tosatti <mtosatti@redhat.com>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    72c930dc
kvmclock.c 8.17 KB