• Vitaly Kuznetsov's avatar
    hv_utils: fix TimeSync work on pre-TimeSync-v4 hosts · 1d10602d
    Vitaly Kuznetsov authored
    It was found that ICTIMESYNCFLAG_SYNC packets are handled incorrectly
    on WS2012R2, e.g. after the guest is paused and resumed its time is set
    to something different from host's time. The problem is that we call
    adj_guesttime() with reftime=0 for these old hosts and we don't account
    for that in 'if (adj_flags & ICTIMESYNCFLAG_SYNC)' branch and
    hv_set_host_time().
    
    While we could've solved this by adding a check like
    'if (ts_srv_version > TS_VERSION_3)' to hv_set_host_time() I prefer
    to do some refactoring. We don't need to have two separate containers
    for host samples, struct host_ts which we use for PTP is enough.
    
    Throw away 'struct adj_time_work' and create hv_get_adj_host_time()
    accessor to host_ts to avoid code duplication.
    
    Fixes: 3716a49a ("hv_utils: implement Hyper-V PTP source")
    Signed-off-by: default avatarVitaly Kuznetsov <vkuznets@redhat.com>
    Signed-off-by: default avatarK. Y. Srinivasan <kys@microsoft.com>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    1d10602d
hv_util.c 14 KB