From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:40666) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RmsG0-0008L7-OA for qemu-devel@nongnu.org; Mon, 16 Jan 2012 14:30:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RmsFz-0006Nt-6n for qemu-devel@nongnu.org; Mon, 16 Jan 2012 14:30:16 -0500 Received: from e39.co.us.ibm.com ([32.97.110.160]:59270) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RmsFy-0006Nb-Gv for qemu-devel@nongnu.org; Mon, 16 Jan 2012 14:30:15 -0500 Received: from /spool/local by e39.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 16 Jan 2012 12:30:13 -0700 Received: from d01relay05.pok.ibm.com (d01relay05.pok.ibm.com [9.56.227.237]) by d03dlp03.boulder.ibm.com (Postfix) with ESMTP id DD98419D804D for ; Mon, 16 Jan 2012 12:30:07 -0700 (MST) Received: from d01av01.pok.ibm.com (d01av01.pok.ibm.com [9.56.224.215]) by d01relay05.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q0GJU9Pw231816 for ; Mon, 16 Jan 2012 14:30:09 -0500 Received: from d01av01.pok.ibm.com (loopback [127.0.0.1]) by d01av01.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q0GJU8Ch017509 for ; Mon, 16 Jan 2012 14:30:08 -0500 Date: Mon, 16 Jan 2012 13:30:05 -0600 From: Ryan Harper Message-ID: <20120116193005.GC25198@us.ibm.com> References: <1326066759-8210-1-git-send-email-agraf@suse.de> <1326066759-8210-2-git-send-email-agraf@suse.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1326066759-8210-2-git-send-email-agraf@suse.de> Subject: Re: [Qemu-devel] [PATCH 2/2] KVM: Use -cpu best as default on x86 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexander Graf Cc: "qemu-devel@nongnu.org Developers" , kvm list , Avi Kivity * Alexander Graf [2012-01-08 17:53]: > When running QEMU without -cpu parameter, the user usually wants a sane > default. So far, we're using the qemu64/qemu32 CPU type, which basically > means "the maximum TCG can emulate". it also means we all maximum possible migration targets. Have you given any thought to migration with -cpu best? > > That's a really good default when using TCG, but when running with KVM > we much rather want a default saying "the maximum performance I can get". > > Fortunately we just added an option that gives us the best performance > while still staying safe on the testability side of things: -cpu best. > So all we need to do is make -cpu best the default when the user doesn't > define any. > > This fixes a lot of subtile breakage in the GNU toolchain (libgmp) which > hicks up on QEMU's non-existent CPU models. > > This patch also adds a new pc-1.1 machine type to keep backwards compatible > with older versions of QEMU. > > Signed-off-by: Alexander Graf > --- > hw/pc_piix.c | 42 ++++++++++++++++++++++++++++++++++-------- > 1 files changed, 34 insertions(+), 8 deletions(-) > > diff --git a/hw/pc_piix.c b/hw/pc_piix.c > index 00f525e..3d78ccb 100644 > --- a/hw/pc_piix.c > +++ b/hw/pc_piix.c > @@ -79,7 +79,8 @@ static void pc_init1(MemoryRegion *system_memory, > const char *initrd_filename, > const char *cpu_model, > int pci_enabled, > - int kvmclock_enabled) > + int kvmclock_enabled, > + int may_cpu_best) > { > int i; > ram_addr_t below_4g_mem_size, above_4g_mem_size; > @@ -102,6 +103,9 @@ static void pc_init1(MemoryRegion *system_memory, > MemoryRegion *rom_memory; > DeviceState *dev; > > + if (!cpu_model && kvm_enabled() && may_cpu_best) { > + cpu_model = "best"; > + } > pc_cpus_init(cpu_model); > > if (kvmclock_enabled) { > @@ -263,7 +267,21 @@ static void pc_init_pci(ram_addr_t ram_size, > get_system_io(), > ram_size, boot_device, > kernel_filename, kernel_cmdline, > - initrd_filename, cpu_model, 1, 1); > + initrd_filename, cpu_model, 1, 1, 1); > +} > + > +static void pc_init_pci_oldcpu(ram_addr_t ram_size, > + const char *boot_device, > + const char *kernel_filename, > + const char *kernel_cmdline, > + const char *initrd_filename, > + const char *cpu_model) > +{ > + pc_init1(get_system_memory(), > + get_system_io(), > + ram_size, boot_device, > + kernel_filename, kernel_cmdline, > + initrd_filename, cpu_model, 1, 1, 0); > } > > static void pc_init_pci_no_kvmclock(ram_addr_t ram_size, > @@ -277,7 +295,7 @@ static void pc_init_pci_no_kvmclock(ram_addr_t ram_size, > get_system_io(), > ram_size, boot_device, > kernel_filename, kernel_cmdline, > - initrd_filename, cpu_model, 1, 0); > + initrd_filename, cpu_model, 1, 0, 0); > } > > static void pc_init_isa(ram_addr_t ram_size, > @@ -293,7 +311,7 @@ static void pc_init_isa(ram_addr_t ram_size, > get_system_io(), > ram_size, boot_device, > kernel_filename, kernel_cmdline, > - initrd_filename, cpu_model, 0, 1); > + initrd_filename, cpu_model, 0, 1, 0); > } > > #ifdef CONFIG_XEN > @@ -314,8 +332,8 @@ static void pc_xen_hvm_init(ram_addr_t ram_size, > } > #endif > > -static QEMUMachine pc_machine_v1_0 = { > - .name = "pc-1.0", > +static QEMUMachine pc_machine_v1_1 = { > + .name = "pc-1.1", > .alias = "pc", > .desc = "Standard PC", > .init = pc_init_pci, > @@ -323,17 +341,24 @@ static QEMUMachine pc_machine_v1_0 = { > .is_default = 1, > }; > > +static QEMUMachine pc_machine_v1_0 = { > + .name = "pc-1.0", > + .desc = "Standard PC", > + .init = pc_init_pci_oldcpu, > + .max_cpus = 255, > +}; > + > static QEMUMachine pc_machine_v0_15 = { > .name = "pc-0.15", > .desc = "Standard PC", > - .init = pc_init_pci, > + .init = pc_init_pci_oldcpu, > .max_cpus = 255, > }; > > static QEMUMachine pc_machine_v0_14 = { > .name = "pc-0.14", > .desc = "Standard PC", > - .init = pc_init_pci, > + .init = pc_init_pci_oldcpu, > .max_cpus = 255, > .compat_props = (GlobalProperty[]) { > { > @@ -612,6 +637,7 @@ static QEMUMachine xenfv_machine = { > > static void pc_machine_init(void) > { > + qemu_register_machine(&pc_machine_v1_1); > qemu_register_machine(&pc_machine_v1_0); > qemu_register_machine(&pc_machine_v0_15); > qemu_register_machine(&pc_machine_v0_14); > -- > 1.6.0.2 > -- Ryan Harper Software Engineer; Linux Technology Center IBM Corp., Austin, Tx ryanh@us.ibm.com