Bug 981287 - Adjusting host time then reboot the RHEL6.4 guest but the guest system time can not adjust accordingly
Adjusting host time then reboot the RHEL6.4 guest but the guest system time c...
Status: CLOSED NOTABUG
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: qemu-kvm (Show other bugs)
6.5
Unspecified Unspecified
medium Severity medium
: rc
: ---
Assigned To: Marcelo Tosatti
Virtualization Bugs
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-07-04 07:45 EDT by ShupingCui
Modified: 2013-08-05 17:57 EDT (History)
12 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-08-05 17:57:15 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description ShupingCui 2013-07-04 07:45:22 EDT
Description of problem:
rhel6 guest system time does not correct after reboot when adjusting host time

Version-Release number of selected component (if applicable):
host:
kernel-2.6.32-392.el6.x86_64
qemu-kvm-0.12.1.2-2.377.el6.x86_64
guest:
kernel-2.6.32-358.14.1.el6.x86_64


How reproducible:
100%


Steps to Reproduce:
1. in host, ntpdate clock.redhat.com and check time
# ntpdate clock.redhat.com
 4 Jul 19:21:41 ntpdate[7739]: adjust time server 10.5.26.10 offset 0.055313 sec

2. boot the guest with "-rtc base=utc,clock=host"
/usr/libexec/qemu-kvm \
    -name 'vm1' \
    -chardev socket,id=serial_id_serial1,path=/tmp/serial-serial1-20130702-093138-pSivbSG8,server,nowait \
    -device isa-serial,chardev=serial_id_serial1 \
    -drive file='/root/staf-kvm-devel/autotest-devel/client/tests/virt/shared/data/images/RHEL-Server-6.4-64-virtio.qcow2',if=none,id=drive-virtio-disk1,media=disk,cache=none,snapshot=off,format=qcow2,aio=native \
    -device virtio-blk-pci,bus=pci.0,addr=0x5,drive=drive-virtio-disk1 \
    -net none \
    -m 4096 \
    -smp 1,maxcpus=1,cores=1,threads=1,sockets=2 \
    -cpu 'Penryn' \
    -M rhel6.5.0 \
    -vnc :0 \
    -vga cirrus \
    -rtc base=utc,clock=host,driftfix=slew  \
    -boot order=cdn,once=c,menu=off   \
    -no-kvm-pit-reinjection \
    -enable-kvm \
    -monitor stdio

3. in guest check time
# date
Thu Jul  4 19:24:34 CST 2013
# hwclock
Thu 04 Jul 2013 07:24:38 PM CST  -0.433308 seconds
4. in host, adjust system time
# date -s 21:00:00
Thu Jul  4 21:00:00 CST 2013
5. reboot the guest and check time in guest

Actual results:
# date
Thu Jul  4 19:26:51 CST 2013
# hwclock
Thu 04 Jul 2013 07:26:55 PM CST  -0.365013 seconds
guest system time can not adjust time to host

Expected results:
guest time should be adjust with host


Additional info:
1 host cpuinfo
processor	: 1
vendor_id	: GenuineIntel
cpu family	: 6
model		: 23
model name	: Intel(R) Core(TM)2 Duo CPU     E8400  @ 3.00GHz
stepping	: 10
cpu MHz		: 2992.051
cache size	: 6144 KB
physical id	: 0
siblings	: 2
core id		: 1
cpu cores	: 2
apicid		: 1
initial apicid	: 1
fpu		: yes
fpu_exception	: yes
cpuid level	: 13
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm constant_tsc arch_perfmon pebs bts rep_good aperfmperf pni dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm sse4_1 xsave lahf_lm dts tpr_shadow vnmi flexpriority
bogomips	: 5984.10
clflush size	: 64
cache_alignment	: 64
address sizes	: 36 bits physical, 48 bits virtual
power management:

2. in guest
# cat /sys/devices/system/clocksource/clocksource0/current_clocksource
kvm-clock

3. i tried the following scenarios:
1). Sync the host time to ntp server
2). boot the guest with host system clockA
3). Adjust host time forward or backward by using "date -s" to system clockB
4). reboot guest
--Results--
+--------------------------+----------------------------------+
| RHEL6 boot with          | guest system and hardware clock  |
| -rtc base=utc,clock=host | not sync to host clockB          |
+--------------------------+----------------------------------+
| RHEL6 boot with          | guest system and hardware clock  |
| -rtc base=utc,clock=vm   | not sync to host clockB          |
+--------------------------+----------------------------------+
| RHEL7 boot with          | guest system and hardware clock  |
| -rtc base=utc,clock=host | sync to host clockB              |
+--------------------------+----------------------------------+
| RHEL7 boot with          | guest system and hardware clock  |
| -rtc base=utc,clock=vm   | not sync to host clockB          |
+--------------------------+----------------------------------+
Comment 2 Marcelo Tosatti 2013-08-05 17:57:15 EDT
ShupingCui,

This is the same issue as discussed here:

https://bugzilla.redhat.com/show_bug.cgi?id=978120

And the conclusion was: there is no known strong reason to have the emulated RTC 
be initialized from the host time on system reset.

Closing.

Note You need to log in before you can comment on or make changes to this bug.