https://bugzilla.kernel.org/show_bug.cgi?id=202231 Bug ID: 202231 Summary: Some KVM systems display bogus uptime with 4.19+ Product: Virtualization Version: unspecified Kernel Version: 4.19 Hardware: All OS: Linux Tree: Mainline Status: NEW Severity: normal Priority: P1 Component: kvm Assignee: virtualization_kvm@xxxxxxxxxxxxxxxxxxxx Reporter: nuxi@xxxxxxxxxxx Regression: No Some KVM systems (like my Linode) are displaying a bogus uptime value and the timestamps in dmesg are also off. I was unable to reproduce this on my laptop using a local copy of qemu/kvm or on a system running qemu/kvm via Proxmox. But I was able to reproduce it on a Cisco ASR9k router blade that happens to use qemu/kvm to run applications. I logged into the hypervisor on the Cisco router blade and was able to confirm my suspicions that the uptime being reported by the guest matched the time that the qemu process was started. Here is the dmesg and uptime from my Linode: $ uptime 10:35:51 up 176 days, 16:34, 1 user, load average: 0.00, 0.00, 0.00 $ dmesg | head -n 30 [ 0.000000] Linux version 4.19.0-1-amd64 (debian-kernel@xxxxxxxxxxxxxxxx) (gcc version 8.2.0 (Debian 8.2.0-13)) #1 SMP Debian 4.19.13-1 (2018-12-30) [ 0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-4.19.0-1-amd64 root=/dev/sda ro rootdelay=3 console=ttyS0,38400n8 UUID=15ec4d77-3bf2-4f27-bc21-3f648ccfa653 [ 0.000000] x86/fpu: Supporting XSAVE feature 0x001: 'x87 floating point registers' [ 0.000000] x86/fpu: Supporting XSAVE feature 0x002: 'SSE registers' [ 0.000000] x86/fpu: Supporting XSAVE feature 0x004: 'AVX registers' [ 0.000000] x86/fpu: xstate_offset[2]: 576, xstate_sizes[2]: 256 [ 0.000000] x86/fpu: Enabled xstate features 0x7, context size is 832 bytes, using 'standard' format. [ 0.000000] BIOS-provided physical RAM map: [ 0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009fbff] usable [ 0.000000] BIOS-e820: [mem 0x000000000009fc00-0x000000000009ffff] reserved [ 0.000000] BIOS-e820: [mem 0x00000000000f0000-0x00000000000fffff] reserved [ 0.000000] BIOS-e820: [mem 0x0000000000100000-0x000000007ffddfff] usable [ 0.000000] BIOS-e820: [mem 0x000000007ffde000-0x000000007fffffff] reserved [ 0.000000] BIOS-e820: [mem 0x00000000b0000000-0x00000000bfffffff] reserved [ 0.000000] BIOS-e820: [mem 0x00000000fed1c000-0x00000000fed1ffff] reserved [ 0.000000] BIOS-e820: [mem 0x00000000feffc000-0x00000000feffffff] reserved [ 0.000000] BIOS-e820: [mem 0x00000000fffc0000-0x00000000ffffffff] reserved [ 0.000000] NX (Execute Disable) protection: active [ 0.000000] SMBIOS 2.8 present. [ 0.000000] DMI: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.11.0-0-g63451fca13-prebuilt.qemu-project.org 04/01/2014 [ 0.000000] Hypervisor detected: KVM [ 0.000000] kvm-clock: Using msrs 4b564d01 and 4b564d00 [14248647.905533] kvm-clock: cpu 0, msr 43fd7001, primary cpu clock [14248647.905533] clocksource: kvm-clock: mask: 0xffffffffffffffff max_cycles: 0x1cd42e4dffb, max_idle_ns: 881590591483 ns [14248647.905536] tsc: Detected 2499.996 MHz processor [14248647.908138] e820: update [mem 0x00000000-0x00000fff] usable ==> reserved [14248647.908141] e820: remove [mem 0x000a0000-0x000fffff] usable [14248647.908145] last_pfn = 0x7ffde max_arch_pfn = 0x400000000 [14248647.908178] MTRR default type: write-back [14248647.908179] MTRR fixed ranges enabled: I've managed to bisect it to the following commit - https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=857baa87b6422bcfb84ed3631d6839920cb5b09d commit 857baa87b6422bcfb84ed3631d6839920cb5b09d Author: Pavel Tatashin <pasha.tatashin@xxxxxxxxxx> Date: Thu Jul 19 16:55:42 2018 -0400 sched/clock: Enable sched clock early Allow sched_clock() to be used before schec_clock_init() is called. This provides a way to get early boot timestamps on machines with unstable clocks. Signed-off-by: Pavel Tatashin <pasha.tatashin@xxxxxxxxxx> Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx> Link: https://lkml.kernel.org/r/20180719205545.16512-24-pasha.tatashin@xxxxxxxxxx init/main.c | 2 +- kernel/sched/clock.c | 20 +++++++++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) The issue still exists in 4.19.14, 4.20.1 and 5.0-rc1 Hypervisors that this appeared under: * Linode (not sure what they run on the hypervisors) * Cisco ASR9k router blade - QEMU 1.7 running kernel 2.6.34.10-131 Hyerpvisors this did not appear under: * Debian Sid - QEMU 3.1.0 (deb pkg 1:3.1+dfsg-2+b1) running kernel 4.19.13 (deb pkg 4.19.13-1) * Ubuntu 16.04.3 - QEMU 2.5.0 (ubuntu pkg 1:2.5+dfsg-5ubuntu10.16) running kernel 4.4.0 (ubuntu pkg 4.4.0-104-generic) * Proxmox 5.1 - QEMU 2.11.1 running kernel 4.13.16 * Proxmox 5.2 - QEMU 2.12.1 running kernel 4.15.18 -- You are receiving this mail because: You are watching the assignee of the bug.