Skip to content

Fix Cloud Hypervisor TSC synchronization causing clock skew in VMs #222

Description

@josharian

Author: skybrian2
Channel: #feedback
Link: https://discord.com/channels/1405685085923049482/1405686161791516873/1530767831233204245


Issue

Playwright tests are failing randomly on skybrian-links VM due to Chromium's network process crashing. Root cause analysis using Opus 5 determined that clock_gettime(CLOCK_MONOTONIC, &ts) is returning non-monotonic values.

Root Cause

The VM is using the TSC (Time Stamp Counter) as its time source. Cloud Hypervisor advertised CLOCKSOURCE_STABLE_BIT and invariant TSC, but did not actually synchronize the guest TSCs across vCPUs. When processes switch vCPUs under load, the clock jumps backwards by up to ~1.197 ms.

The kernel has a check to detect unstable TSC, but it appears to be disabled.

Workaround

Switching to kvm-clock resolves the issue, but only until the next reboot.

Additional Details

  • Affected VM: skybrian-links in pdx
  • VM uptime: 132 days at time of report
  • The clock skew may have developed over time as TSCs drifted apart
  • A minidump from the Chromium crash was obtained

Context

Confirmed by @josharian as a Cloud Hypervisor issue that should be fixed on our end.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions