Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
System clock running extremely slow on virtual server
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
z0ny
Tux's lil' helper
Tux's lil' helper


Joined: 19 Mar 2005
Posts: 102
Location: Germany

PostPosted: Sun Jan 28, 2018 8:35 am    Post subject: System clock running extremely slow on virtual server Reply with quote

Hello, some time ago the hoster of my virtual server installed the meltdown/spectre patches. Since then I have problems with the system clock - it is running extremely slow when the system is idle:

Code:
# hwclock;date
2018-01-28 09:03:54.867991+0100
So 28. Jan 08:57:52 CET 2018

... 30s delay stopped with stop watch ...

# hwclock;date
2018-01-28 09:04:24.943997+0100
So 28. Jan 08:58:00 CET 2018


As you can see 30 seconds real time (and hardware clock) are 8 seconds system time. However if I create CPU load in parallel the clock seems to be ok:

Code:
# echo "scale=30000; a(1)*4" | bc -l


Code:
# hwclock;date
2018-01-28 09:16:00.643979+0100
So 28. Jan 09:11:19 CET 2018

... 30s delay stopped with stop watch ...

# hwclock;date
2018-01-28 09:16:31.007938+0100
So 28. Jan 09:11:50 CET 2018


My system is up-to-date, the kernel is =sys-kernel/vanilla-sources-4.14.13. Is there any kernel or system configuration which could cause this? According to my hoster other machines have no issues...

Code:
# cat /proc/cpuinfo
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 15
model           : 6
model name      : Common KVM processor
stepping        : 1
microcode       : 0x1
cpu MHz         : 3499.993
cache size      : 4096 KB
fpu             : yes
fpu_exception   : yes
cpuid level     : 5
wp              : yes
flags           : fpu de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 syscall nx lm constant_tsc nopl cpuid pni cx16 x2apic hypervisor lahf_lm cpuid_fault pti
bugs            : cpu_meltdown
bogomips        : 6999.98
clflush size    : 64
cache_alignment : 128
address sizes   : 40 bits physical, 48 bits virtual
power management:

_________________
Old C programmers never die. They're just cast into void.
Back to top
View user's profile Send private message
z0ny
Tux's lil' helper
Tux's lil' helper


Joined: 19 Mar 2005
Posts: 102
Location: Germany

PostPosted: Mon Jan 29, 2018 8:56 pm    Post subject: Reply with quote

Seems like the problem was that the kernel switched its clock source from tsc to refined-jiffies as it detected tsc as unstable, see dmesg output:

Code:
[  336.909357] clocksource: timekeeping watchdog on CPU0: Marking clocksource 'tsc' as unstable because the skew is too large:
[  336.909360] clocksource:                       'refined-jiffies' wd_now: 100002368 wd_last: 1000022f0 mask: ffffffff
[  336.909361] clocksource:                       'tsc' cs_now: 7195937fa0d cs_last: 718e7b91e32 mask: ffffffffffffffff
[  336.909365] tsc: Marking TSC unstable due to clocksource watchdog
[  336.909371] sched_clock: Marking unstable (336910980783, -1339836)<-(337001946858, -92577852)
[  336.909667] clocksource: Switched to clocksource refined-jiffies


After doing some research I found a post by Thomas Gleixner saying that it makes no sense to watchdog the TSC in a virtualized environment. So I disabled TSC monitoring by adding the following kernel parameters:

Code:
clocksource=tsc tsc=reliable


Timing behaviour is much better up to now. I'll keep watching this...
_________________
Old C programmers never die. They're just cast into void.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum