* bug#22633: Provide a kvm-less qemu / guix system vm @ 2016-02-11 17:26 Christopher Allan Webber 2016-02-11 22:50 ` Jookia 0 siblings, 1 reply; 18+ messages in thread From: Christopher Allan Webber @ 2016-02-11 17:26 UTC (permalink / raw) To: 22633 So on my Libreboot-enabled machine, KVM does not work. In fact, even starting qemu with KVM enabled on it appears to crash my whole system. Not only does "guix system vm" not work, even "guix system vm-image" can take the whole machine down! It would be nice to have a --no-kvm switch, because I'd really like to make use of Guix's nice VM features! PS: Apparently in future revisions of Libreboot, this will be fixed. For now though... ^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#22633: Provide a kvm-less qemu / guix system vm 2016-02-11 17:26 bug#22633: Provide a kvm-less qemu / guix system vm Christopher Allan Webber @ 2016-02-11 22:50 ` Jookia 2016-02-12 0:49 ` Leo Famulari 2016-02-12 9:02 ` Ludovic Courtès 0 siblings, 2 replies; 18+ messages in thread From: Jookia @ 2016-02-11 22:50 UTC (permalink / raw) To: Christopher Allan Webber; +Cc: 22633 On Thu, Feb 11, 2016 at 09:26:12AM -0800, Christopher Allan Webber wrote: > So on my Libreboot-enabled machine, KVM does not work. In fact, even > starting qemu with KVM enabled on it appears to crash my whole system. > Not only does "guix system vm" not work, even "guix system vm-image" can > take the whole machine down! Currently the 'solution' I've found is to edit Guix to remove the two instances of '--enable-kvm' which works somewhat, though it's slower as there's absolutely no acceleration. > It would be nice to have a --no-kvm switch, because I'd really like to > make use of Guix's nice VM features! We should probably also blacklist kvm on Libreboot machines too somehow, though this could also break it on non-Libreboot machines. I wonder if there's a way to query the BIOS to see if Libreboot is enabled? > PS: Apparently in future revisions of Libreboot, this will be fixed. > For now though... Oh really? I was under the impression this was broken due to microcode issues. Jookia. ^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#22633: Provide a kvm-less qemu / guix system vm 2016-02-11 22:50 ` Jookia @ 2016-02-12 0:49 ` Leo Famulari 2016-02-12 18:04 ` Christopher Allan Webber 2016-02-12 9:02 ` Ludovic Courtès 1 sibling, 1 reply; 18+ messages in thread From: Leo Famulari @ 2016-02-12 0:49 UTC (permalink / raw) To: Jookia; +Cc: 22633 [-- Attachment #1: Type: text/plain, Size: 819 bytes --] On Fri, Feb 12, 2016 at 09:50:09AM +1100, Jookia wrote: > On Thu, Feb 11, 2016 at 09:26:12AM -0800, Christopher Allan Webber wrote: > > So on my Libreboot-enabled machine, KVM does not work. In fact, even > > starting qemu with KVM enabled on it appears to crash my whole system. > > Not only does "guix system vm" not work, even "guix system vm-image" can > > take the whole machine down! > > Currently the 'solution' I've found is to edit Guix to remove the two instances > of '--enable-kvm' which works somewhat, though it's slower as there's absolutely > no acceleration. > > > It would be nice to have a --no-kvm switch, because I'd really like to > > make use of Guix's nice VM features! It's not a proper fix, but this patch achieves that on my non-Libreboot machine. Can you see if it works for you? [...] [-- Attachment #2: disable-kvm.patch --] [-- Type: text/x-diff, Size: 940 bytes --] diff --git a/gnu/build/vm.scm b/gnu/build/vm.scm index a095f9d..e4abcb2 100644 --- a/gnu/build/vm.scm +++ b/gnu/build/vm.scm @@ -97,7 +97,7 @@ the #:references-graphs parameter of 'derivation'." (_ #f)) (unless (zero? - (apply system* qemu "-enable-kvm" "-nographic" "-no-reboot" + (apply system* qemu "-nographic" "-no-reboot" "-m" (number->string memory-size) "-net" "nic,model=virtio" "-virtfs" diff --git a/gnu/system/vm.scm b/gnu/system/vm.scm index a7c03bd..aa9c421 100644 --- a/gnu/system/vm.scm +++ b/gnu/system/vm.scm @@ -457,7 +457,7 @@ with '-virtfs' options for the host file systems listed in SHARED-FS." "\" ")) #~(string-append - " -enable-kvm -no-reboot -net nic,model=virtio \ + " -no-reboot -net nic,model=virtio \ " #$@(map virtfs-option shared-fs) " \ -net user \ -serial stdio -vga std \ ^ permalink raw reply related [flat|nested] 18+ messages in thread
* bug#22633: Provide a kvm-less qemu / guix system vm 2016-02-12 0:49 ` Leo Famulari @ 2016-02-12 18:04 ` Christopher Allan Webber 2016-02-13 0:47 ` Leo Famulari 0 siblings, 1 reply; 18+ messages in thread From: Christopher Allan Webber @ 2016-02-12 18:04 UTC (permalink / raw) To: Leo Famulari; +Cc: 22633 Leo Famulari writes: > On Fri, Feb 12, 2016 at 09:50:09AM +1100, Jookia wrote: >> On Thu, Feb 11, 2016 at 09:26:12AM -0800, Christopher Allan Webber wrote: >> > So on my Libreboot-enabled machine, KVM does not work. In fact, even >> > starting qemu with KVM enabled on it appears to crash my whole system. >> > Not only does "guix system vm" not work, even "guix system vm-image" can >> > take the whole machine down! >> >> Currently the 'solution' I've found is to edit Guix to remove the two instances >> of '--enable-kvm' which works somewhat, though it's slower as there's absolutely >> no acceleration. >> >> > It would be nice to have a --no-kvm switch, because I'd really like to >> > make use of Guix's nice VM features! > > It's not a proper fix, but this patch achieves that on my non-Libreboot > machine. Can you see if it works for you? > > [...] Good news there, that does work and I am able to boot a VM through that route! I would really like to be able to protect myself from accidentally crashing my system by making sure that if /dev/kvm is not there that we don't do --enable-kvm, so maybe I could do that if we can figure out how to make blacklisting actually work. In the meanwhile, maybe I should add a --no-kvm flag to "guix system vm"? ^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#22633: Provide a kvm-less qemu / guix system vm 2016-02-12 18:04 ` Christopher Allan Webber @ 2016-02-13 0:47 ` Leo Famulari 0 siblings, 0 replies; 18+ messages in thread From: Leo Famulari @ 2016-02-13 0:47 UTC (permalink / raw) To: Christopher Allan Webber; +Cc: 22633 On Fri, Feb 12, 2016 at 10:04:47AM -0800, Christopher Allan Webber wrote: > Leo Famulari writes: > > > On Fri, Feb 12, 2016 at 09:50:09AM +1100, Jookia wrote: > >> On Thu, Feb 11, 2016 at 09:26:12AM -0800, Christopher Allan Webber wrote: > >> > So on my Libreboot-enabled machine, KVM does not work. In fact, even > >> > starting qemu with KVM enabled on it appears to crash my whole system. > >> > Not only does "guix system vm" not work, even "guix system vm-image" can > >> > take the whole machine down! > >> > >> Currently the 'solution' I've found is to edit Guix to remove the two instances > >> of '--enable-kvm' which works somewhat, though it's slower as there's absolutely > >> no acceleration. > >> > >> > It would be nice to have a --no-kvm switch, because I'd really like to > >> > make use of Guix's nice VM features! > > > > It's not a proper fix, but this patch achieves that on my non-Libreboot > > machine. Can you see if it works for you? > > > > [...] > > Good news there, that does work and I am able to boot a VM through that > route! > > I would really like to be able to protect myself from accidentally > crashing my system by making sure that if /dev/kvm is not there that we > don't do --enable-kvm, so maybe I could do that if we can figure out how > to make blacklisting actually work. In the meanwhile, maybe I should > add a --no-kvm flag to "guix system vm"? We definitely want to automatically disable KVM if it's not available. But I think it would also be useful to have a --no-kvm option. ^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#22633: Provide a kvm-less qemu / guix system vm 2016-02-11 22:50 ` Jookia 2016-02-12 0:49 ` Leo Famulari @ 2016-02-12 9:02 ` Ludovic Courtès 2016-02-12 17:47 ` Christopher Allan Webber 1 sibling, 1 reply; 18+ messages in thread From: Ludovic Courtès @ 2016-02-12 9:02 UTC (permalink / raw) To: Jookia; +Cc: 22633 Jookia <166291@gmail.com> skribis: > We should probably also blacklist kvm on Libreboot machines too somehow, A simple way to achieve this is with: (operating-system ;; … (kernel-arguments '("modprobe.blacklist=kvm-intel,kvm"))) But I guess ‘guix system vm’ will now fail. We could change the two occurrences of ‘-enable-kvm’ to use this flag if and only if /dev/kvm exists (I think it doesn’t exist when the kvm modules are not loaded.) Thoughts? Ludo’. ^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#22633: Provide a kvm-less qemu / guix system vm 2016-02-12 9:02 ` Ludovic Courtès @ 2016-02-12 17:47 ` Christopher Allan Webber 2016-02-13 19:10 ` Alex Kost 2016-02-21 12:06 ` Ludovic Courtès 0 siblings, 2 replies; 18+ messages in thread From: Christopher Allan Webber @ 2016-02-12 17:47 UTC (permalink / raw) To: Ludovic Courtès; +Cc: 22633 Ludovic Courtès writes: > Jookia <166291@gmail.com> skribis: > >> We should probably also blacklist kvm on Libreboot machines too somehow, > > A simple way to achieve this is with: > > (operating-system > ;; … > (kernel-arguments '("modprobe.blacklist=kvm-intel,kvm"))) I tried this: (operating-system (kernel linux-libre-4.1) (kernel-arguments '("modprobe.blacklist=kvm-intel,kvm")) ...) The generated Grub configuration looks right: menuentry "GNU with Linux-Libre 4.1.17 (alpha)" { search --label --set guix linux /gnu/store/k3l4g22vypwniy0k3f8xha9l8p1s716d-linux-libre-4.1.17/bzImage --root=guix --system=/gnu/store/flq2702dmj6ppqc4iix6xgp0q364yl3l-system --load=/gnu/store/flq2702dmj6ppqc4iix6xgp0q364yl3l-system/boot modprobe.blacklist=kvm-intel,kvm initrd /gnu/store/flq2702dmj6ppqc4iix6xgp0q364yl3l-system/initrd } Unfortunately, after rebooting into it: cwebber@oolong:~$ lsmod | grep kvm kvm_intel 155648 0 kvm 491520 1 kvm_intel cwebber@oolong:~$ ls /dev/kvm /dev/kvm Not sure why it didn't seem to do anything... > But I guess ‘guix system vm’ will now fail. > > We could change the two occurrences of ‘-enable-kvm’ to use this flag if > and only if /dev/kvm exists (I think it doesn’t exist when the kvm > modules are not loaded.) If we could really get kvm blocked, I could write this patch. > Thoughts? > > Ludo’. ^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#22633: Provide a kvm-less qemu / guix system vm 2016-02-12 17:47 ` Christopher Allan Webber @ 2016-02-13 19:10 ` Alex Kost 2016-02-21 12:09 ` Ludovic Courtès 2016-02-21 12:06 ` Ludovic Courtès 1 sibling, 1 reply; 18+ messages in thread From: Alex Kost @ 2016-02-13 19:10 UTC (permalink / raw) To: Christopher Allan Webber; +Cc: 22633 Christopher Allan Webber (2016-02-12 20:47 +0300) wrote: > Ludovic Courtès writes: > >> Jookia <166291@gmail.com> skribis: >> >>> We should probably also blacklist kvm on Libreboot machines too somehow, >> >> A simple way to achieve this is with: >> >> (operating-system >> ;; … >> (kernel-arguments '("modprobe.blacklist=kvm-intel,kvm"))) > > I tried this: > > (operating-system > (kernel linux-libre-4.1) > (kernel-arguments '("modprobe.blacklist=kvm-intel,kvm")) > ...) > > The generated Grub configuration looks right: > > menuentry "GNU with Linux-Libre 4.1.17 (alpha)" { > search --label --set guix > linux /gnu/store/k3l4g22vypwniy0k3f8xha9l8p1s716d-linux-libre-4.1.17/bzImage --root=guix --system=/gnu/store/flq2702dmj6ppqc4iix6xgp0q364yl3l-system --load=/gnu/store/flq2702dmj6ppqc4iix6xgp0q364yl3l-system/boot modprobe.blacklist=kvm-intel,kvm > initrd /gnu/store/flq2702dmj6ppqc4iix6xgp0q364yl3l-system/initrd > } > > Unfortunately, after rebooting into it: > > cwebber@oolong:~$ lsmod | grep kvm > kvm_intel 155648 0 > kvm 491520 1 kvm_intel > cwebber@oolong:~$ ls /dev/kvm > /dev/kvm > > Not sure why it didn't seem to do anything... I had the same issue. Some time ago I tried: (kernel-arguments '("modprobe.blacklist=pcspkr")) but "pcspkr" was also listed in lsmod. -- Alex ^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#22633: Provide a kvm-less qemu / guix system vm 2016-02-13 19:10 ` Alex Kost @ 2016-02-21 12:09 ` Ludovic Courtès 2016-02-23 8:08 ` Alex Kost 0 siblings, 1 reply; 18+ messages in thread From: Ludovic Courtès @ 2016-02-21 12:09 UTC (permalink / raw) To: Alex Kost; +Cc: 22633 Alex Kost <alezost@gmail.com> skribis: > I had the same issue. Some time ago I tried: > > (kernel-arguments '("modprobe.blacklist=pcspkr")) > > but "pcspkr" was also listed in lsmod. I can’t reproduce it. Do you have a system config that exhibits this in ‘guix system vm’? Note that the ‘modprobe pcspkr’ will load the module; you have to use ‘modprobe --use-blacklist pcspkr’ if you want it to honor the black list (which is a questionable default IMO.) Thanks, Ludo’. ^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#22633: Provide a kvm-less qemu / guix system vm 2016-02-21 12:09 ` Ludovic Courtès @ 2016-02-23 8:08 ` Alex Kost 0 siblings, 0 replies; 18+ messages in thread From: Alex Kost @ 2016-02-23 8:08 UTC (permalink / raw) To: Ludovic Courtès; +Cc: 22633 Ludovic Courtès (2016-02-21 15:09 +0300) wrote: > Alex Kost <alezost@gmail.com> skribis: > >> I had the same issue. Some time ago I tried: >> >> (kernel-arguments '("modprobe.blacklist=pcspkr")) >> >> but "pcspkr" was also listed in lsmod. > > I can’t reproduce it. Do you have a system config that exhibits this in > ‘guix system vm’? Oops, my bad. Since I use my own "grub.cfg", obviously it wasn't updated :-) Now I confirm that adding "modprobe.blacklist=pcspkr" argument to 'linux' line works. Sorry for the noize. -- Alex ^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#22633: Provide a kvm-less qemu / guix system vm 2016-02-12 17:47 ` Christopher Allan Webber 2016-02-13 19:10 ` Alex Kost @ 2016-02-21 12:06 ` Ludovic Courtès 2016-02-22 18:56 ` Christopher Allan Webber 1 sibling, 1 reply; 18+ messages in thread From: Ludovic Courtès @ 2016-02-21 12:06 UTC (permalink / raw) To: Christopher Allan Webber; +Cc: 22633 Christopher Allan Webber <cwebber@dustycloud.org> skribis: > I tried this: > > (operating-system > (kernel linux-libre-4.1) > (kernel-arguments '("modprobe.blacklist=kvm-intel,kvm")) > ...) > > The generated Grub configuration looks right: > > menuentry "GNU with Linux-Libre 4.1.17 (alpha)" { > search --label --set guix > linux /gnu/store/k3l4g22vypwniy0k3f8xha9l8p1s716d-linux-libre-4.1.17/bzImage --root=guix --system=/gnu/store/flq2702dmj6ppqc4iix6xgp0q364yl3l-system --load=/gnu/store/flq2702dmj6ppqc4iix6xgp0q364yl3l-system/boot modprobe.blacklist=kvm-intel,kvm > initrd /gnu/store/flq2702dmj6ppqc4iix6xgp0q364yl3l-system/initrd > } > > Unfortunately, after rebooting into it: > > cwebber@oolong:~$ lsmod | grep kvm > kvm_intel 155648 0 > kvm 491520 1 kvm_intel > cwebber@oolong:~$ ls /dev/kvm > /dev/kvm > > Not sure why it didn't seem to do anything... Libkmod honors ‘modprobe.blacklist’ (in ‘kcmdline_parse_result’ in libkmod-config.c) and eudev passes KMOD_PROBE_APPLY_BLACKLIST unconditionally in udev-builtin-kmod.c (meaning it honors it too.) However, there’s a hyphen-vs-underscore issue, I think. Namely, the file is called ‘kvm-intel.ko’, but the normalized module name is ‘kvm_intel’, and this is what libkmod expects (commit 5c7dd5a changes our code to normalize module names similarly.) Could you try with “modprobe.blacklist=kvm_intel”? TIA, Ludo’. ^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#22633: Provide a kvm-less qemu / guix system vm 2016-02-21 12:06 ` Ludovic Courtès @ 2016-02-22 18:56 ` Christopher Allan Webber 2016-02-22 19:35 ` Christopher Allan Webber 0 siblings, 1 reply; 18+ messages in thread From: Christopher Allan Webber @ 2016-02-22 18:56 UTC (permalink / raw) To: Ludovic Courtès; +Cc: 22633 Ludovic Courtès writes: > Libkmod honors ‘modprobe.blacklist’ (in ‘kcmdline_parse_result’ in > libkmod-config.c) and eudev passes KMOD_PROBE_APPLY_BLACKLIST > unconditionally in udev-builtin-kmod.c (meaning it honors it too.) > > However, there’s a hyphen-vs-underscore issue, I think. Namely, the > file is called ‘kvm-intel.ko’, but the normalized module name is > ‘kvm_intel’, and this is what libkmod expects (commit 5c7dd5a changes > our code to normalize module names similarly.) > > Could you try with “modprobe.blacklist=kvm_intel”? I tried it, and it works! This does mean that /dev/kvm doesn't exist, so I should be able to write a patch to Guix that disables kvm for qemu when /dev/kvm is absent. Great! :) ^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#22633: Provide a kvm-less qemu / guix system vm 2016-02-22 18:56 ` Christopher Allan Webber @ 2016-02-22 19:35 ` Christopher Allan Webber 2016-02-22 19:43 ` Jookia 2016-02-22 21:09 ` Ludovic Courtès 0 siblings, 2 replies; 18+ messages in thread From: Christopher Allan Webber @ 2016-02-22 19:35 UTC (permalink / raw) To: Ludovic Courtès; +Cc: 22633 [-- Attachment #1: Type: text/plain, Size: 1050 bytes --] Christopher Allan Webber writes: > Ludovic Courtès writes: > >> Libkmod honors ‘modprobe.blacklist’ (in ‘kcmdline_parse_result’ in >> libkmod-config.c) and eudev passes KMOD_PROBE_APPLY_BLACKLIST >> unconditionally in udev-builtin-kmod.c (meaning it honors it too.) >> >> However, there’s a hyphen-vs-underscore issue, I think. Namely, the >> file is called ‘kvm-intel.ko’, but the normalized module name is >> ‘kvm_intel’, and this is what libkmod expects (commit 5c7dd5a changes >> our code to normalize module names similarly.) >> >> Could you try with “modprobe.blacklist=kvm_intel”? > > I tried it, and it works! This does mean that /dev/kvm doesn't exist, > so I should be able to write a patch to Guix that disables kvm for qemu > when /dev/kvm is absent. Great! :) This is slightly based off of Leo's preliminary patch, so I included him in the copyright headers. I've tested and it works (in terms of disabling kvm if no /dev/kvm is present) here. Let me know if I need to fix something or if I should push... [-- Attachment #2: 0001-vm-Only-pass-enable-kvm-to-qemu-if-dev-kvm-is-presen.patch --] [-- Type: text/x-patch, Size: 3395 bytes --] From 852e0049213a0a80cacdcad4aba13ab242c3fbd8 Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber <cwebber@dustycloud.org> Date: Mon, 22 Feb 2016 11:23:14 -0800 Subject: [PATCH] vm: Only pass "-enable-kvm" to qemu if /dev/kvm is present. * gnu/build/vm.scm (load-in-linux-vm): Only pass "-enable-kvm" flag to qemu if "/dev/kvm" is present. * gnu/system/vm.scm (common-kvm-options): Same as above. --- gnu/build/vm.scm | 19 ++++++++++++++----- gnu/system/vm.scm | 10 +++++++++- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/gnu/build/vm.scm b/gnu/build/vm.scm index a095f9d..823156d 100644 --- a/gnu/build/vm.scm +++ b/gnu/build/vm.scm @@ -1,5 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2013, 2014, 2015 Ludovic Courtès <ludo@gnu.org> +;;; Copyright © 2016 Christopher Allan Webber <cwebber@dustycloud.org> +;;; Copyright © 2016 Leo Famulari <leo@famulari.name> ;;; ;;; This file is part of GNU Guix. ;;; @@ -97,7 +99,7 @@ the #:references-graphs parameter of 'derivation'." (_ #f)) (unless (zero? - (apply system* qemu "-enable-kvm" "-nographic" "-no-reboot" + (apply system* qemu "-nographic" "-no-reboot" "-m" (number->string memory-size) "-net" "nic,model=virtio" "-virtfs" @@ -111,10 +113,17 @@ the #:references-graphs parameter of 'derivation'." "-initrd" initrd "-append" (string-append "console=ttyS0 --load=" builder) - (if make-disk-image? - `("-drive" ,(string-append "file=" image-file - ",if=virtio")) - '()))) + (append + (if make-disk-image? + `("-drive" ,(string-append "file=" image-file + ",if=virtio")) + '()) + ;; Only enable kvm if we see /dev/kvm exists. + ;; This allows uers without hardware virtualization to still use these + ;; commands. + (if (file-exists? "/dev/kvm") + '("-enable-kvm") + '())))) (error "qemu failed" qemu)) (if make-disk-image? diff --git a/gnu/system/vm.scm b/gnu/system/vm.scm index a7c03bd..5235ee3 100644 --- a/gnu/system/vm.scm +++ b/gnu/system/vm.scm @@ -1,5 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2013, 2014, 2015, 2016 Ludovic Courtès <ludo@gnu.org> +;;; Copyright © 2016 Christopher Allan Webber <cwebber@dustycloud.org> +;;; Copyright © 2016 Leo Famulari <leo@famulari.name> ;;; ;;; This file is part of GNU Guix. ;;; @@ -457,7 +459,13 @@ with '-virtfs' options for the host file systems listed in SHARED-FS." "\" ")) #~(string-append - " -enable-kvm -no-reboot -net nic,model=virtio \ + ;; Only enable kvm if we see /dev/kvm exists. + ;; This allows uers without hardware virtualization to still use these + ;; commands. + #$(if (file-exists? "/dev/kvm") + " -enable-kvm " + "") + " -no-reboot -net nic,model=virtio \ " #$@(map virtfs-option shared-fs) " \ -net user \ -serial stdio -vga std \ -- 2.6.3 ^ permalink raw reply related [flat|nested] 18+ messages in thread
* bug#22633: Provide a kvm-less qemu / guix system vm 2016-02-22 19:35 ` Christopher Allan Webber @ 2016-02-22 19:43 ` Jookia 2016-02-22 21:27 ` Christopher Allan Webber 2016-02-22 21:09 ` Ludovic Courtès 1 sibling, 1 reply; 18+ messages in thread From: Jookia @ 2016-02-22 19:43 UTC (permalink / raw) To: Christopher Allan Webber; +Cc: 22633 On Mon, Feb 22, 2016 at 11:35:30AM -0800, Christopher Allan Webber wrote: > #~(string-append > - " -enable-kvm -no-reboot -net nic,model=virtio \ > + ;; Only enable kvm if we see /dev/kvm exists. > + ;; This allows uers without hardware virtualization to still use these > + ;; commands. > + #$(if (file-exists? "/dev/kvm") > + " -enable-kvm " > + "") > + " -no-reboot -net nic,model=virtio \ > " #$@(map virtfs-option shared-fs) " \ > -net user \ > -serial stdio -vga std \ > -- > 2.6.3 What if I enable KVM then run the script? Jookia. ^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#22633: Provide a kvm-less qemu / guix system vm 2016-02-22 19:43 ` Jookia @ 2016-02-22 21:27 ` Christopher Allan Webber 0 siblings, 0 replies; 18+ messages in thread From: Christopher Allan Webber @ 2016-02-22 21:27 UTC (permalink / raw) To: Jookia; +Cc: 22633 Jookia writes: > On Mon, Feb 22, 2016 at 11:35:30AM -0800, Christopher Allan Webber wrote: >> #~(string-append >> - " -enable-kvm -no-reboot -net nic,model=virtio \ >> + ;; Only enable kvm if we see /dev/kvm exists. >> + ;; This allows uers without hardware virtualization to still use these >> + ;; commands. >> + #$(if (file-exists? "/dev/kvm") >> + " -enable-kvm " >> + "") >> + " -no-reboot -net nic,model=virtio \ >> " #$@(map virtfs-option shared-fs) " \ >> -net user \ >> -serial stdio -vga std \ >> -- >> 2.6.3 > > What if I enable KVM then run the script? > > Jookia. Then it should use KVM. ^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#22633: Provide a kvm-less qemu / guix system vm 2016-02-22 19:35 ` Christopher Allan Webber 2016-02-22 19:43 ` Jookia @ 2016-02-22 21:09 ` Ludovic Courtès 2016-02-22 21:30 ` Christopher Allan Webber 1 sibling, 1 reply; 18+ messages in thread From: Ludovic Courtès @ 2016-02-22 21:09 UTC (permalink / raw) To: Christopher Allan Webber; +Cc: 22633 Christopher Allan Webber <cwebber@dustycloud.org> skribis: > Christopher Allan Webber writes: > >> Ludovic Courtès writes: >> >>> Libkmod honors ‘modprobe.blacklist’ (in ‘kcmdline_parse_result’ in >>> libkmod-config.c) and eudev passes KMOD_PROBE_APPLY_BLACKLIST >>> unconditionally in udev-builtin-kmod.c (meaning it honors it too.) >>> >>> However, there’s a hyphen-vs-underscore issue, I think. Namely, the >>> file is called ‘kvm-intel.ko’, but the normalized module name is >>> ‘kvm_intel’, and this is what libkmod expects (commit 5c7dd5a changes >>> our code to normalize module names similarly.) >>> >>> Could you try with “modprobe.blacklist=kvm_intel”? >> >> I tried it, and it works! This does mean that /dev/kvm doesn't exist, >> so I should be able to write a patch to Guix that disables kvm for qemu >> when /dev/kvm is absent. Great! :) > > This is slightly based off of Leo's preliminary patch, so I included him > in the copyright headers. I've tested and it works (in terms of > disabling kvm if no /dev/kvm is present) here. Cool! Can you just double-check whether -enable-kvm has any effect when /dev/kvm is missing? If it has no effect when /dev/kvm is missing, then we don’t even need a patch. > Let me know if I need to fix something or if I should push... > > From 852e0049213a0a80cacdcad4aba13ab242c3fbd8 Mon Sep 17 00:00:00 2001 > From: Christopher Allan Webber <cwebber@dustycloud.org> > Date: Mon, 22 Feb 2016 11:23:14 -0800 > Subject: [PATCH] vm: Only pass "-enable-kvm" to qemu if /dev/kvm is present. > > * gnu/build/vm.scm (load-in-linux-vm): Only pass "-enable-kvm" flag to qemu > if "/dev/kvm" is present. > * gnu/system/vm.scm (common-kvm-options): Same as above. [...] > + ;; Only enable kvm if we see /dev/kvm exists. > + ;; This allows uers without hardware virtualization to still use these ^^ Typo. [...] > + ;; Only enable kvm if we see /dev/kvm exists. > + ;; This allows uers without hardware virtualization to still use these Ditto. Otherwise the patch LGTM. Make sure to mention: Fixes <http://bugs.gnu.org/22633>. in the commit log. Thanks, Ludo’. ^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#22633: Provide a kvm-less qemu / guix system vm 2016-02-22 21:09 ` Ludovic Courtès @ 2016-02-22 21:30 ` Christopher Allan Webber 2016-02-23 16:13 ` Ludovic Courtès 0 siblings, 1 reply; 18+ messages in thread From: Christopher Allan Webber @ 2016-02-22 21:30 UTC (permalink / raw) To: Ludovic Courtès; +Cc: 22633-done Ludovic Courtès writes: > Christopher Allan Webber <cwebber@dustycloud.org> skribis: > >> Christopher Allan Webber writes: >> >>> Ludovic Courtès writes: >>> >>>> Libkmod honors ‘modprobe.blacklist’ (in ‘kcmdline_parse_result’ in >>>> libkmod-config.c) and eudev passes KMOD_PROBE_APPLY_BLACKLIST >>>> unconditionally in udev-builtin-kmod.c (meaning it honors it too.) >>>> >>>> However, there’s a hyphen-vs-underscore issue, I think. Namely, the >>>> file is called ‘kvm-intel.ko’, but the normalized module name is >>>> ‘kvm_intel’, and this is what libkmod expects (commit 5c7dd5a changes >>>> our code to normalize module names similarly.) >>>> >>>> Could you try with “modprobe.blacklist=kvm_intel”? >>> >>> I tried it, and it works! This does mean that /dev/kvm doesn't exist, >>> so I should be able to write a patch to Guix that disables kvm for qemu >>> when /dev/kvm is absent. Great! :) >> >> This is slightly based off of Leo's preliminary patch, so I included him >> in the copyright headers. I've tested and it works (in terms of >> disabling kvm if no /dev/kvm is present) here. > > Cool! Can you just double-check whether -enable-kvm has any effect when > /dev/kvm is missing? If it has no effect when /dev/kvm is missing, then > we don’t even need a patch. I checked yes; qemu fails. >> Let me know if I need to fix something or if I should push... >> >> From 852e0049213a0a80cacdcad4aba13ab242c3fbd8 Mon Sep 17 00:00:00 2001 >> From: Christopher Allan Webber <cwebber@dustycloud.org> >> Date: Mon, 22 Feb 2016 11:23:14 -0800 >> Subject: [PATCH] vm: Only pass "-enable-kvm" to qemu if /dev/kvm is present. >> >> * gnu/build/vm.scm (load-in-linux-vm): Only pass "-enable-kvm" flag to qemu >> if "/dev/kvm" is present. >> * gnu/system/vm.scm (common-kvm-options): Same as above. > > [...] > >> + ;; Only enable kvm if we see /dev/kvm exists. >> + ;; This allows uers without hardware virtualization to still use these > ^^ > Typo. > > [...] > >> + ;; Only enable kvm if we see /dev/kvm exists. >> + ;; This allows uers without hardware virtualization to still use these > > Ditto. Okay, fixed those. > Otherwise the patch LGTM. Make sure to mention: > > Fixes <http://bugs.gnu.org/22633>. > > in the commit log. Mentioned, committed, pushed! ^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#22633: Provide a kvm-less qemu / guix system vm 2016-02-22 21:30 ` Christopher Allan Webber @ 2016-02-23 16:13 ` Ludovic Courtès 0 siblings, 0 replies; 18+ messages in thread From: Ludovic Courtès @ 2016-02-23 16:13 UTC (permalink / raw) To: Christopher Allan Webber; +Cc: 22633-done Christopher Allan Webber <cwebber@dustycloud.org> skribis: > Mentioned, committed, pushed! Thanks! Ludo'. ^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2016-02-23 16:15 UTC | newest] Thread overview: 18+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2016-02-11 17:26 bug#22633: Provide a kvm-less qemu / guix system vm Christopher Allan Webber 2016-02-11 22:50 ` Jookia 2016-02-12 0:49 ` Leo Famulari 2016-02-12 18:04 ` Christopher Allan Webber 2016-02-13 0:47 ` Leo Famulari 2016-02-12 9:02 ` Ludovic Courtès 2016-02-12 17:47 ` Christopher Allan Webber 2016-02-13 19:10 ` Alex Kost 2016-02-21 12:09 ` Ludovic Courtès 2016-02-23 8:08 ` Alex Kost 2016-02-21 12:06 ` Ludovic Courtès 2016-02-22 18:56 ` Christopher Allan Webber 2016-02-22 19:35 ` Christopher Allan Webber 2016-02-22 19:43 ` Jookia 2016-02-22 21:27 ` Christopher Allan Webber 2016-02-22 21:09 ` Ludovic Courtès 2016-02-22 21:30 ` Christopher Allan Webber 2016-02-23 16:13 ` Ludovic Courtès
Code repositories for project(s) associated with this public inbox https://git.savannah.gnu.org/cgit/guix.git This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).