[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 26/33] kvmclock: update system_time_msr address forci
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 26/33] kvmclock: update system_time_msr address forcibly |
Date: |
Thu, 1 Jun 2017 14:41:44 +0200 |
From: Denis Plotnikov <address@hidden>
Do an update of system_time_msr address every time before reading
the value of tsc_timestamp from guest's kvmclock page.
There is no other code paths which ensure that qemu has an up-to-date
value of system_time_msr. So, force this update on guest's tsc_timestamp
reading.
This bug causes effect on those nested setups which turn off TPR access
interception for L2 guests and that access being intercepted by L0 doesn't
show up in L1.
Linux bootstrap initiate kvmclock before APIC initializing causing TPR access.
That's why on L1 guests, having TPR interception turned on for L2, the effect
of the bug is not revealed.
This patch fixes this problem by making sure it knows the correct
system_time_msr address every time it is needed.
Signed-off-by: Denis Plotnikov <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
hw/i386/kvm/clock.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/hw/i386/kvm/clock.c b/hw/i386/kvm/clock.c
index 13eca37..363d1b5 100644
--- a/hw/i386/kvm/clock.c
+++ b/hw/i386/kvm/clock.c
@@ -19,6 +19,7 @@
#include "qemu/host-utils.h"
#include "sysemu/sysemu.h"
#include "sysemu/kvm.h"
+#include "sysemu/hw_accel.h"
#include "kvm_i386.h"
#include "hw/sysbus.h"
#include "hw/kvm/clock.h"
@@ -69,6 +70,8 @@ static uint64_t kvmclock_current_nsec(KVMClockState *s)
uint64_t nsec_hi;
uint64_t nsec;
+ cpu_synchronize_state(cpu);
+
if (!(env->system_time_msr & 1ULL)) {
/* KVM clock not active */
return 0;
--
1.8.3.1
- [Qemu-devel] [PULL 18/33] vhost-user-scsi: Introduce a vhost-user-scsi sample application, (continued)
- [Qemu-devel] [PULL 18/33] vhost-user-scsi: Introduce a vhost-user-scsi sample application, Paolo Bonzini, 2017/06/01
- [Qemu-devel] [PULL 21/33] i386: fix read/write cr with icount option, Paolo Bonzini, 2017/06/01
- [Qemu-devel] [PULL 20/33] target/i386: use multiple CPU AddressSpaces, Paolo Bonzini, 2017/06/01
- [Qemu-devel] [PULL 23/33] exec: fix address_space_get_iotlb_entry page mask, Paolo Bonzini, 2017/06/01
- [Qemu-devel] [PULL 24/33] nbd: Fully initialize client in case of failed negotiation, Paolo Bonzini, 2017/06/01
- [Qemu-devel] [PULL 22/33] sockets: improve error reporting if UNIX socket path is too long, Paolo Bonzini, 2017/06/01
- [Qemu-devel] [PULL 26/33] kvmclock: update system_time_msr address forcibly,
Paolo Bonzini <=
- [Qemu-devel] [PULL 25/33] qtest: add rtc periodic timer test, Paolo Bonzini, 2017/06/01
- [Qemu-devel] [PULL 27/33] linuxboot_dma: compile for i486, Paolo Bonzini, 2017/06/01
- [Qemu-devel] [PULL 28/33] edu: fix memory leak on msi_broken platforms, Paolo Bonzini, 2017/06/01
- [Qemu-devel] [PULL 30/33] target/i386: Add GDB XML description for SSE registers, Paolo Bonzini, 2017/06/01
- [Qemu-devel] [PULL 31/33] hw/core: nmi.c can be compiled as common-obj nowadays, Paolo Bonzini, 2017/06/01
- [Qemu-devel] [PULL 29/33] i386/kvm: do not zero out segment flags if segment is unusable or not present, Paolo Bonzini, 2017/06/01
- [Qemu-devel] [PULL 33/33] kvm: don't register smram_listener when smm is off, Paolo Bonzini, 2017/06/01
- [Qemu-devel] [PULL 32/33] nbd: make it thread-safe, fix qcow2 over nbd, Paolo Bonzini, 2017/06/01
- Re: [Qemu-devel] [PULL 00/33] Misc patches for 2017-06-01, no-reply, 2017/06/01
- Re: [Qemu-devel] [PULL 00/33] Misc patches for 2017-06-01, no-reply, 2017/06/01