KVMゲストOSの時間がずれてゆく

NTPで時刻同期しているのに...

アプリケーションによっては、正常に動作しなくなってしまう。

Mar 26 20:06:24 ns02 named[11141]: client 192.168.11.247#18856: view internal: request has invalid signature: TSIG channel-desp.com: tsig verify failure (BADTIME)

対策方法は、下記のところに書かれていた。
Documentation

CPU が不変タイムスタンプカウンタをもっていない場合、ゲストOSの時刻がずれると言っているみたいです。

環境

  • サーバ: HP Prolient ML115 G5
  • CPU: AMD Athlon(tm) Processor 1640B
  • Memory: 6GB
  • ホストOS: CentOS5.4
  • ゲストOS: 完全仮想化CentOS5.4(NICのみvirtio化)、完全仮想化Fedora12(HDD, NICをvirtio化)

※上記ゲストOSのうち、時刻ずれを起こすのは、CentOSの方で、Fedora12のほうは正常


下記の2文から、para-virtualized クロックを持っているとみなして、ホストOSのみ対策してみます。

  • KVM はゲストに para-virtualized クロックを装備することでこの問題を回避します。」
  • 「今のところ、Red Hat Enterprise Linux 5.4 及びそれ以降のゲストのみが全面的に para-virtualized のクロックをサポートしています。」

ホストOSのパワーマネージメント(省電力)機能の無効化

  • Kernelのdeep C状態(低消費電力状態)の防止[フルパワーモード]

grub.confのKernel行に「processor.max_cstate=1」を追記

$ sudo vim /etc/grub.conf
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.18-164.15.1.el5)
    root (hd0,0)
    kernel /vmlinuz-2.6.18-164.15.1.el5 ro root=/dev/ServiceVG00/rootLV00 rhgb quiet processor.max_cstate=1
    initrd /initrd-2.6.18-164.15.1.el5.img
title CentOS (2.6.18-164.11.1.el5)
    root (hd0,0)
    kernel /vmlinuz-2.6.18-164.11.1.el5 ro root=/dev/ServiceVG00/rootLV00 rhgb quiet
    initrd /initrd-2.6.18-164.11.1.el5.img
  • CPUクロック数の境界値の調査
$cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_available_frequencies
2700000 2600000 2400000 2200000 2000000 1800000 1000000
  • CPUクロック数の固定[MAX_SPEEDとMIN_SPEEDに最大値を指定]
$ sudo vim /etc/sysconfig/cpuspeed
:
 27 FREQUENCIES ###
 28 ### FREQUENCIES ###requencies for your cpu(s) can be found in
 29 # NOTE: valid max/min frequencies for your cpu(s) can be found in
 30 # /sys/devices/system/cpu/cpu*/cpufreq/scaling_available_frequencies
 31 # on systems that support frequency scaling.
 32 # maximum speed to scale up toported maximum)
 33 # default value: empty (use cpu reported maximum)
 34 MAX_SPEED=2700000
 35 # minimum speed to scale down torted minimum)
 36 # default value: empty (use cpu reported minimum)
 37 MIN_SPEED=2700000
 38 SCALING THRESHOLDS ###
 39 ### SCALING THRESHOLDS ###er which to scale up to max frequency
 40 # Busy percentage threshold over which to scale up to max frequency
 41 # default value: empty (use governor default)
  • サーバ再起動
$ sudo reboot