[libvirt] PATCH: recent qemu-kvm requires -enable-kvm flag to activate VT optimization

Daniel P. Berrange berrange at redhat.com
Mon Nov 16 11:30:44 UTC 2009


On Mon, Nov 16, 2009 at 02:15:28AM -0800, Steve Yarmie wrote:

> diff -upr libvirt/src/qemu/qemu_conf.c libvirt-enableKVM/src/qemu/qemu_conf.c
> --- libvirt/src/qemu/qemu_conf.c	2009-11-15 18:23:34.132206179 -0800
> +++ libvirt-enableKVM/src/qemu/qemu_conf.c	2009-11-16 02:13:08.060515632 -0800
> @@ -878,6 +878,8 @@ static unsigned int qemudComputeCmdFlags
>          flags |= QEMUD_CMD_FLAG_KQEMU;
>      if (strstr(help, "-no-kvm"))
>          flags |= QEMUD_CMD_FLAG_KVM;
> +    if (strstr(help, "-enable-kvm"))
> +        flags |= QEMUD_CMD_FLAG_ENABLE_KVM;
>      if (strstr(help, "-no-reboot"))
>          flags |= QEMUD_CMD_FLAG_NO_REBOOT;
>      if (strstr(help, "-name"))
> @@ -1595,6 +1597,7 @@ int qemudBuildCommandLine(virConnectPtr 
>      struct utsname ut;
>      int disableKQEMU = 0;
>      int disableKVM = 0;
> +    int enableKVM = 0;
>      int qargc = 0, qarga = 0;
>      const char **qargv = NULL;
>      int qenvc = 0, qenva = 0;
> @@ -1653,6 +1656,15 @@ int qemudBuildCommandLine(virConnectPtr 
>          def->virtType == VIR_DOMAIN_VIRT_QEMU)
>          disableKVM = 1;
>  
> +    /* Should explicitly enable KVM if
> +     * 1. Guest domain is 'qemu'

Surely 'kvm' here

> +     * 2. The qemu binary has the -enable-kvm flag
> +     * NOTE: user must be responsible to load the kvm modules
> +     */
> +    if ((qemuCmdFlags & QEMUD_CMD_FLAG_ENABLE_KVM) &&
> +        def->virtType == VIR_DOMAIN_VIRT_QEMU)

Again, this should be VIR_DOMAIN_VIRT_KVM here - 'qemu' is intended
to be pure emulation only

> +        enableKVM = 1;
> +
>      /*
>       * Need to force a 32-bit guest CPU type if
>       *
> @@ -1780,6 +1792,8 @@ int qemudBuildCommandLine(virConnectPtr 
>          ADD_ARG_LIT("-no-kqemu");
>      if (disableKVM)
>          ADD_ARG_LIT("-no-kvm");
> +    if (enableKVM)
> +	ADD_ARG_LIT("-enable-kvm");
>      ADD_ARG_LIT("-m");
>      ADD_ARG_LIT(memory);
>      if (def->hugepage_backed) {


Regards,
Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




More information about the libvir-list mailing list