Skip to content

Add hwclock sync loop to the guestagent #490

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

Merged
merged 2 commits into from
Jan 11, 2022

Conversation

mikluko
Copy link
Contributor

@mikluko mikluko commented Dec 21, 2021

Addresses #355

Running qemu guest agent alone doesn't solve the problem. With that approach, there must be an actor on the host side which catches wakeup events and executes RPC calls on the guest agent socket. As it stands, lima doesn't have any permanently running process to relay wake up events.

This PR offers different approach. It turns out that hardware clock device (/dev/rtc0) forwarded into a guest by QEMU always contains correct host time. The PR adds a loop into lima guest agent. That loop periodically checks the difference between hw clock time and system time. If the diff turns out to be over certain limit (hardcoded 5 seconds for now), the loop launches time sync from hw clock to system time.

@mikluko mikluko force-pushed the feature/hwclocksync branch from 1c74e71 to 5d4dc5e Compare December 21, 2021 16:08
jandubois
jandubois previously approved these changes Jan 8, 2022
Copy link
Member

@jandubois jandubois left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, and worked in my testing.

I do think the threshold should be lower, but that is more a gut feeling without supporting data.

@mikluko mikluko force-pushed the feature/hwclocksync branch from d3f6bb5 to dae7ddd Compare January 10, 2022 11:58
jandubois
jandubois previously approved these changes Jan 10, 2022
Copy link
Member

@jandubois jandubois left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, LGTM. Leaving for @AkihiroSuda to merge.

Copy link
Member

@AkihiroSuda AkihiroSuda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this "recursion"
#490 (comment)

@mikluko mikluko force-pushed the feature/hwclocksync branch from d9c9b09 to 9d2bb68 Compare January 11, 2022 09:41
@mikluko mikluko requested a review from AkihiroSuda January 11, 2022 09:43
Copy link
Member

@AkihiroSuda AkihiroSuda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request impact/changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants