Software Archive
Read-only legacy content
17061 Discussions

What is the right ways to enable VMX root and load VM.



I am working a Linux kernel module to test VMX operations. 

The kernel module defines some Linux filesystem APIs which can be used by user space to start VMX operation. Here is the main sequence.

In Dev_open(), VMXe in CR4 is set to all online CPUs. And call VMXON, VMXPTRCLEAR, VMXPTRLD, VMXwrite to populate VMCS.

In Dev_Ioctl(), VMXON, VMXPTRLD, and VMLaunch or VMReume based on VM's state.

In Dev_release(), VMXOFF is called.

With this design, i always hit an error of 'invalid host state' when VMLaunch is called for the first time. Subsequent calls of VMlaunch or VMResume did NOT hit this issue.

I am suspecting if I missed something of VMX operations. 

In stackoverflow, there was a post to say VMXe bit is not persistent in Linux.

I hit this issue also, and I am studying it.



0 Kudos
0 Replies