From patchwork Mon Feb 14 15:22:38 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcelo Tosatti X-Patchwork-Id: 83117 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id CC2DEB7170 for ; Tue, 15 Feb 2011 03:26:30 +1100 (EST) Received: from localhost ([127.0.0.1]:55090 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pp0gI-0002sx-9Q for incoming@patchwork.ozlabs.org; Mon, 14 Feb 2011 10:49:42 -0500 Received: from [140.186.70.92] (port=57979 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pp0IT-0000FE-Ur for qemu-devel@nongnu.org; Mon, 14 Feb 2011 10:25:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Pp0IK-0003yK-12 for qemu-devel@nongnu.org; Mon, 14 Feb 2011 10:25:05 -0500 Received: from mx1.redhat.com ([209.132.183.28]:30425) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Pp0IJ-0003xL-Mv for qemu-devel@nongnu.org; Mon, 14 Feb 2011 10:24:55 -0500 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p1EFOrS7029357 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 14 Feb 2011 10:24:54 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p1EFOrWa009769; Mon, 14 Feb 2011 10:24:53 -0500 Received: from amt.cnet (vpn-11-144.rdu.redhat.com [10.11.11.144]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id p1EFOpGe006221; Mon, 14 Feb 2011 10:24:51 -0500 Received: from amt.cnet (localhost.localdomain [127.0.0.1]) by amt.cnet (Postfix) with ESMTP id B46806520BB; Mon, 14 Feb 2011 13:23:38 -0200 (BRST) Received: (from marcelo@localhost) by amt.cnet (8.14.4/8.14.4/Submit) id p1EFNaeO031965; Mon, 14 Feb 2011 13:23:36 -0200 From: Marcelo Tosatti To: Anthony Liguori Date: Mon, 14 Feb 2011 13:22:38 -0200 Message-Id: <84b4915dd2c0eaa86c970ffc42a68ea8ba9e48b5.1297696986.git.mtosatti@redhat.com> In-Reply-To: References: X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: Jan Kiszka , Marcelo Tosatti , qemu-devel@nongnu.org, kvm@vger.kernel.org Subject: [Qemu-devel] [PATCH 09/37] kvm: Handle kvm_init_vcpu errors X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Jan Kiszka Do not ignore errors of kvm_init_vcpu, they are fatal. Signed-off-by: Jan Kiszka Signed-off-by: Marcelo Tosatti --- cpus.c | 19 +++++++++++++++---- 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);