Skip to contentSkip to conversation

kvm: Improve upgrade notes when facing unsupported kernels

PATCH Applied Jan Kiszka 3 participants 9 messages Jun 7, 2009

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH 1/1 kvm: Improve upgrade notes when facing unsupported kernels

Users complained that it is not obvious what to do when kvm refuses to build or run due to an unsupported host kernel, so let's improve the hints.

---

 configure |    6 ++++--
 kvm-all.c |   10 +++++++---
 2 files changed, 11 insertions(+), 5 deletions(-)
configure +4 -2
index 42d46f2..8ccb58c 100755
@@ -1158,7 +1158,9 @@ EOF
 	| grep "error: " \
 	| awk -F "error: " '{if (NR>1) printf(", "); printf("%s",$2);}'`
       if test "$kvmerr" != "" ; then
-        kvm="no - (${kvmerr})"
+        kvm="no - (${kvmerr})\n\
+    NOTE: To enable KVM support, update your kernel to 2.6.29+ or install \
+recent kvm-kmod from http://sourceforge.net/projects/kvm."
       fi
     fi
   fi
@@ -1377,7 +1379,7 @@ echo "vde support       $vde"
 echo "AIO support       $aio"
 echo "IO thread         $io_thread"
 echo "Install blobs     $blobs"
-echo "KVM support       $kvm"
+echo -e "KVM support       $kvm"
 echo "fdt support       $fdt"
 echo "preadv support    $preadv"
 
kvm-all.c +7 -3
index dc2ded5..8567ac9 100644
@@ -396,6 +396,9 @@ int kvm_check_extension(KVMState *s, unsigned int extension)
 
 int kvm_init(int smp_cpus)
 {
+    static const char upgrade_note[] =
+        "Please upgrade to at least kernel 2.6.29 or recent kvm-kmod\n"
+        "(see http://sourceforge.net/projects/kvm).\n";
     KVMState *s;
     int ret;
     int i;
@@ -446,7 +449,8 @@ int kvm_init(int smp_cpus)
      */
     if (!kvm_check_extension(s, KVM_CAP_USER_MEMORY)) {
         ret = -EINVAL;
-        fprintf(stderr, "kvm does not support KVM_CAP_USER_MEMORY\n");
+        fprintf(stderr, "kvm does not support KVM_CAP_USER_MEMORY\n%s",
+                upgrade_note);
         goto err;
     }
 
@@ -457,8 +461,8 @@ int kvm_init(int smp_cpus)
         ret = -EINVAL;
 
         fprintf(stderr,
-                "KVM kernel module broken (DESTROY_MEMORY_REGION)\n"
-                "Please upgrade to at least kvm-81.\n");
+                "KVM kernel module broken (DESTROY_MEMORY_REGION).\n%s",
+                upgrade_note);
         goto err;
     }
 
#1 lore raw
Quoted 9 lines · Jan Kiszka

Users complained that it is not obvious what to do when kvm refuses to build or run due to an unsupported host kernel, so let's improve the hints.

configure +0 -0
index 42d46f2..8ccb58c 100755

configure EOF · line 1165

Quoted 9 lines
configure +3 -1
@@ -1158,7 +1158,9 @@ EOF
 	| grep "error: " \
 	| awk -F "error: " '{if (NR>1) printf(", "); printf("%s",$2);}'`
       if test "$kvmerr" != "" ; then
-        kvm="no - (${kvmerr})"
+        kvm="no - (${kvmerr})\n\
+    NOTE: To enable KVM support, update your kernel to 2.6.29+ or install \
+recent kvm-kmod from http://sourceforge.net/projects/kvm."
       fi
 

Installing kvm-mod is insufficient, you need the headers from somewhere.

Signature · 1 line
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
author
#2 lore raw
Quoted 14 lines · Avi Kivity
Quoted 13 lines · Jan Kiszka

Users complained that it is not obvious what to do when kvm refuses to build or run due to an unsupported host kernel, so let's improve the hints.

