* [Qemu-devel] [PATCH 0/6] [GIT PULL] qemu-kvm.git uq/master queue
@ 2010-02-03 23:55 Marcelo Tosatti
2010-02-03 23:55 ` [Qemu-devel] [PATCH 1/6] kvm: Flush coalesced MMIO buffer periodly Marcelo Tosatti
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: Marcelo Tosatti @ 2010-02-03 23:55 UTC (permalink / raw)
To: Anthony Liguori; +Cc: Marcelo Tosatti, qemu-devel, kvm
The following changes since commit 117f8eb81dfdf51a0418fbf6d260cbb72bcd4a9d:
Markus Armbruster (1):
qdev: Add rudimentary help for property value
are available in the git repository at:
git://git.kernel.org/pub/scm/virt/kvm/qemu-kvm.git uq/master
Jan Kiszka (4):
KVM: Request setting of nmi_pending and sipi_vector
KVM: x86: Fix up misreported CPU features
KVM: Make vmport KVM-compatible
KVM: Move and rename regs_modified
Marcelo Tosatti (1):
Fix incoming migration with iothread
Sheng Yang (1):
kvm: Flush coalesced MMIO buffer periodly
cpu-all.h | 2 ++
cpu-defs.h | 3 ++-
exec.c | 6 ++++++
hw/vmport.c | 3 +++
kvm-all.c | 36 +++++++++++++++++++++---------------
kvm.h | 1 +
target-i386/kvm.c | 11 ++++++++++-
vl.c | 4 ++++
8 files changed, 49 insertions(+), 17 deletions(-)
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Qemu-devel] [PATCH 1/6] kvm: Flush coalesced MMIO buffer periodly
2010-02-03 23:55 [Qemu-devel] [PATCH 0/6] [GIT PULL] qemu-kvm.git uq/master queue Marcelo Tosatti
@ 2010-02-03 23:55 ` Marcelo Tosatti
2010-02-03 23:55 ` [Qemu-devel] [PATCH 2/6] KVM: Request setting of nmi_pending and sipi_vector Marcelo Tosatti
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Marcelo Tosatti @ 2010-02-03 23:55 UTC (permalink / raw)
To: Anthony Liguori; +Cc: Marcelo Tosatti, qemu-devel, kvm, Sheng Yang
From: Sheng Yang <sheng@linux.intel.com>
The default action of coalesced MMIO is, cache the writing in buffer, until:
1. The buffer is full.
2. Or the exit to QEmu due to other reasons.
But this would result in a very late writing in some condition.
1. The each time write to MMIO content is small.
2. The writing interval is big.
3. No need for input or accessing other devices frequently.
This issue was observed in a experimental embbed system. The test image
simply print "test" every 1 seconds. The output in QEmu meets expectation,
but the output in KVM is delayed for seconds.
Per Avi's suggestion, I hooked flushing coalesced MMIO buffer in VGA update
handler. By this way, We don't need vcpu explicit exit to QEmu to
handle this issue.
Signed-off-by: Sheng Yang <sheng@linux.intel.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
---
cpu-all.h | 2 ++
exec.c | 6 ++++++
kvm-all.c | 23 +++++++++++++++--------
kvm.h | 1 +
vl.c | 2 ++
5 files changed, 26 insertions(+), 8 deletions(-)
diff --git a/cpu-all.h b/cpu-all.h
index 57b69f8..1ccc9a8 100644
--- a/cpu-all.h
+++ b/cpu-all.h
@@ -915,6 +915,8 @@ void qemu_register_coalesced_mmio(target_phys_addr_t addr, ram_addr_t size);
void qemu_unregister_coalesced_mmio(target_phys_addr_t addr, ram_addr_t size);
+void qemu_flush_coalesced_mmio_buffer(void);
+
/*******************************************/
/* host CPU ticks (if available) */
diff --git a/exec.c b/exec.c
index 76831a1..67fabae 100644
--- a/exec.c
+++ b/exec.c
@@ -2406,6 +2406,12 @@ void qemu_unregister_coalesced_mmio(target_phys_addr_t addr, ram_addr_t size)
kvm_uncoalesce_mmio_region(addr, size);
}
+void qemu_flush_coalesced_mmio_buffer(void)
+{
+ if (kvm_enabled())
+ kvm_flush_coalesced_mmio_buffer();
+}
+
ram_addr_t qemu_ram_alloc(ram_addr_t size)
{
RAMBlock *new_block;
diff --git a/kvm-all.c b/kvm-all.c
index 15ec38e..f8350c9 100644
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -59,6 +59,9 @@ struct KVMState
int vmfd;
int regs_modified;
int coalesced_mmio;
+#ifdef KVM_CAP_COALESCED_MMIO
+ struct kvm_coalesced_mmio_ring *coalesced_mmio_ring;
+#endif
int broken_set_mem_region;
int migration_log;
int vcpu_events;
@@ -200,6 +203,12 @@ int kvm_init_vcpu(CPUState *env)
goto err;
}
+#ifdef KVM_CAP_COALESCED_MMIO
+ if (s->coalesced_mmio && !s->coalesced_mmio_ring)
+ s->coalesced_mmio_ring = (void *) env->kvm_run +
+ s->coalesced_mmio * PAGE_SIZE;
+#endif
+
ret = kvm_arch_init_vcpu(env);
if (ret == 0) {
qemu_register_reset(kvm_reset_vcpu, env);
@@ -466,10 +475,10 @@ int kvm_init(int smp_cpus)
goto err;
}
+ s->coalesced_mmio = 0;
#ifdef KVM_CAP_COALESCED_MMIO
s->coalesced_mmio = kvm_check_extension(s, KVM_CAP_COALESCED_MMIO);
-#else
- s->coalesced_mmio = 0;
+ s->coalesced_mmio_ring = NULL;
#endif
s->broken_set_mem_region = 1;
@@ -544,14 +553,12 @@ static int kvm_handle_io(uint16_t port, void *data, int direction, int size,
return 1;
}
-static void kvm_run_coalesced_mmio(CPUState *env, struct kvm_run *run)
+void kvm_flush_coalesced_mmio_buffer(void)
{
#ifdef KVM_CAP_COALESCED_MMIO
KVMState *s = kvm_state;
- if (s->coalesced_mmio) {
- struct kvm_coalesced_mmio_ring *ring;
-
- ring = (void *)run + (s->coalesced_mmio * TARGET_PAGE_SIZE);
+ if (s->coalesced_mmio_ring) {
+ struct kvm_coalesced_mmio_ring *ring = s->coalesced_mmio_ring;
while (ring->first != ring->last) {
struct kvm_coalesced_mmio *ent;
@@ -609,7 +616,7 @@ int kvm_cpu_exec(CPUState *env)
abort();
}
- kvm_run_coalesced_mmio(env, run);
+ kvm_flush_coalesced_mmio_buffer();
ret = 0; /* exit loop */
switch (run->exit_reason) {
diff --git a/kvm.h b/kvm.h
index 1c93ac5..59cba18 100644
--- a/kvm.h
+++ b/kvm.h
@@ -53,6 +53,7 @@ void kvm_setup_guest_memory(void *start, size_t size);
int kvm_coalesce_mmio_region(target_phys_addr_t start, ram_addr_t size);
int kvm_uncoalesce_mmio_region(target_phys_addr_t start, ram_addr_t size);
+void kvm_flush_coalesced_mmio_buffer(void);
int kvm_insert_breakpoint(CPUState *current_env, target_ulong addr,
target_ulong len, int type);
diff --git a/vl.c b/vl.c
index 39833fc..50f133d 100644
--- a/vl.c
+++ b/vl.c
@@ -2996,6 +2996,7 @@ static void gui_update(void *opaque)
DisplayState *ds = opaque;
DisplayChangeListener *dcl = ds->listeners;
+ qemu_flush_coalesced_mmio_buffer();
dpy_refresh(ds);
while (dcl != NULL) {
@@ -3011,6 +3012,7 @@ static void nographic_update(void *opaque)
{
uint64_t interval = GUI_REFRESH_INTERVAL;
+ qemu_flush_coalesced_mmio_buffer();
qemu_mod_timer(nographic_timer, interval + qemu_get_clock(rt_clock));
}
--
1.6.6
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [Qemu-devel] [PATCH 2/6] KVM: Request setting of nmi_pending and sipi_vector
2010-02-03 23:55 [Qemu-devel] [PATCH 0/6] [GIT PULL] qemu-kvm.git uq/master queue Marcelo Tosatti
2010-02-03 23:55 ` [Qemu-devel] [PATCH 1/6] kvm: Flush coalesced MMIO buffer periodly Marcelo Tosatti
@ 2010-02-03 23:55 ` Marcelo Tosatti
2010-02-03 23:55 ` [Qemu-devel] [PATCH 3/6] KVM: x86: Fix up misreported CPU features Marcelo Tosatti
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Marcelo Tosatti @ 2010-02-03 23:55 UTC (permalink / raw)
To: Anthony Liguori; +Cc: Jan Kiszka, Marcelo Tosatti, qemu-devel, kvm
From: Jan Kiszka <jan.kiszka@siemens.com>
The final version of VCPU events in 2.6.33 will allow to skip
nmi_pending and sipi_vector on KVM_SET_VCPU_EVENTS. For now let's write
them unconditionally, which is unproblematic for upstream due to missing
SMP support. Future version which enable SMP will write them only on
reset.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
---
target-i386/kvm.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/target-i386/kvm.c b/target-i386/kvm.c
index 5b093ce..b457b96 100644
--- a/target-i386/kvm.c
+++ b/target-i386/kvm.c
@@ -794,6 +794,9 @@ static int kvm_put_vcpu_events(CPUState *env)
events.sipi_vector = env->sipi_vector;
+ events.flags =
+ KVM_VCPUEVENT_VALID_NMI_PENDING | KVM_VCPUEVENT_VALID_SIPI_VECTOR;
+
return kvm_vcpu_ioctl(env, KVM_SET_VCPU_EVENTS, &events);
#else
return 0;
--
1.6.6
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [Qemu-devel] [PATCH 3/6] KVM: x86: Fix up misreported CPU features
2010-02-03 23:55 [Qemu-devel] [PATCH 0/6] [GIT PULL] qemu-kvm.git uq/master queue Marcelo Tosatti
2010-02-03 23:55 ` [Qemu-devel] [PATCH 1/6] kvm: Flush coalesced MMIO buffer periodly Marcelo Tosatti
2010-02-03 23:55 ` [Qemu-devel] [PATCH 2/6] KVM: Request setting of nmi_pending and sipi_vector Marcelo Tosatti
@ 2010-02-03 23:55 ` Marcelo Tosatti
2010-02-03 23:55 ` [Qemu-devel] [PATCH 4/6] KVM: Make vmport KVM-compatible Marcelo Tosatti
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Marcelo Tosatti @ 2010-02-03 23:55 UTC (permalink / raw)
To: Anthony Liguori; +Cc: Jan Kiszka, qemu-devel, kvm
From: Jan Kiszka <jan.kiszka@siemens.com>
>From qemu-kvm: Kernels before 2.6.30 misreported some essential CPU
features via KVM_GET_SUPPORTED_CPUID. Fix them up.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
target-i386/kvm.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/target-i386/kvm.c b/target-i386/kvm.c
index b457b96..0d08cd5 100644
--- a/target-i386/kvm.c
+++ b/target-i386/kvm.c
@@ -99,12 +99,18 @@ uint32_t kvm_arch_get_supported_cpuid(CPUState *env, uint32_t function, int reg)
break;
case R_EDX:
ret = cpuid->entries[i].edx;
- if (function == 0x80000001) {
+ switch (function) {
+ case 1:
+ /* KVM before 2.6.30 misreports the following features */
+ ret |= CPUID_MTRR | CPUID_PAT | CPUID_MCE | CPUID_MCA;
+ break;
+ case 0x80000001:
/* On Intel, kvm returns cpuid according to the Intel spec,
* so add missing bits according to the AMD spec:
*/
cpuid_1_edx = kvm_arch_get_supported_cpuid(env, 1, R_EDX);
ret |= cpuid_1_edx & 0xdfeff7ff;
+ break;
}
break;
}
--
1.6.6
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [Qemu-devel] [PATCH 4/6] KVM: Make vmport KVM-compatible
2010-02-03 23:55 [Qemu-devel] [PATCH 0/6] [GIT PULL] qemu-kvm.git uq/master queue Marcelo Tosatti
` (2 preceding siblings ...)
2010-02-03 23:55 ` [Qemu-devel] [PATCH 3/6] KVM: x86: Fix up misreported CPU features Marcelo Tosatti
@ 2010-02-03 23:55 ` Marcelo Tosatti
2010-02-03 23:55 ` [Qemu-devel] [PATCH 5/6] KVM: Move and rename regs_modified Marcelo Tosatti
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Marcelo Tosatti @ 2010-02-03 23:55 UTC (permalink / raw)
To: Anthony Liguori; +Cc: Jan Kiszka, qemu-devel, kvm
From: Jan Kiszka <jan.kiszka@siemens.com>
The vmport "device" accesses the VCPU registers, so it requires proper
cpu_synchronize_state. Add it to vmport_ioport_read, which also
synchronizes vmport_ioport_write.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
hw/vmport.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/hw/vmport.c b/hw/vmport.c
index 884af3f..6c9d7c9 100644
--- a/hw/vmport.c
+++ b/hw/vmport.c
@@ -25,6 +25,7 @@
#include "isa.h"
#include "pc.h"
#include "sysemu.h"
+#include "kvm.h"
//#define VMPORT_DEBUG
@@ -58,6 +59,8 @@ static uint32_t vmport_ioport_read(void *opaque, uint32_t addr)
unsigned char command;
uint32_t eax;
+ cpu_synchronize_state(env);
+
eax = env->regs[R_EAX];
if (eax != VMPORT_MAGIC)
return eax;
--
1.6.6
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [Qemu-devel] [PATCH 5/6] KVM: Move and rename regs_modified
2010-02-03 23:55 [Qemu-devel] [PATCH 0/6] [GIT PULL] qemu-kvm.git uq/master queue Marcelo Tosatti
` (3 preceding siblings ...)
2010-02-03 23:55 ` [Qemu-devel] [PATCH 4/6] KVM: Make vmport KVM-compatible Marcelo Tosatti
@ 2010-02-03 23:55 ` Marcelo Tosatti
2010-02-03 23:55 ` [Qemu-devel] [PATCH 6/6] Fix incoming migration with iothread Marcelo Tosatti
2010-02-08 16:44 ` [Qemu-devel] Re: [PATCH 0/6] [GIT PULL] qemu-kvm.git uq/master queue Anthony Liguori
6 siblings, 0 replies; 8+ messages in thread
From: Marcelo Tosatti @ 2010-02-03 23:55 UTC (permalink / raw)
To: Anthony Liguori; +Cc: Jan Kiszka, qemu-devel, kvm
From: Jan Kiszka <jan.kiszka@siemens.com>
Touching the user space representation of KVM's VCPU state is -
naturally - a per-VCPU thing. So move the dirty flag into KVM_CPU_COMMON
and rename it at this chance to reflect its true meaning.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
cpu-defs.h | 3 ++-
kvm-all.c | 13 ++++++-------
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/cpu-defs.h b/cpu-defs.h
index 95068b5..7fdbe97 100644
--- a/cpu-defs.h
+++ b/cpu-defs.h
@@ -197,6 +197,7 @@ typedef struct CPUWatchpoint {
const char *cpu_model_str; \
struct KVMState *kvm_state; \
struct kvm_run *kvm_run; \
- int kvm_fd;
+ int kvm_fd; \
+ int kvm_vcpu_dirty;
#endif
diff --git a/kvm-all.c b/kvm-all.c
index f8350c9..6c0fd37 100644
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -57,7 +57,6 @@ struct KVMState
KVMSlot slots[32];
int fd;
int vmfd;
- int regs_modified;
int coalesced_mmio;
#ifdef KVM_CAP_COALESCED_MMIO
struct kvm_coalesced_mmio_ring *coalesced_mmio_ring;
@@ -574,9 +573,9 @@ void kvm_flush_coalesced_mmio_buffer(void)
void kvm_cpu_synchronize_state(CPUState *env)
{
- if (!env->kvm_state->regs_modified) {
+ if (!env->kvm_vcpu_dirty) {
kvm_arch_get_registers(env);
- env->kvm_state->regs_modified = 1;
+ env->kvm_vcpu_dirty = 1;
}
}
@@ -594,9 +593,9 @@ int kvm_cpu_exec(CPUState *env)
break;
}
- if (env->kvm_state->regs_modified) {
+ if (env->kvm_vcpu_dirty) {
kvm_arch_put_registers(env);
- env->kvm_state->regs_modified = 0;
+ env->kvm_vcpu_dirty = 0;
}
kvm_arch_pre_run(env, run);
@@ -946,9 +945,9 @@ static void kvm_invoke_set_guest_debug(void *data)
struct kvm_set_guest_debug_data *dbg_data = data;
CPUState *env = dbg_data->env;
- if (env->kvm_state->regs_modified) {
+ if (env->kvm_vcpu_dirty) {
kvm_arch_put_registers(env);
- env->kvm_state->regs_modified = 0;
+ env->kvm_vcpu_dirty = 0;
}
dbg_data->err = kvm_vcpu_ioctl(env, KVM_SET_GUEST_DEBUG, &dbg_data->dbg);
}
--
1.6.6
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [Qemu-devel] [PATCH 6/6] Fix incoming migration with iothread
2010-02-03 23:55 [Qemu-devel] [PATCH 0/6] [GIT PULL] qemu-kvm.git uq/master queue Marcelo Tosatti
` (4 preceding siblings ...)
2010-02-03 23:55 ` [Qemu-devel] [PATCH 5/6] KVM: Move and rename regs_modified Marcelo Tosatti
@ 2010-02-03 23:55 ` Marcelo Tosatti
2010-02-08 16:44 ` [Qemu-devel] Re: [PATCH 0/6] [GIT PULL] qemu-kvm.git uq/master queue Anthony Liguori
6 siblings, 0 replies; 8+ messages in thread
From: Marcelo Tosatti @ 2010-02-03 23:55 UTC (permalink / raw)
To: Anthony Liguori; +Cc: Marcelo Tosatti, qemu-devel, kvm
Do not allow the vcpus to execute if the vm is stopped.
Fixes -incoming with CONFIG_IOTHREAD enabled.
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
---
vl.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/vl.c b/vl.c
index 50f133d..57f0ba5 100644
--- a/vl.c
+++ b/vl.c
@@ -3282,6 +3282,8 @@ static int cpu_can_run(CPUState *env)
return 0;
if (env->stopped)
return 0;
+ if (!vm_running)
+ return 0;
return 1;
}
--
1.6.6
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [Qemu-devel] Re: [PATCH 0/6] [GIT PULL] qemu-kvm.git uq/master queue
2010-02-03 23:55 [Qemu-devel] [PATCH 0/6] [GIT PULL] qemu-kvm.git uq/master queue Marcelo Tosatti
` (5 preceding siblings ...)
2010-02-03 23:55 ` [Qemu-devel] [PATCH 6/6] Fix incoming migration with iothread Marcelo Tosatti
@ 2010-02-08 16:44 ` Anthony Liguori
6 siblings, 0 replies; 8+ messages in thread
From: Anthony Liguori @ 2010-02-08 16:44 UTC (permalink / raw)
To: Marcelo Tosatti; +Cc: Anthony Liguori, qemu-devel, kvm
On 02/03/2010 05:55 PM, Marcelo Tosatti wrote:
> The following changes since commit 117f8eb81dfdf51a0418fbf6d260cbb72bcd4a9d:
> Markus Armbruster (1):
> qdev: Add rudimentary help for property value
>
> are available in the git repository at:
>
> git://git.kernel.org/pub/scm/virt/kvm/qemu-kvm.git uq/master
>
> Jan Kiszka (4):
> KVM: Request setting of nmi_pending and sipi_vector
> KVM: x86: Fix up misreported CPU features
> KVM: Make vmport KVM-compatible
> KVM: Move and rename regs_modified
>
> Marcelo Tosatti (1):
> Fix incoming migration with iothread
>
> Sheng Yang (1):
> kvm: Flush coalesced MMIO buffer periodly
>
> cpu-all.h | 2 ++
> cpu-defs.h | 3 ++-
> exec.c | 6 ++++++
> hw/vmport.c | 3 +++
> kvm-all.c | 36 +++++++++++++++++++++---------------
> kvm.h | 1 +
> target-i386/kvm.c | 11 ++++++++++-
> vl.c | 4 ++++
> 8 files changed, 49 insertions(+), 17 deletions(-)
>
Applied. Thanks.
Regards,
Anthony Liguori
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2010-02-08 16:45 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-03 23:55 [Qemu-devel] [PATCH 0/6] [GIT PULL] qemu-kvm.git uq/master queue Marcelo Tosatti
2010-02-03 23:55 ` [Qemu-devel] [PATCH 1/6] kvm: Flush coalesced MMIO buffer periodly Marcelo Tosatti
2010-02-03 23:55 ` [Qemu-devel] [PATCH 2/6] KVM: Request setting of nmi_pending and sipi_vector Marcelo Tosatti
2010-02-03 23:55 ` [Qemu-devel] [PATCH 3/6] KVM: x86: Fix up misreported CPU features Marcelo Tosatti
2010-02-03 23:55 ` [Qemu-devel] [PATCH 4/6] KVM: Make vmport KVM-compatible Marcelo Tosatti
2010-02-03 23:55 ` [Qemu-devel] [PATCH 5/6] KVM: Move and rename regs_modified Marcelo Tosatti
2010-02-03 23:55 ` [Qemu-devel] [PATCH 6/6] Fix incoming migration with iothread Marcelo Tosatti
2010-02-08 16:44 ` [Qemu-devel] Re: [PATCH 0/6] [GIT PULL] qemu-kvm.git uq/master queue Anthony Liguori
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).