From patchwork Tue Jun 1 23:03:00 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Williamson X-Patchwork-Id: 54333 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 EBAD0B7D51 for ; Wed, 2 Jun 2010 09:04:33 +1000 (EST) Received: from localhost ([127.0.0.1]:52709 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OJaVZ-0000mQ-Ql for incoming@patchwork.ozlabs.org; Tue, 01 Jun 2010 19:04:29 -0400 Received: from [140.186.70.92] (port=47093 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OJaUD-0000Tz-Gk for qemu-devel@nongnu.org; Tue, 01 Jun 2010 19:03:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OJaUC-0001Bo-BY for qemu-devel@nongnu.org; Tue, 01 Jun 2010 19:03:05 -0400 Received: from qmta05.emeryville.ca.mail.comcast.net ([76.96.30.48]:56055) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OJaUC-0001Bi-20 for qemu-devel@nongnu.org; Tue, 01 Jun 2010 19:03:04 -0400 Received: from omta11.emeryville.ca.mail.comcast.net ([76.96.30.36]) by qmta05.emeryville.ca.mail.comcast.net with comcast id QdvQ1e0050mlR8UA5n32gy; Tue, 01 Jun 2010 23:03:02 +0000 Received: from localhost.localdomain ([75.71.122.219]) by omta11.emeryville.ca.mail.comcast.net with comcast id Qn301e00N4k7Kz78Xn31LM; Tue, 01 Jun 2010 23:03:01 +0000 From: Alex Williamson To: qemu-devel@nongnu.org Date: Tue, 01 Jun 2010 17:03:00 -0600 Message-ID: <20100601230235.14944.69041.stgit@localhost.localdomain> User-Agent: StGIT/0.14.3 MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. Cc: alex.williamson@redhat.com, kvm@vger.kernel.org Subject: [Qemu-devel] [PATCH] pc: push setting default cpu_model down a level 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 Not that CPU hotplug currently works, but if you make the mistake of trying it on a VM started without specifying a -cpu value, you hit a segfault from trying to strdup(NULL) in cpu_x86_find_by_name(). Signed-off-by: Alex Williamson --- hw/pc.c | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-) diff --git a/hw/pc.c b/hw/pc.c index 9b85c42..a79586c 100644 --- a/hw/pc.c +++ b/hw/pc.c @@ -771,6 +771,14 @@ static CPUState *pc_new_cpu(const char *cpu_model) { CPUState *env; + if (cpu_model == NULL) { +#ifdef TARGET_X86_64 + cpu_model = "qemu64"; +#else + cpu_model = "qemu32"; +#endif + } + env = cpu_init(cpu_model); if (!env) { fprintf(stderr, "Unable to find x86 CPU definition\n"); @@ -791,14 +799,6 @@ void pc_cpus_init(const char *cpu_model) int i; /* init CPUs */ - if (cpu_model == NULL) { -#ifdef TARGET_X86_64 - cpu_model = "qemu64"; -#else - cpu_model = "qemu32"; -#endif - } - for(i = 0; i < smp_cpus; i++) { pc_new_cpu(cpu_model); }