wbenny / hvpp

hvpp is a lightweight Intel x64/VT-x hypervisor written in C++ focused primarily on virtualization of already running operating system
MIT License
1.12k stars 221 forks source link

EPT lags out PC; while it's working on VM #37

Open arnerak opened 5 years ago

arnerak commented 5 years ago

Sorry to bother again. Enabling EPT (and only mapping identity) severely degrades system performance when run on my PC. I also noticed the "System Interrupts" process occasionally has high CPU load (~20%) when hvpp is running. I don't have this issue on VMWare. What could be the cause of this?

arnerak commented 5 years ago

Just to clarify, this happens with both unmodified hvppdrv and hvppdrv_c. Commenting out these lines "fixes" the issue, however I'm dependant on EPT functionality. https://github.com/wbenny/hvpp/blob/master/src/hvppdrv/vmexit_custom.cpp#L14-L15

syslaz commented 4 years ago

Any fixes for this issue? I'm having the same problem on different machines.

syslaz commented 4 years ago

Can confirm on two separate systems that while HVPP is running, System Interrupts jumps to ~11% on one, and on another ~18%. On my personal it stays at ~0% no issues.

syslaz commented 4 years ago

It seems that disabling KVAShadowing seems to fix this completely. No idea why it does so.

syslaz commented 4 years ago

After some investigating I've come to close to a conclusion that this is being caused only on Intels 5th generation and older, more than likely related to changes to the MM_PAUSE instruction latency in the newer generations. It seems that there is a deadlock happening related to the spinlock used in the hypervisor memory allocator. I have no idea what the actual cause is but creating an allocator per CPU to remove the spinlock seems to help tremendously. Still seems there's a deeper issue going on.