From patchwork Mon Mar 22 10:49:13 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 87396 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o2MAnHGh002785 for ; Mon, 22 Mar 2010 10:49:17 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754424Ab0CVKtP (ORCPT ); Mon, 22 Mar 2010 06:49:15 -0400 Received: from cantor.suse.de ([195.135.220.2]:47382 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754118Ab0CVKtO (ORCPT ); Mon, 22 Mar 2010 06:49:14 -0400 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.221.2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.suse.de (Postfix) with ESMTP id DE4366CB00 for ; Mon, 22 Mar 2010 11:49:13 +0100 (CET) From: Alexander Graf To: KVM list Subject: [PATCH] Bail out when VCPU_CREATE fails Date: Mon, 22 Mar 2010 11:49:13 +0100 Message-Id: <1269254953-20323-1-git-send-email-agraf@suse.de> X-Mailer: git-send-email 1.6.0.2 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Mon, 22 Mar 2010 10:49:17 +0000 (UTC) diff --git a/qemu-kvm.c b/qemu-kvm.c index 7772434..4d19c80 100644 --- a/qemu-kvm.c +++ b/qemu-kvm.c @@ -448,7 +448,8 @@ static void kvm_create_vcpu(CPUState *env, int id) r = kvm_vm_ioctl(kvm_state, KVM_CREATE_VCPU, id); if (r < 0) { fprintf(stderr, "kvm_create_vcpu: %m\n"); - return; + fprintf(stderr, "Failed to create vCPU. Check the -smp parameter.\n"); + goto err; } env->kvm_fd = r; @@ -476,6 +477,9 @@ static void kvm_create_vcpu(CPUState *env, int id) return; err_fd: close(env->kvm_fd); + err: + /* We're no good with semi-broken states. */ + abort(); } static int kvm_set_boot_vcpu_id(kvm_context_t kvm, uint32_t id)