On Sun, Apr 14, 2013 at 1:48 PM, Jan Kiszka <jan.kiszka@xxxxxx> wrote: > On 2013-04-13 20:24, Mohit Dhingra wrote: >> Hi All, >> >> I am Mohit Dhingra, planning to work in GSoC project "Improve nested >> virtualization support for x86". I got in touch with Jan >> (jan.kiszka@xxxxxx) few days back. >> >> As suggested by him, I am trying to write a simple unit test which >> tests the "vmx" functions. To start with, I have written a small code >> which checks whether "vmx" functionality is available on the current >> processor or not[1]. >> >> I have used "cpuid" to check the VMX functionality. Before executing >> cpuid, eax is set to 1. cpuid then puts the feature flags in ecx and >> edx registers. Bit5 in ecx register tells whether VMX feature is >> present or not. I am attaching the patch along with this mail. > > Hint regarding assembly usage: Try to minimize the number of > instructions. Check, e.g., how the kernel implements cpuid. Result > evaluation can perfectly be done in C. > >> >> But there is a problem that I am facing. CPUID behaves differently >> when I run it using qemu-kvm, and when I run it directly in user mode. >> Please check the below output. It would be great if someone can >> please help me out. > > To enable nested VMX, you need to tweak two things: first, you need > nested=1 as parameter for kvm_intel. And, second, you have to select a > CPU type via QEMU (-cpu) that supports VMX or explicitly add that > feature to the selected CPU (-cpu ...,+vmx). In addendum to Jan's above info, I posted some notes here while testing it on Fedora, see if its any helpful: - http://kashyapc.wordpress.com/tag/nested-virtualization/ - https://github.com/kashyapc/nested-virt-notes-intel-f18 > > By default, only core[2]duo and the synthetic KVM type "host" come with > VMX enabled, not much more modern Intel CPU like Nehalem or SandyBridge. > That's inconsistent, and if you want to fix something in QEMU, you could > check which CPU types in qemu/target-i386/cpu.c lack the flag and post a > patch to change this. > > Jan > -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html