aboutsummaryrefslogtreecommitdiff
path: root/cpus.c
diff options
context:
space:
mode:
authorJan Kiszka <jan.kiszka@siemens.com>2011-02-01 22:15:50 +0100
committerMarcelo Tosatti <mtosatti@redhat.com>2011-02-14 12:39:45 -0200
commit84b4915dd2c0eaa86c970ffc42a68ea8ba9e48b5 (patch)
tree25a927fac2241537f040bf6cea2bc1ba50f007b8 /cpus.c
parentd31ae052a913e8e41a9f22429c28decbdb660568 (diff)
downloadqemu-84b4915dd2c0eaa86c970ffc42a68ea8ba9e48b5.zip
qemu-84b4915dd2c0eaa86c970ffc42a68ea8ba9e48b5.tar.gz
qemu-84b4915dd2c0eaa86c970ffc42a68ea8ba9e48b5.tar.bz2
kvm: Handle kvm_init_vcpu errors
Do not ignore errors of kvm_init_vcpu, they are fatal. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'cpus.c')
-rw-r--r--cpus.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/cpus.c b/cpus.c
index 8232d44..3a72d06 100644
--- a/cpus.c
+++ b/cpus.c
@@ -265,12 +265,18 @@ void qemu_main_loop_start(void)
void qemu_init_vcpu(void *_env)
{
CPUState *env = _env;
+ int r;
env->nr_cores = smp_cores;
env->nr_threads = smp_threads;
- if (kvm_enabled())
- kvm_init_vcpu(env);
- return;
+
+ if (kvm_enabled()) {
+ r = kvm_init_vcpu(env);
+ if (r < 0) {
+ fprintf(stderr, "kvm_init_vcpu failed: %s\n", strerror(-r));
+ exit(1);
+ }
+ }
}
int qemu_cpu_self(void *env)
@@ -600,11 +606,16 @@ static int qemu_cpu_exec(CPUState *env);
static void *kvm_cpu_thread_fn(void *arg)
{
CPUState *env = arg;
+ int r;
qemu_mutex_lock(&qemu_global_mutex);
qemu_thread_self(env->thread);
- kvm_init_vcpu(env);
+ r = kvm_init_vcpu(env);
+ if (r < 0) {
+ fprintf(stderr, "kvm_init_vcpu failed: %s\n", strerror(-r));
+ exit(1);
+ }
kvm_init_ipi(env);