]> git.karo-electronics.de Git - karo-tx-linux.git/commit
hv_utils: fix TimeSync work on pre-TimeSync-v4 hosts
authorVitaly Kuznetsov <vkuznets@redhat.com>
Thu, 18 May 2017 17:46:04 +0000 (10:46 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 25 May 2017 13:42:42 +0000 (15:42 +0200)
commit1d10602d306cb7f70545b5e1166efc9409e7d384
treea345216d6831c53d661b759688a84e81b383dd24
parent4f9bac039a64f6306b613a0d90e6b7e75d7ab0c4
hv_utils: fix TimeSync work on pre-TimeSync-v4 hosts

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: 3716a49a81ba ("hv_utils: implement Hyper-V PTP source")
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/hv/hv_util.c