qemu-kvm: fix segfault when running kvm without /dev/kvm
commitc06b44bfc9814930b6a94db7bbeb3be1cd39c0d2
authorDustin Kirkland <kirkland@canonical.com>
Fri, 4 Sep 2009 19:38:30 +0000 (4 14:38 -0500)
committerMarcelo Tosatti <mtosatti@redhat.com>
Sat, 5 Sep 2009 16:28:31 +0000 (5 13:28 -0300)
tree6dcb8d82aa2c2a48e7d8b17b179baec0d1c3c87a
parent2b928786d29f0d54f9b0218e0fc8ffb93af5aef3
qemu-kvm: fix segfault when running kvm without /dev/kvm

qemu-kvm segfaults on systems without access to /dev/kvm.
The global kvm_allowed is being set too late in vl.c.

This patch moves the kvm initialization a bit higher in the
vl.c main, just after the daemonize fork.

This fix is intended to be a short term solution, solving the
segfaults.

In the longer term, the suggested approach requires a bit more
development and testing:
 * If no arg given          => try kvm, try kqemu, try tcg
 * If --accelmode arg given => try $arg, and fail if unavailable

Signed-off-by: Dustin Kirkland <kirkland@canonical.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
vl.c