Hello,
I'm trying to get the Android Emulator to run inside a kvm vm on CentOS-6. Apparently the latest Android Emulators cannot run without hardware acceleration so I am trying to get the vm to see the svm cpu flag.
Host: $ grep model\ name /proc/cpuinfo | sort -u model name : AMD Phenom(tm) II X4 965 Processor
$ grep svm /proc/cpuinfo | sort -u flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm 3dnowext 3dnow constant_tsc rep_good nonstop_tsc extd_apicid pni monitor cx16 popcnt lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt npt lbrv svm_lock nrip_save
$ cat /sys/module/kvm_amd/parameters/nested 1
I have tried copying the cpu options (Opteron_G3) in the host cpu configuration and setting the svm flag to either "model", "required" or "force" to no avail:
$ ps waux | grep qemu qemu 7962 7.2 21.9 3722092 2680668 ? Rl 13:23 6:36 /usr/libexec/qemu-kvm -name C7-Android -S -M rhel6.6.0 -cpu Opteron_G3,+invtsc,+wdt,+skinit,+ibs,+osvw,+3dnowprefetch,+cr8legacy, +extapic,+cmp_legacy,+3dnow,+3dnowext,+pdpe1gb,+fxsr_opt,+mmxext,+ht, +vme -enable-kvm -m 3072 -realtime mlock=off -smp <snip>
So the question is: How do I enable the svm flag in the guest?
Regards, Leonard.
Hi,
On Fri, 2016-09-23 at 15:05 +0200, Leonard den Ottolander wrote:
So the question is: How do I enable the svm flag in the guest?
The qemu-kvm option "-enable-nesting" that I dug up in the source looks promising. No mention in the man page on either C6 or C7 but it is mentioned here: https://www.redhat.com/archives/libvir-list/2012-October/msg01138.html
How do I pass the "-enable-nesting" option to qemu-kvm using either virt-manager.py, virsh or the domain xml?
Hoping to avoid having to patch the source a such:
--- qemu-kvm-0.12.1.2.000/target-i386/helper.c 2009-12-29 21:46:34.000000000 +0100 +++ qemu-kvm-0.12.1.2/target-i386/helper.c 2016-09-25 16:35:02.984334623 +0200 @@ -1811,8 +1811,10 @@ void cpu_x86_cpuid(CPUX86State *env, uin /* disable CPU features that KVM cannot support */
/* svm */ +/* if (!kvm_nested) *ecx &= ~CPUID_EXT3_SVM; +*/ /* 3dnow */ *edx &= ~0xc0000000; } else {
Regards, Leonard.
On Sun, Sep 25, 2016 at 04:38:39PM +0200, Leonard den Ottolander wrote:
The qemu-kvm option "-enable-nesting" that I dug up in the source looks promising. No mention in the man page on either C6 or C7 but it is mentioned here: https://www.redhat.com/archives/libvir-list/2012-October/msg01138.html
How do I pass the "-enable-nesting" option to qemu-kvm using either virt-manager.py, virsh or the domain xml?
I saw this in the RHEL 7.3 beta release notes:
https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7-Bet...
Nested Virtualization will be a tech preview in RHEL 7.3 Beta, and so it'll be available after RHEL 7.3 is released and CentOS rebuilds it.
Hello Jonathan,
On Sun, 2016-09-25 at 10:46 -0400, Jonathan Billings wrote:
On Sun, Sep 25, 2016 at 04:38:39PM +0200, Leonard den Ottolander wrote:
How do I pass the "-enable-nesting" option to qemu-kvm using either virt-manager.py, virsh or the domain xml?
I saw this in the RHEL 7.3 beta release notes:
https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7-Bet...
Nested Virtualization will be a tech preview in RHEL 7.3 Beta, and so it'll be available after RHEL 7.3 is released and CentOS rebuilds it.
Right. The fact that this has been lingering in the source for years on end and only now is being announced as a tech preview seems to answer my question in the sense that "no this is not possible" :S .
Guess I'll have to fire up my build vm then and see if nuking that test for "kvm_nested" allows me to pass the svm cpu flag from a C6 host.
Regards, Leonard.
On 25 September 2016 at 17:57, Leonard den Ottolander >>
Nested Virtualization will be a tech preview in RHEL 7.3 Beta, and so it'll be available after RHEL 7.3 is released and CentOS rebuilds it.
Officially its gonna be tech-preview in 7.3, but I can tell you we've been successfully using it for testing oVirt since 7.1... (For el7 on top of el7, see [1] for setup example)
YMMV though, we only tested with intel CPUs so far...
[1]: http://lago.readthedocs.io/en/stable/README.html#virtualization-and-nested-v...
Hello Barak,
On Mon, 2016-09-26 at 18:53 +0300, Barak Korren wrote:
On 25 September 2016 at 17:57, Leonard den Ottolander >>
Nested Virtualization will be a tech preview in RHEL 7.3 Beta, and so it'll be available after RHEL 7.3 is released and CentOS rebuilds it.
Officially its gonna be tech-preview in 7.3, but I can tell you we've been successfully using it for testing oVirt since 7.1... (For el7 on top of el7, see [1] for setup example)
YMMV though, we only tested with intel CPUs so far...
Thanks for pointing this out. It seems I do not have to wait for the release of 7.3 to get this to work.
Using "host-passthrough" as the vm cpu type after enabling nested virtualization for my AMD Opteron on a pristine CentOS-7.2 system indeed passes the svm cpu flag and /dev/kvm to the guest. I haven't actually installed Android Studio yet, but I am quite confident the emulator will work. This is a compelling reason to update my desktop from C6 to C7. Hadn't planned on that for a few more years but oh well... :)
Regards, Leonard.
I ran into this issue as well so make a blog post about my efforts https://www.thegoldfish.org/2017/04/nested-virtualization-in-centos-6/
Summary is I needed to add a pass through command in libvirt to get qemu to start with the enable-nesting option
https://libvirt.org/drvqemu.html#qemucommand
-- View this message in context: http://centos.1050465.n5.nabble.com/CentOS-How-to-enable-the-svm-cpu-flag-in... Sent from the CentOS mailing list archive at Nabble.com.
Hi,
On Sun, 2016-09-25 at 10:46 -0400, Jonathan Billings wrote:
Nested Virtualization will be a tech preview in RHEL 7.3 Beta, and so it'll be available after RHEL 7.3 is released and CentOS rebuilds it.
Gave the beta a try. The option "nested" for AMD cpu's is no longer automatically set. You have to either add kvm-amd.nested=1 on the kernel boot line or configure modprobe:
echo "options kvm-amd nested=1" >> /etc/modprobe.d/kvm_amd.conf
Configure the guest to use "host-passthrough" as the cpu type. Using "host-model" (copy host cpu) did not work for me. /dev/kvm wasn't available.
I haven't installed Android Studio yet, but since both the svm cpu flag and /dev/kvm seem to be available I expect the Android Emulator to work inside the vm.
Enjoy, Leonard.