VirtualBox

Changeset 74616 in vbox for trunk/src


Ignore:
Timestamp:
Oct 4, 2018 3:53:02 PM (6 years ago)
Author:
vboxsync
Message:

NEM/win: doc updates. bugref:9044

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR3/NEMR3Native-win.cpp

    r74606 r74616  
    19661966 *
    19671967 * On Windows the Hyper-V root partition (dom0 in zen terminology) does not have
    1968  * nested VT-x or AMD-V capabilities.  For a while raw-mode worked inside it,
    1969  * but for a while now we've been getting \#GP when trying to modify CR4 in the
     1968 * nested VT-x or AMD-V capabilities.  Early on raw-mode worked inside it, but
     1969 * for a while now we've been getting \#GPs when trying to modify CR4 in the
    19701970 * world switcher.  So, when Hyper-V is active on Windows we have little choice
    19711971 * but to use Hyper-V to run our VMs.
     
    19751975 *
    19761976 * Since Windows 10 build 17083 there is a documented API for managing Hyper-V
    1977  * VMs, header file WinHvPlatform.h and implementation in WinHvPlatform.dll.
     1977 * VMs: header file WinHvPlatform.h and implementation in WinHvPlatform.dll.
    19781978 * This interface is a wrapper around the undocumented Virtualization
    19791979 * Infrastructure Driver (VID) API - VID.DLL and VID.SYS.  The wrapper is
     
    19871987 * WHvSetPartitionProperty.  Since the VID API is just a very thin wrapper
    19881988 * around CreateFile and NtDeviceIoControlFile, it returns an actual HANDLE for
    1989  * the partition WinHvPlatform.  We fish this HANDLE out of the WinHvPlatform
     1989 * the partition to WinHvPlatform.  We fish this HANDLE out of the WinHvPlatform
    19901990 * partition structures because we need to talk directly to VID for reasons
    19911991 * we'll get to in a bit.  (Btw. we could also intercept the CreateFileW or
     
    20002000 * WinHvRunVpDispatchLoop().  When for instance a VMEXIT is encountered, hyper-V
    20012001 * sends a message that the WHvRunVirtualProcessor API retrieves (and later
    2002  * acknowledges) via VidMessageSlotHandleAndGetNext.  It should be noteded that
    2003  * WHvDeleteVirtualProcessor doesn't do much as there seems to be no partner
    2004  * function VidMessagesSlotMap that reverses what it did.
     2002 * acknowledges) via VidMessageSlotHandleAndGetNext.   Since or about build
     2003 * 17757 a register page is also mapped into user space when creating the
     2004 * virtual CPU.  It should be noteded that WHvDeleteVirtualProcessor doesn't do
     2005 * much as there seems to be no partner function VidMessagesSlotMap that
     2006 * reverses what it did.
    20052007 *
    20062008 * Memory is managed thru calls to WHvMapGpaRange and WHvUnmapGpaRange (GPA does
     
    20112013 * of ranges are limited and probably their total size as well.  Obviously
    20122014 * VID.SYS keeps track of the ranges, but so does WinHvPlatform, which means
    2013  * there is a bit of overhead involved and quota restrctions makes sense.  For
    2014  * some reason though, regions are lazily mapped on VMEXIT/memory by
    2015  * WHvRunVirtualProcessor.
    2016  *
    2017  * Running guest code is done thru the WHvRunVirtualProcessor function.  It
     2015 * there is a bit of overhead involved and quota restrctions makes sense.
     2016 *
     2017 * Running guest code is done through the WHvRunVirtualProcessor function.  It
    20182018 * asynchronously starts or resumes hyper-V CPU execution and then waits for an
    20192019 * VMEXIT message.  Hyper-V / VID.SYS will return information about the message
     
    20222022 *
    20232023 * Other threads can interrupt the execution by using WHvCancelVirtualProcessor,
    2024  * which which case the thread in WHvRunVirtualProcessor is woken up via a dummy
    2025  * QueueUserAPC and will call VidStopVirtualProcessor to asynchronously end
    2026  * execution.  The stop CPU call not immediately succeed if the CPU encountered
    2027  * a VMEXIT before the stop was processed, in which case the VMEXIT needs to be
    2028  * processed first, and the pending stop will be processed in a subsequent call
    2029  * to WHvRunVirtualProcessor.
     2024 * which since or about build 17757 uses VidMessageSlotHandleAndGetNext to do
     2025 * the work (earlier builds would open the waiting thread, do a dummy
     2026 * QueueUserAPC on it, and let it upon return use VidStopVirtualProcessor to
     2027 * do the actual stopping).  While there is certainly a race between cancelation
     2028 * and the CPU causing a natural VMEXIT, it is not known whether this still
     2029 * causes extra work on subsequent WHvRunVirtualProcessor calls (it did in and
     2030 * earlier 17134).
    20302031 *
    20312032 * Registers are retrieved and set via WHvGetVirtualProcessorRegisters and
     
    20702071 *   packed.
    20712072 *
    2072  *   Update: Somewhere along the security fixes or/and microcode updates this
    2073  *   summer (2018), performance dropped even more.
     2073 *   Update: Security fixes during the summer of 2018 caused the performance to
     2074 *   dropped even more.
    20742075 *
    20752076 *   Update [build 17757]: Some performance improvements here, but they don't
     
    21112112 *   with the replacement code.  By spurious returns we mean that the
    21122113 *   subsequent call to WHvRunVirtualProcessor would return immediately.
     2114 *
     2115 *   Update [build 17757]: New cancelation code might have addressed this, but
     2116 *   haven't had time to test it yet.
    21132117 *
    21142118 *
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette