VirtualBox

Changeset 72300 in vbox for trunk/include/iprt


Ignore:
Timestamp:
May 23, 2018 3:13:06 PM (7 years ago)
Author:
vboxsync
Message:

NEM,STAM: Partition memory statistics for NEM. bugref:9044

  • STAM: Redid the way we handle statistics requiring fetching data from ring-0 (or elsewhere) by introducing a refresh group concept. We'll refresh the statistics for a group if needed and only once per enumeration/query. There's a new registration API for these.
  • NEM: Added memory balance statistics for the partition. Some failed fumbling thru VID.DLL/SYS, before realizing that hypercall is the only way to get at them.
  • NEM: Added a hypervisor input/output page buffer for non-EMT threads so we can get statistics. Put the related data and code into separate structure to save duplication.
Location:
trunk/include/iprt/nt
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/nt/hyperv.h

    r72262 r72300  
    327327
    328328
     329/** Hyper-V NUMA node ID.
     330 * On systems without NUMA, i.e. a single node, it uses 0 as identifier.  */
     331typedef uint32_t HV_PROXIMITY_DOMAIN_ID;
     332/** Pointer to NUMA node ID. */
     333typedef HV_PROXIMITY_DOMAIN_ID *PHV_PROXIMITY_DOMAIN_ID;
     334
     335/** Hyper-V NUMA flags. */
     336typedef struct
     337{
     338    uint32_t    ProximityPreferred      : 1;    /**< When set, allocations may come from other NUMA nodes.  */
     339    uint32_t    Reserved                : 30;   /**< Reserved for future (as of circa v2). */
     340    uint32_t    ProxyimityInfoValid     : 1;    /**< Set if the NUMA information is valid. */
     341} HV_PROXIMITY_DOMAIN_FLAGS;
     342/** Pointer to Hyper-V NUMA flags. */
     343typedef HV_PROXIMITY_DOMAIN_FLAGS *PHV_PROXIMITY_DOMAIN_FLAGS;
     344
     345/** Hyper-V NUMA information. */
     346typedef struct
     347{
     348    HV_PROXIMITY_DOMAIN_ID      Id;             /**< NUMA node identifier.  */
     349    HV_PROXIMITY_DOMAIN_FLAGS   Flags;          /**< NUMA flags. */
     350} HV_PROXIMITY_DOMAIN_INFO;
     351/** Pointer to Hyper-V NUMA information. */
     352typedef HV_PROXIMITY_DOMAIN_INFO *PHV_PROXIMITY_DOMAIN_INFO;
     353
     354/** Input for HvCallGetMemoryBalance. */
     355typedef struct
     356{
     357    HV_PARTITION_ID             TargetPartitionId;
     358    HV_PROXIMITY_DOMAIN_INFO    ProximityDomainInfo;
     359} HV_INPUT_GET_MEMORY_BALANCE;
     360AssertCompileSize(HV_INPUT_GET_MEMORY_BALANCE, 16);
     361/** Pointer to the input for HvCallGetMemoryBalance. */
     362typedef HV_INPUT_GET_MEMORY_BALANCE *PHV_INPUT_GET_MEMORY_BALANCE;
     363
     364/** Output for HvCallGetMemoryBalance. */
     365typedef struct
     366{
     367    uint64_t                    PagesAvailable;
     368    uint64_t                    PagesInUse;
     369} HV_OUTPUT_GET_MEMORY_BALANCE;
     370/** Pointer to the output for HvCallGetMemoryBalance. */
     371typedef HV_OUTPUT_GET_MEMORY_BALANCE *PHV_OUTPUT_GET_MEMORY_BALANCE;
     372
     373
    329374/** @name Flags used with HvCallMapGpaPages and HvCallMapSparseGpaPages.
    330375 * @note There seems to be a more flags defined after v2.
     
    10531098
    10541099
    1055 /** Input for HvCallGetVpRegister. */
     1100/** Input for HvCallGetVpRegisters. */
    10561101typedef struct
    10571102{
     
    10641109} HV_INPUT_GET_VP_REGISTERS;
    10651110AssertCompileMemberOffset(HV_INPUT_GET_VP_REGISTERS, Names, 16);
    1066 /** Pointer to input for HvCallGetVpRegister. */
     1111/** Pointer to input for HvCallGetVpRegisters. */
    10671112typedef HV_INPUT_GET_VP_REGISTERS *PHV_INPUT_GET_VP_REGISTERS;
    1068 /* Output for HvCallGetVpRegister is an array of HV_REGISTER_VALUE parallel to HV_INPUT_GET_VP_REGISTERS::Names. */
    1069 
    1070 
    1071 /** Register and value pair for HvCallSetVpRegister. */
     1113/* Output for HvCallGetVpRegisters is an array of HV_REGISTER_VALUE parallel to HV_INPUT_GET_VP_REGISTERS::Names. */
     1114
     1115
     1116/** Register and value pair for HvCallSetVpRegisters. */
    10721117typedef struct
    10731118{
     
    10791124AssertCompileSize(HV_REGISTER_ASSOC, 32);
    10801125AssertCompileMemberOffset(HV_REGISTER_ASSOC, Value, 16);
    1081 /** Pointer to a register and value pair for HvCallSetVpRegister. */
     1126/** Pointer to a register and value pair for HvCallSetVpRegisters. */
    10821127typedef HV_REGISTER_ASSOC *PHV_REGISTER_ASSOC;
    10831128/** Helper for clearing the alignment padding members. */
     
    10881133    do { (a_pRegAssoc)->Pad0 = 0; (a_pRegAssoc)->Pad1 = 0; (a_pRegAssoc)->Value.Reg128.High64 = 0; } while (0)
    10891134
    1090 /** Input for HvCallSetVpRegister. */
     1135/** Input for HvCallSetVpRegisters. */
    10911136typedef struct
    10921137{
     
    10981143} HV_INPUT_SET_VP_REGISTERS;
    10991144AssertCompileMemberOffset(HV_INPUT_SET_VP_REGISTERS, Elements, 16);
    1100 /** Pointer to input for HvCallSetVpRegister. */
     1145/** Pointer to input for HvCallSetVpRegisters. */
    11011146typedef HV_INPUT_SET_VP_REGISTERS *PHV_INPUT_SET_VP_REGISTERS;
    11021147
  • trunk/include/iprt/nt/vid.h

    r71136 r72300  
    165165 * put (??) it into that memory mapping.
    166166 *
    167  * @returns Success indicator (details in LastStatusValue and LastErrorValue).
     167 * @returns Success indicator (details in LastErrorValue).
    168168 *
    169169 * @param   hPartition  The partition handle.
     
    205205 * build 17101: eb vid+12180 0f 84 98 00 00 00
    206206 *
    207  * @retval STATUS_NOT_IMPLEMENTED
     207 * @retval  ERROR_NOT_IMPLEMENTED
     208 *
     209 * @remarks VidExoFastIoControlPartition probably disapproves of this too.  It
     210 *          could be very handy for debugging upon occation.
    208211 */
    209212DECLIMPORT(BOOL) VIDAPI VidGetVirtualProcessorRunningStatus(VID_PARTITION_HANDLE hPartition, HV_VP_INDEX iCpu,
    210213                                                            VID_PROCESSOR_STATUS *penmStatus);
    211214
    212 
     215/**
     216 * For query virtual processor registers and other state information.
     217 *
     218 * @returns Success indicator (details in LastErrorValue).
     219 */
    213220DECLIMPORT(BOOL) VIDAPI VidGetVirtualProcessorState(VID_PARTITION_HANDLE hPartition, HV_VP_INDEX iCpu,
    214221                                                    HV_REGISTER_NAME const *paRegNames, uint32_t cRegisters,
    215222                                                    HV_REGISTER_VALUE *paRegValues);
    216223
     224/**
     225 * For setting virtual processor registers and other state information.
     226 *
     227 * @returns Success indicator (details in LastErrorValue).
     228 */
    217229DECLIMPORT(BOOL) VIDAPI VidSetVirtualProcessorState(VID_PARTITION_HANDLE hPartition, HV_VP_INDEX iCpu,
    218230                                                    HV_REGISTER_NAME const *paRegNames, uint32_t cRegisters,
    219231                                                    HV_REGISTER_VALUE const *paRegValues);
    220232
     233/**
     234 * Wrapper around the HvCallGetMemoryBalance hypercall.
     235 *
     236 * When VID.SYS processes the request, it will also query
     237 * HvPartitionPropertyVirtualTlbPageCount, so we're passing a 3rd return
     238 * parameter in case the API is ever extended to match the I/O control.
     239 *
     240 * @returns Success indicator (details in LastErrorValue).
     241 * @retval  ERROR_NOT_IMPLEMENTED for exo partitions.
     242 *
     243 * @param   hPartition          The partition handle.
     244 * @param   pcPagesAvailable    Where to return the number of unused pages
     245 *                              still available to the partition.
     246 * @param   pcPagesInUse        Where to return the number of pages currently
     247 *                              in use by the partition.
     248 * @param   pReserved           Pointer to dummy value, just in case they
     249 *                              modify the API to include the nested TLB size.
     250 *
     251 * @note    Not available for exo partitions, unfortunately.  The
     252 *          VidExoFastIoControlPartition function deflects it, failing it with
     253 *          STATUS_NOT_IMPLEMENTED / ERROR_NOT_IMPLEMENTED.
     254 */
     255DECLIMPORT(BOOL) VIDAPI VidGetHvMemoryBalance(VID_PARTITION_HANDLE hPartition, uint64_t *pcPagesAvailable,
     256                                              uint64_t *pcPagesInUse, uint64_t *pReserved);
     257
    221258RT_C_DECLS_END
    222259#endif /* IN_RING3 */
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