From patchwork Thu Jan 24 05:03:26 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: liguang X-Patchwork-Id: 215226 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 87E2B2C007C for ; Thu, 24 Jan 2013 16:06:24 +1100 (EST) Received: from localhost ([::1]:55739 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TyF14-0007Kb-Bg for incoming@patchwork.ozlabs.org; Thu, 24 Jan 2013 00:06:22 -0500 Received: from eggs.gnu.org ([208.118.235.92]:35602) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TyF0j-0007G3-VS for qemu-devel@nongnu.org; Thu, 24 Jan 2013 00:06:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TyF0h-0005J4-0o for qemu-devel@nongnu.org; Thu, 24 Jan 2013 00:06:01 -0500 Received: from [222.73.24.84] (port=32838 helo=song.cn.fujitsu.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TyF0g-0005II-K1 for qemu-devel@nongnu.org; Thu, 24 Jan 2013 00:05:58 -0500 X-IronPort-AV: E=Sophos;i="4.84,527,1355068800"; d="scan'208";a="6638577" Received: from unknown (HELO tang.cn.fujitsu.com) ([10.167.250.3]) by song.cn.fujitsu.com with ESMTP; 24 Jan 2013 13:03:47 +0800 Received: from fnstmail02.fnst.cn.fujitsu.com (tang.cn.fujitsu.com [127.0.0.1]) by tang.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id r0O55sgG001937; Thu, 24 Jan 2013 13:05:54 +0800 Received: from liguang.fnst.cn.fujitsu.com ([10.167.225.128]) by fnstmail02.fnst.cn.fujitsu.com (Lotus Domino Release 8.5.3) with ESMTP id 2013012413045811-20928 ; Thu, 24 Jan 2013 13:04:58 +0800 From: liguang To: stefano.stabellini@eu.citrix.com, aliguori@us.ibm.com, jan.kiszka@siemens.com, avi@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Date: Thu, 24 Jan 2013 13:03:26 +0800 Message-Id: <1359003807-31996-3-git-send-email-lig.fnst@cn.fujitsu.com> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1359003807-31996-1-git-send-email-lig.fnst@cn.fujitsu.com> References: <1359003807-31996-1-git-send-email-lig.fnst@cn.fujitsu.com> X-MIMETrack: Itemize by SMTP Server on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2013/01/24 13:04:58, Serialize by Router on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2013/01/24 13:04:58, Serialize complete at 2013/01/24 13:04:58 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 222.73.24.84 Cc: liguang Subject: [Qemu-devel] [PATCH 2/3] vl: correct error message when fail to init kvm X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org command: qemu-system-x86_64 -hda disk.img -smp 32 --enable-kvm error: Number of SMP cpus requested (32) exceeds max cpus supported by KVM (16) failed to initialize KVM: Invalid argument No accelerator found! well, it did find kvm, but failed to init, so message "No accelerator found!" is confusing, this commit remove the confusing error message. Signed-off-by: liguang --- vl.c | 12 +++++++----- 1 files changed, 7 insertions(+), 5 deletions(-) diff --git a/vl.c b/vl.c index 25aa8e8..5374c14 100644 --- a/vl.c +++ b/vl.c @@ -2520,8 +2520,8 @@ static int configure_accelerator(void) const char *p = NULL; char buf[10]; int i, ret; - bool accel_initialised = 0; - bool init_failed = 0; + bool accel_initialised = false; + bool init_failed = false; QemuOptsList *list = qemu_find_opts("machine"); if (!QTAILQ_EMPTY(&list->head)) { @@ -2548,13 +2548,13 @@ static int configure_accelerator(void) *(accel_list[i].allowed) = 1; ret = accel_list[i].init(); if (ret < 0) { - init_failed = 1; + init_failed = true; fprintf(stderr, "failed to initialize %s: %s\n", accel_list[i].name, strerror(-ret)); *(accel_list[i].allowed) = 0; } else { - accel_initialised = 1; + accel_initialised = true; } break; } @@ -2565,7 +2565,9 @@ static int configure_accelerator(void) } if (!accel_initialised) { - fprintf(stderr, "No accelerator found!\n"); + if (!init_failed) { + fprintf(stderr, "No accelerator found!\n"); + } exit(1); }