Enabling KVM virtual PTP driver in GCE instances

1,014 views
Skip to first unread message

Shinhyung Yang

unread,
Apr 10, 2018, 9:33:28 AM4/10/18
to gce-dis...@googlegroups.com
Dear Cloud platform support team and community,

I'm trying to use the ptp_kvm module (the ``KVM virtual PTP driver'') to
synchronize my guest VM's clock to the host clock. This is described in
https://opensource.com/article/17/6/timekeeping-linux-vms under "Host-wide time
synchronization".

However, I'm unable to load the ptp_kvm module. My guest VM is running
CentOS 7.4.1708 with kernel 3.10.0-693.21.1.el7.x86_64:

[root@guestvm ~]# modinfo ptp_kvm
filename:
/lib/modules/3.10.0-693.21.1.el7.x86_64/kernel/drivers/ptp/ptp_kvm.ko.xz
license: GPL
description: PTP clock using KVMCLOCK
author: Marcelo Tosatti <mtos...@redhat.com>
retpoline: Y
rhelversion: 7.4
srcversion: A2A146848B24DA435A9360C
depends: ptp
intree: Y
vermagic: 3.10.0-693.21.1.el7.x86_64 SMP mod_unload modversions
signer: CentOS Linux kernel signing key
sig_key: 03:DA:60:92:F6:71:13:21:B5:AC:E1:2E:84:5D:A9:73:36:F7:67:4D
sig_hashalgo: sha256

[root@guestvm ~]# lsmod | grep ptp
ptp 19231 0
pps_core 19057 1 ptp

[root@guestvm ~]# modprobe ptp_kvm
modprobe: ERROR: could not insert 'ptp_kvm': No such device

[root@guestvm ~]# ls /dev/ptp*
ls: cannot access /dev/ptp*: No such file or directory


When I run a Centos 7.4 guest VM on my own Centos 7 host (own Cloud), the
ptp_kvm module loads and chrony uses kvm's ptp device for time synchronization.
The guest VM's clock is within 103 ns of the host clock (see the line
prefixed "#*
PHC0) below.

[root@internal3 ~]# chronyc sources -v
210 Number of sources = 4

.-- Source mode '^' = server, '=' = peer, '#' = local clock.
/ .- Source state '*' = current synced, '+' = combined , '-' = not combined,
| / '?' = unreachable, 'x' = time may be in error, '~' = time too variable.
|| .- xxxx [ yyyy ] +/- zzzz
|| Reachability register (octal) -. | xxxx = adjusted offset,
|| Log2(Polling interval) --. | | yyyy = measured offset,
|| \ | | zzzz = estimated error.
|| | | \
MS Name/IP address Stratum Poll Reach LastRx Last sample
===============================================================================
#* PHC0 0 3 377 9 +39ns[ +103ns] +/- 2ns
^- internal0 2 6 377 17 +378us[ +378us] +/- 26ms
^- internal1 2 6 377 8 -283us[ -283us] +/- 27ms
^- internal2 2 6 377 13 -222us[ -222us] +/- 27ms


Has anybody succeeded using the ptp_kvm module on the GCE?
Or is there any requirement that I missed?

Thank you!

With best regards,
Shinhyung Yang

Dinesh (Google Platform Support)

unread,
Apr 10, 2018, 5:28:51 PM4/10/18
to gce-discussion
Hello Shinhyung, 

Please verify operating system kernel configuration for KVM guest and clock requirement as described here[1]. You may also want to verify configuration steps for enabling nested virtualization on GCE as provided in these documentations[2][3].


[1]:https://cloud.google.com/compute/docs/images/building-custom-os#kernelrequired

Shinhyung Yang

unread,
Apr 14, 2018, 3:45:03 AM4/14/18
to gce-dis...@googlegroups.com
Dear Dinesh,

Could you confirm that the ptp_kvm module can be used to sync a guest
VM's clock to the clock of the host? Note that we're not talking about
nested virtualization. By "host", we're referring to the host OS on L0
(from the Compute Engine).

Thank you for your initial advice. We've built a custom kernel
configured according to reference [1]. Nevertheless, the ptp_kvm still
does not load. Please find the details in the attached file README.txt

Any information and help will be very much appreciated.

Thank you very much and best regards,
Shinhyung
> --
> © 2018 Google Inc. 1600 Amphitheatre Parkway, Mountain View, CA 94043
>
> Email preferences: You received this email because you signed up for the
> Google Compute Engine Discussion Google Group
> (gce-dis...@googlegroups.com) to participate in discussions with other
> members of the Google Compute Engine community and the Google Compute Engine
> Team.
> ---
> You received this message because you are subscribed to the Google Groups
> "gce-discussion" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to gce-discussio...@googlegroups.com.
> To post to this group, send email to gce-dis...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/gce-discussion/643b340d-3bff-4ef1-85c7-f5586a4b732c%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
README.txt

Dinesh (Google Platform Support)

unread,
Apr 16, 2018, 11:40:46 AM4/16/18
to gce-discussion
Hi Shinhyung,

Thanks for the feedback. Can you please confirm if you followed all the instructions/recommendations for nested virtualization in GCP which I shared previously? [1]

If that does not help, please let me know.  I will be checking this with the product engineering team. 

Please do share all other information which you think might be useful for this issue including additional logs, screenshots etc. 

> (gce-discussion@googlegroups.com) to participate in discussions with other
> members of the Google Compute Engine community and the Google Compute Engine
> Team.
> ---
> You received this message because you are subscribed to the Google Groups
> "gce-discussion" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to gce-discussion+unsubscribe@googlegroups.com.
> To post to this group, send email to gce-discussion@googlegroups.com.

Dinesh (Google Platform Support)

unread,
Apr 23, 2018, 9:44:01 AM4/23/18
to gce-discussion
Hi Shinhyung,

Thanks for sharing the information and your update via email. 
This issue has been forwarded to the product engineering team and they are working on it. However, I don't have any ETA on the fix and the implementation. 
I have created a public bug[1] for your tracking and update purpose. You may follow that public bug thread for the future updates. 

BR,
Dinesh

Reply all
Reply to author
Forward
0 new messages