configure +0 -1
index 42d46f2..8ccb58c 100755
@@ -1158,7 +1158,9 @@ EOF
     | grep "error: " \
     | awk -F "error: " '{if (NR>1) printf(", "); printf("%s",$2);}'`
       if test "$kvmerr" != "" ; then
-        kvm="no - (${kvmerr})"
Quoted 9 lines

configure EOF

Quoted 6 lines
configure +3 -0
+        kvm="no - (${kvmerr})\n\
+    NOTE: To enable KVM support, update your kernel to 2.6.29+ or
 install \
+recent kvm-kmod from http://sourceforge.net/projects/kvm."
       fi
 

Installing kvm-mod is insufficient, you need the headers from somewhere.

True. Hmm, wasn't there the plan to fix this by carrying them in-tree?

Jan

#3 lore raw
Quoted 28 lines · Jan Kiszka
Quoted 15 lines · Avi Kivity
Quoted 13 lines · Jan Kiszka

Users complained that it is not obvious what to do when kvm refuses to build or run due to an unsupported host kernel, so let's improve the hints.

configure +0 -1
index 42d46f2..8ccb58c 100755
@@ -1158,7 +1158,9 @@ EOF
     | grep "error: " \
     | awk -F "error: " '{if (NR>1) printf(", "); printf("%s",$2);}'`
       if test "$kvmerr" != "" ; then
-        kvm="no - (${kvmerr})"
Quoted 10 lines

configure EOF

Quoted 7 lines
configure +3 -0
+        kvm="no - (${kvmerr})\n\
+    NOTE: To enable KVM support, update your kernel to 2.6.29+ or
 install \
+recent kvm-kmod from http://sourceforge.net/projects/kvm."
       fi
 

Installing kvm-mod is insufficient, you need the headers from somewhere.

Quoted 2 lines

True. Hmm, wasn't there the plan to fix this by carrying them in-tree?

Anthony even posted a patch but it was a bit excessive, carrying tons of kernel headers. I think we'd be fine carrying just the kvm headers, same as qemu-kvm. In which case the compile time test can go away.

Alternatively, I can make kvm-kmod install the necessary headers to /usr/local/include. It's probably cleaner this way.

Signature · 1 line
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
author
#4 lore raw
Quoted 31 lines · Avi Kivity
Quoted 27 lines · Jan Kiszka
Quoted 6 lines · Avi Kivity
Quoted 4 lines · Jan Kiszka

Users complained that it is not obvious what to do when kvm refuses to build or run due to an unsupported host kernel, so let's improve the hints.

Quoted 18 lines
Quoted 5 lines
configure +0 -0
index 42d46f2..8ccb58c 100755

configure EOF · line 1166

Quoted 10 lines
configure +3 -1
@@ -1158,7 +1158,9 @@ EOF
     | grep "error: " \
     | awk -F "error: " '{if (NR>1) printf(", "); printf("%s",$2);}'`
       if test "$kvmerr" != "" ; then
-        kvm="no - (${kvmerr})"
+        kvm="no - (${kvmerr})\n\
+    NOTE: To enable KVM support, update your kernel to 2.6.29+ or
 install \
+recent kvm-kmod from http://sourceforge.net/projects/kvm."
       fi
 

Installing kvm-mod is insufficient, you need the headers from somewhere.

Quoted 2 lines

True. Hmm, wasn't there the plan to fix this by carrying them in-tree?

Quoted 7 lines

Anthony even posted a patch but it was a bit excessive, carrying tons of kernel headers. I think we'd be fine carrying just the kvm headers, same as qemu-kvm. In which case the compile time test can go away.

Alternatively, I can make kvm-kmod install the necessary headers to /usr/local/include. It's probably cleaner this way.

Good idea. Maybe put them in a separate directory (and make qemu aware of it) so that kvm-kmod packages will not run into conflicts with the installed kernel headers.

Jan

#5 lore raw
Quoted 9 lines · Jan Kiszka
Quoted 4 lines

Alternatively, I can make kvm-kmod install the necessary headers to /usr/local/include. It's probably cleaner this way.

Good idea. Maybe put them in a separate directory (and make qemu aware of it) so that kvm-kmod packages will not run into conflicts with the installed kernel headers.

Yes, /usr/local/include (configurable). gcc should automatically prefer /usr/local/include to /use/include.

Signature · 1 line
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
author
#6 lore raw
Quoted 6 lines · Avi Kivity
Quoted 5 lines · Jan Kiszka
Quoted 4 lines

Alternatively, I can make kvm-kmod install the necessary headers to /usr/local/include. It's probably cleaner this way.

Quoted 7 lines
Quoted 4 lines

Good idea. Maybe put them in a separate directory (and make qemu aware of it) so that kvm-kmod packages will not run into conflicts with the installed kernel headers.

Yes, /usr/local/include (configurable). gcc should automatically prefer /usr/local/include to /use/include.

/me should put on my glasses...

Jan

#7 lore raw
Quoted 2 lines · Jan Kiszka

/me should put on my glasses...

The code's much prettier without them.

Signature · 1 line
Do not meddle in the internals of kernels, for they are subtle and quick to panic.