Nested virtualization with KVM: -enable-kvm in qemu in nested virtualization

In my already virtualized host, trying to pass an option to an option -enable-kvm -m 1024will fail:

qemu-system-x86_64  -vga std -enable-kvm -m 1024   -monitor telnet:localhost:9313,server,nowait -drive file=my_img.img,cache=none
# Could not access KVM kernel module: No such file or directory
# failed to initialize KVM: No such file or directory

If I remove this option -enable-kvm -m 1024, qemu will load (but it will take forever because it uses software emulation):

qemu-system-x86_64  -vga std  -monitor telnet:localhost:9313,server,nowait -drive file=my_img.img,cache=none
# qemu running, OK, but image taking forever to load.

Of course, this virtualized node of mine has the ability to integrate its virtualization. Everywhere I find information about it [like here: https://docs.openstack.org/developer/devstack/guides/devstack-with-nested-kvm.html ] tells me that I should check the file /sys/module/kvm_intel/parameters/nested, which is simply inaccessible, because which kvm-intelcannot and cannot be loaded from within the image:

sudo modprobe  kvm-intel
# modprobe: ERROR: could not insert 'kvm_intel': Operation not supported

, . , ( ) kvm kvm?

:

lscpu # from inside the virtualized host
# Architecture:          x86_64
# ...
# Vendor ID:             GenuineIntel
# CPU family:            6
# Model:                 13
# Model name:            QEMU Virtual CPU version (cpu64-rhel6)
# Stepping:              3 
# ...
# Hypervisor vendor:     KVM

ltrace qemu:

# open64("/dev/kvm", 524290, 00)                   = -1
# __errno_location()                               = 0x7f958673c730
# __fprintf_chk(0x7f957fd81060, 1, 0x7f9586474ce0, 0Could not access KVM kernel module: No such file or directory
+8
2

, kvm (.. ):

grep -E "(vmx|svm)" /proc/cpuinfo 
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 constant_tsc rep_good nopl nonstop_tsc extd_apicid aperfmperf pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 popcnt aes xsave avx f16c lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs xop skinit wdt lwp fma4 tce tbm topoext perfctr_core perfctr_nb arat cpb hw_pstate npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold vmmcall bmi1

:

grep -E "(vmx|svm)" /proc/cpuinfo | wc -l 
0

, , enable-kvm . .

+5

Linux KVM .

( ). , Intel:

# rmmod kvm_intel
# modprobe kvm_intel nested=1

( ):

$ cat /sys/module/kvm_intel/parameters/nested
Y

( KVM AMD kvm_amd.)

/etc/modprobe.d.

. , QEMU , CPU, :

-cpu host

- , :

-cpu Haswell-noTSX-IBRS,vmx=on

:

$ grep -o 'vmx\|svm' /proc/cpuinfo
$ kvm-ok
INFO: /dev/kvm exists
KVM acceleration can be used
0

Source: https://habr.com/ru/post/1017218/


All Articles