[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 11/12] Do not stop VM if emulation failed in userspa
From: |
Marcelo Tosatti |
Subject: |
[Qemu-devel] [PATCH 11/12] Do not stop VM if emulation failed in userspace. |
Date: |
Wed, 12 May 2010 18:25:05 -0300 |
From: Gleb Natapov <address@hidden>
Continue vcpu execution in case emulation failure happened while vcpu
was in userspace. In this case #UD will be injected into the guest
allowing guest OS to kill offending process and continue.
Signed-off-by: Gleb Natapov <address@hidden>
Signed-off-by: Marcelo Tosatti <address@hidden>
---
kvm-all.c | 2 ++
kvm.h | 2 ++
target-i386/kvm.c | 7 +++++++
target-ppc/kvm.c | 5 +++++
target-s390x/kvm.c | 5 +++++
5 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/kvm-all.c b/kvm-all.c
index d06980c..c238f54 100644
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -764,6 +764,8 @@ static void kvm_handle_internal_error(CPUState *env, struct
kvm_run *run)
cpu_dump_state(env, stderr, fprintf, 0);
if (run->internal.suberror == KVM_INTERNAL_ERROR_EMULATION) {
fprintf(stderr, "emulation failure\n");
+ if (!kvm_arch_stop_on_emulation_error(env))
+ return;
}
/* FIXME: Should trigger a qmp message to let management know
* something went wrong.
diff --git a/kvm.h b/kvm.h
index 5071a31..a28e7aa 100644
--- a/kvm.h
+++ b/kvm.h
@@ -140,6 +140,8 @@ void kvm_arch_remove_all_hw_breakpoints(void);
void kvm_arch_update_guest_debug(CPUState *env, struct kvm_guest_debug *dbg);
+bool kvm_arch_stop_on_emulation_error(CPUState *env);
+
int kvm_check_extension(KVMState *s, unsigned int extension);
uint32_t kvm_arch_get_supported_cpuid(CPUState *env, uint32_t function,
diff --git a/target-i386/kvm.c b/target-i386/kvm.c
index bd7a190..676aa60 100644
--- a/target-i386/kvm.c
+++ b/target-i386/kvm.c
@@ -1289,3 +1289,10 @@ void kvm_arch_update_guest_debug(CPUState *env, struct
kvm_guest_debug *dbg)
}
}
#endif /* KVM_CAP_SET_GUEST_DEBUG */
+
+bool kvm_arch_stop_on_emulation_error(CPUState *env)
+{
+ return !(env->cr[0] & CR0_PE_MASK) ||
+ ((env->segs[R_CS].selector & 3) != 3);
+}
+
diff --git a/target-ppc/kvm.c b/target-ppc/kvm.c
index 91c0963..2625cb8 100644
--- a/target-ppc/kvm.c
+++ b/target-ppc/kvm.c
@@ -326,3 +326,8 @@ uint32_t kvmppc_get_tbfreq(void)
retval = atoi(ns);
return retval;
}
+
+bool kvm_arch_stop_on_emulation_error(CPUState *env)
+{
+ return true;
+}
diff --git a/target-s390x/kvm.c b/target-s390x/kvm.c
index a2c00ac..a2d7741 100644
--- a/target-s390x/kvm.c
+++ b/target-s390x/kvm.c
@@ -485,3 +485,8 @@ int kvm_arch_handle_exit(CPUState *env, struct kvm_run *run)
return ret;
}
+
+bool kvm_arch_stop_on_emulation_error(CPUState *env)
+{
+ return true;
+}
--
1.6.6.1
- [Qemu-devel] Re: [PATCH 10/12] kvm: enable smp > 1, (continued)
- [Qemu-devel] Re: [PATCH 10/12] kvm: enable smp > 1, Avi Kivity, 2010/05/14
- [Qemu-devel] Re: [PATCH 10/12] kvm: enable smp > 1, Alexander Graf, 2010/05/14
- [Qemu-devel] Re: [PATCH 10/12] kvm: enable smp > 1, Jan Kiszka, 2010/05/14
- [Qemu-devel] Re: [PATCH 10/12] kvm: enable smp > 1, Alexander Graf, 2010/05/14
- [Qemu-devel] Re: [PATCH 10/12] kvm: enable smp > 1, Udo Lembke, 2010/05/19
- [Qemu-devel] Re: [PATCH 10/12] kvm: enable smp > 1, Avi Kivity, 2010/05/19
- [Qemu-devel] Re: [PATCH 10/12] kvm: enable smp > 1, Udo Lembke, 2010/05/19
- [Qemu-devel] Re: [PATCH 10/12] kvm: enable smp > 1, Avi Kivity, 2010/05/20
- [Qemu-devel] Re: [PATCH 10/12] kvm: enable smp > 1, Udo Lembke, 2010/05/20
[Qemu-devel] [PATCH 01/12] Fix -mem-path with hugetlbfs, Marcelo Tosatti, 2010/05/12
[Qemu-devel] [PATCH 11/12] Do not stop VM if emulation failed in userspace.,
Marcelo Tosatti <=
[Qemu-devel] [PATCH 03/12] make SIG_IPI to tcg vcpu thread reliable, Marcelo Tosatti, 2010/05/12
[Qemu-devel] [PATCH 07/12] add cpu_is_stopped helper, Marcelo Tosatti, 2010/05/12
[Qemu-devel] [PATCH 02/12] kvm: set cpu_single_env around KVM_RUN ioctl, Marcelo Tosatti, 2010/05/12
[Qemu-devel] [PATCH 09/12] kvm: validate context for kvm cpu get/put operations, Marcelo Tosatti, 2010/05/12
[Qemu-devel] [PATCH 05/12] port qemu-kvm's on_vcpu code, Marcelo Tosatti, 2010/05/12
[Qemu-devel] [PATCH 06/12] kvm: synchronize state from cpu context, Marcelo Tosatti, 2010/05/12
[Qemu-devel] [PATCH 04/12] standardize on qemu_cpu_kick for signalling cpu thread(s), Marcelo Tosatti, 2010/05/12
Re: [Qemu-devel] [PATCH 00/12] [PULL] qemu-kvm.git uq/master queue, Anthony Liguori, 2010/05/17