Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clock drift issues #110

Closed
copumpkin opened this issue Mar 27, 2017 · 10 comments
Closed

Clock drift issues #110

copumpkin opened this issue Mar 27, 2017 · 10 comments

Comments

@copumpkin
Copy link

copumpkin commented Mar 27, 2017

See machyve/xhyve#46 and docker/for-mac#17 (and dozens of other confused threads all over the net, mostly stemming from Docker for Mac) for more details. I think this is the right place to address the issue, though.

See also LnL7/nix-docker#7 which links other related threads together.

@copumpkin
Copy link
Author

It's not currently clear to me if anything needs to be done on the hyperkit side of things or whether this is entirely up to the VM guests to correct.

@rn
Copy link
Member

rn commented Mar 27, 2017

The macOS hypervisor framework does not provide sufficient information to emulate one of the standard (ie included in Linux) PV clocks so the guest needs to run it's own NTP client and sync the time, ideally to the host time in case the host is not fully in sync. Things get more complex on resume from suspend, where sometimes it may take time for the guest time to resynch with the host/other NTP servers. On Docker for Mac we recently also discovered that the NTP client we use in the Linux VM sometimes sometime looses connection with the NTP server on the host, cause time drift.

Long story short, this is not really a HyperKit issue, so I'm closing it. docker/for-mac is the best place to raise issues regarding time sync issues on Docker for Mac.

@rn rn closed this as completed Mar 27, 2017
@copumpkin
Copy link
Author

@rneugeba ah, but minikube also uses HyperKit in a very similar manner to Docker for Mac and suffers from very similar time issues, which made me think that the issue could be solved more centrally. I guess we'll just need them to update their image to be more eager about ntp then?

@copumpkin
Copy link
Author

@rneugeba also curious, are the Hypervisor.framework shortcomings documented somewhere? Talking about the thing you said about not being able to create a PV-like interface.

@rn
Copy link
Member

rn commented Mar 27, 2017

You can create a PV-clock interface but it this would require additions to the Linux kernel. The limitation is that we can't emulate any of the existing PV clock interfaces for which the Linux kernel already has support

@copumpkin
Copy link
Author

Oh, I see, thanks. If I want to read more, is there a good resource on this sort of stuff with respect to Hypervisor.framework?

@ijc
Copy link
Collaborator

ijc commented Mar 28, 2017

@copumpkin there is not a lot of documentation for Hypervisor.framework. There is some in the relevant MacOS header files and in general the interface exposes much of the underlying VMX hardware interface fairly directly so you can infer a bunch of stuff from the Intel SDM.

The specific issue with implementing one of the existing Linux pvclock interfaces is that upon resume the MacOS kernel appears (this bit is completely undocumented AFAWCT) to apply an offset to the TSC (the hardware timer, which is virtualised via VMX) but does not expose that offset back to the userspace part of the hypervisor (which sees the unvirtualised/unoffset host level TSC only), therefore we cannot correctly calculate the correction factors which form part of the pvclock protocols.

@copumpkin
Copy link
Author

Thank you, very helpful!

@avsm
Copy link
Collaborator

avsm commented Mar 28, 2017

@ijc25 I think I'll file an Apple Radar bug about this as well. Do we have any issues showing an example of this behaviour so I can include it in the report?

@ijc
Copy link
Collaborator

ijc commented Mar 28, 2017

@avsm It's in the internal tracker issue 1700. 229 is also interesting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants