Bug 978946 - guest adjust hardware time after adjusting host system time
guest adjust hardware time after adjusting host system time
Status: CLOSED NOTABUG
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: qemu-kvm (Show other bugs)
7.0
Unspecified Unspecified
medium Severity high
: rc
: ---
Assigned To: Marcelo Tosatti
Virtualization Bugs
: Reopened
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-06-27 06:55 EDT by ShupingCui
Modified: 2013-07-04 19:08 EDT (History)
11 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-07-01 17:15:17 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-06-27 06:55:38 EDT
Description of problem:
guest adjust hardware time after adjusting host system time

Version-Release number of selected component (if applicable):
host:
kernel-3.10.0-0.rc4.59.el7.x86_64
qemu-kvm-1.5.0-2.el7.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
# date
Thu Jun 27 18:45:22 CST 2013
2. boot the guest
/usr/libexec/qemu-kvm \
    -name 'vm1' \
    -device ich9-usb-uhci1,id=usb1,bus=pci.0,addr=0x4 \
    -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 2,maxcpus=2,cores=1,threads=1,sockets=2 \
    -cpu 'Nehalem' \
    -M pc \
    -device usb-tablet,id=usb-tablet1,bus=usb1.0,port=1 \
    -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 system time and hardware time
# date
Thu Jun 27 18:47:58 CST 2013
# hwclock
Thu 27 Jun 2013 06:47:59 PM CST  -0.947864 seconds
4. in host, set system time
# date -s 20:00:00
Thu Jun 27 20:00:00 CST 2013
5. check guest system time and hardware time
# date
Thu Jun 27 18:48:19 CST 2013
# hwclock
Thu 27 Jun 2013 08:00:08 PM CST  -0.141897 seconds


Actual results:
guest adjust hardware time

Expected results:
guest could not adjust hardware time

Additional info:
Comment 2 Marcelo Tosatti 2013-06-28 21:33:47 EDT
(In reply to ShupingCui from comment #0)
> Description of problem:
> guest adjust hardware time after adjusting host system time
> 
> Version-Release number of selected component (if applicable):
> host:
> kernel-3.10.0-0.rc4.59.el7.x86_64
> qemu-kvm-1.5.0-2.el7.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
> # date
> Thu Jun 27 18:45:22 CST 2013
> 2. boot the guest
> /usr/libexec/qemu-kvm \
>     -name 'vm1' \
>     -device ich9-usb-uhci1,id=usb1,bus=pci.0,addr=0x4 \
>     -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 2,maxcpus=2,cores=1,threads=1,sockets=2 \
>     -cpu 'Nehalem' \
>     -M pc \
>     -device usb-tablet,id=usb-tablet1,bus=usb1.0,port=1 \
>     -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 system time and hardware time
> # date
> Thu Jun 27 18:47:58 CST 2013
> # hwclock
> Thu 27 Jun 2013 06:47:59 PM CST  -0.947864 seconds

offset between guest system time and hwclock is zero.

> 4. in host, set system time
> # date -s 20:00:00
> Thu Jun 27 20:00:00 CST 2013
> 5. check guest system time and hardware time
> # date
> Thu Jun 27 18:48:19 CST 2013
> # hwclock
> Thu 27 Jun 2013 08:00:08 PM CST  -0.141897 seconds

Offset is 1h 12 minutes.

> Actual results:
> guest adjust hardware time

What is the problem, exactly ?
The offset between hwclock and guest system time is changed after
host system time is adjusted.

> Expected results:
> guest could not adjust hardware time
> 
> Additional info:
Comment 3 Marcelo Tosatti 2013-06-30 12:48:43 EDT

*** This bug has been marked as a duplicate of bug 978120 ***
Comment 6 Marcelo Tosatti 2013-07-01 17:15:17 EDT
(In reply to ShupingCui from comment #0)
> Description of problem:
> guest adjust hardware time after adjusting host system time
> 
> Version-Release number of selected component (if applicable):
> host:
> kernel-3.10.0-0.rc4.59.el7.x86_64
> qemu-kvm-1.5.0-2.el7.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
> # date
> Thu Jun 27 18:45:22 CST 2013
> 2. boot the guest
> /usr/libexec/qemu-kvm \
>     -name 'vm1' \
>     -device ich9-usb-uhci1,id=usb1,bus=pci.0,addr=0x4 \
>     -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 2,maxcpus=2,cores=1,threads=1,sockets=2 \
>     -cpu 'Nehalem' \
>     -M pc \
>     -device usb-tablet,id=usb-tablet1,bus=usb1.0,port=1 \
>     -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 system time and hardware time
> # date
> Thu Jun 27 18:47:58 CST 2013
> # hwclock
> Thu 27 Jun 2013 06:47:59 PM CST  -0.947864 seconds
> 4. in host, set system time
> # date -s 20:00:00
> Thu Jun 27 20:00:00 CST 2013
> 5. check guest system time and hardware time
> # date
> Thu Jun 27 18:48:19 CST 2013
> # hwclock
> Thu 27 Jun 2013 08:00:08 PM CST  -0.141897 seconds
> 
> 
> Actual results:
> guest adjust hardware time
> 
> Expected results:
> guest could not adjust hardware time
> 
> Additional info:

Specifying clock=host means that reads of the emulated RTC clock return value
from host system time.

"hwclock" in the guest reads the emulated RTC.

So hwclock reads the host system time. If you change the host system time, 
the value hwclock returns in the guest will change accordingly.

There is nothing wrong here, closing as NOTABUG (please reopen if i'm missing something).

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