VirtualBox

Changeset 44347 in vbox for trunk/src/VBox/VMM


Ignore:
Timestamp:
Jan 24, 2013 12:27:56 AM (12 years ago)
Author:
vboxsync
Message:

PGM,SSM,STAM: Changed APIs used by Main to take PUVM instead of PVM as the VM handle.

Location:
trunk/src/VBox/VMM
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR3/PGMPhys.cpp

    r43387 r44347  
    3131#include "PGMInternal.h"
    3232#include <VBox/vmm/vm.h>
     33#include <VBox/vmm/uvm.h>
    3334#include "PGMInline.h"
    3435#include <VBox/sup.h>
     
    13611362 *
    13621363 * @returns VBox status code.
    1363  * @param   pVM                 Pointer to the VM.
     1364 * @param   pUVM                The user mode VM handle.
    13641365 * @param   pcbAllocMem         Where to return the amount of memory allocated
    13651366 *                              by VMs.
     
    13721373 *                              currently shared.
    13731374 */
    1374 VMMR3DECL(int) PGMR3QueryGlobalMemoryStats(PVM pVM, uint64_t *pcbAllocMem, uint64_t *pcbFreeMem,
     1375VMMR3DECL(int) PGMR3QueryGlobalMemoryStats(PUVM pUVM, uint64_t *pcbAllocMem, uint64_t *pcbFreeMem,
    13751376                                           uint64_t *pcbBallonedMem, uint64_t *pcbSharedMem)
    13761377{
     1378    UVM_ASSERT_VALID_EXT_RETURN(pUVM, VERR_INVALID_VM_HANDLE);
     1379    VM_ASSERT_VALID_EXT_RETURN(pUVM->pVM, VERR_INVALID_VM_HANDLE);
     1380
    13771381    uint64_t cAllocPages   = 0;
    13781382    uint64_t cFreePages    = 0;
    13791383    uint64_t cBalloonPages = 0;
    13801384    uint64_t cSharedPages  = 0;
    1381     int rc = GMMR3QueryHypervisorMemoryStats(pVM, &cAllocPages, &cFreePages, &cBalloonPages, &cSharedPages);
     1385    int rc = GMMR3QueryHypervisorMemoryStats(pUVM->pVM, &cAllocPages, &cFreePages, &cBalloonPages, &cSharedPages);
    13821386    AssertRCReturn(rc, rc);
    13831387
     
    14041408 *
    14051409 * @returns VBox status code.
    1406  * @param   pVM                 Pointer to the VM.
     1410 * @param   pUVM                The user mode VM handle.
    14071411 * @param   pcbTotalMem         Where to return total amount memory the VM may
    14081412 *                              possibly use.
     
    14251429 *       lower number of shared pages?
    14261430 */
    1427 VMMR3DECL(int) PGMR3QueryMemoryStats(PVM pVM, uint64_t *pcbTotalMem, uint64_t *pcbPrivateMem,
     1431VMMR3DECL(int) PGMR3QueryMemoryStats(PUVM pUVM, uint64_t *pcbTotalMem, uint64_t *pcbPrivateMem,
    14281432                                     uint64_t *pcbSharedMem, uint64_t *pcbZeroMem)
    14291433{
     1434    UVM_ASSERT_VALID_EXT_RETURN(pUVM, VERR_INVALID_VM_HANDLE);
     1435    PVM pVM = pUVM->pVM;
    14301436    VM_ASSERT_VALID_EXT_RETURN(pVM, VERR_INVALID_VM_HANDLE);
    14311437
  • trunk/src/VBox/VMM/VMMR3/SSM.cpp

    r42335 r44347  
    150150#include "SSMInternal.h"
    151151#include <VBox/vmm/vm.h>
     152#include <VBox/vmm/uvm.h>
    152153#include <VBox/err.h>
    153154#include <VBox/log.h>
     
    13621363 * @returns VBox status.
    13631364 *
    1364  * @param   pVM             Pointer to the VM.
     1365 * @param   pUVM            The user mode VM handle.
    13651366 * @param   pszName         Data unit name.
    13661367 * @param   uInstance       The instance identifier of the data unit.
     
    13831384 * @param   pvUser          User argument.
    13841385 */
    1385 VMMR3DECL(int) SSMR3RegisterExternal(PVM pVM, const char *pszName, uint32_t uInstance, uint32_t uVersion, size_t cbGuess,
     1386VMMR3DECL(int) SSMR3RegisterExternal(PUVM pUVM, const char *pszName, uint32_t uInstance, uint32_t uVersion, size_t cbGuess,
    13861387    PFNSSMEXTLIVEPREP pfnLivePrep, PFNSSMEXTLIVEEXEC pfnLiveExec, PFNSSMEXTLIVEVOTE pfnLiveVote,
    13871388    PFNSSMEXTSAVEPREP pfnSavePrep, PFNSSMEXTSAVEEXEC pfnSaveExec, PFNSSMEXTSAVEDONE pfnSaveDone,
    13881389    PFNSSMEXTLOADPREP pfnLoadPrep, PFNSSMEXTLOADEXEC pfnLoadExec, PFNSSMEXTLOADDONE pfnLoadDone, void *pvUser)
    13891390{
     1391    UVM_ASSERT_VALID_EXT_RETURN(pUVM, VERR_INVALID_VM_HANDLE);
     1392    PVM pVM = pUVM->pVM;
     1393    VM_ASSERT_VALID_EXT_RETURN(pVM, VERR_INVALID_VM_HANDLE);
     1394
    13901395    PSSMUNIT pUnit;
    13911396    int rc = ssmR3Register(pVM, pszName, uInstance, uVersion, cbGuess, NULL, &pUnit);
     
    16381643 * @remark  Only for dynamic data units.
    16391644 */
    1640 VMMR3DECL(int) SSMR3DeregisterExternal(PVM pVM, const char *pszName)
    1641 {
     1645VMMR3DECL(int) SSMR3DeregisterExternal(PUVM pUVM, const char *pszName)
     1646{
     1647    UVM_ASSERT_VALID_EXT_RETURN(pUVM, VERR_INVALID_VM_HANDLE);
     1648    PVM pVM = pUVM->pVM;
     1649    VM_ASSERT_VALID_EXT_RETURN(pVM, VERR_INVALID_VM_HANDLE);
     1650
    16421651    return ssmR3DeregisterByNameAndType(pVM, pszName, SSMUNITTYPE_EXTERNAL);
    16431652}
     
    91329141 *          cancelled.
    91339142 *
    9134  * @param   pVM                 Pointer to the VM.
     9143 * @param   pUVM            The VM handle.
    91359144 *
    91369145 * @thread  Any.
    91379146 */
    9138 VMMR3DECL(int) SSMR3Cancel(PVM pVM)
    9139 {
     9147VMMR3DECL(int) SSMR3Cancel(PUVM pUVM)
     9148{
     9149    UVM_ASSERT_VALID_EXT_RETURN(pUVM, VERR_INVALID_VM_HANDLE);
     9150    PVM pVM = pUVM->pVM;
    91409151    VM_ASSERT_VALID_EXT_RETURN(pVM, VERR_INVALID_VM_HANDLE);
    91419152
  • trunk/src/VBox/VMM/VMMR3/STAM.cpp

    r41965 r44347  
    349349{
    350350    AssertReturn(enmType != STAMTYPE_CALLBACK, VERR_INVALID_PARAMETER);
     351    UVM_ASSERT_VALID_EXT_RETURN(pUVM, VERR_INVALID_VM_HANDLE);
    351352    return stamR3RegisterU(pUVM, pvSample, NULL, NULL, enmType, enmVisibility, pszName, enmUnit, pszDesc);
    352353}
     
    739740VMMR3DECL(int)  STAMR3DeregisterU(PUVM pUVM, void *pvSample)
    740741{
     742    UVM_ASSERT_VALID_EXT_RETURN(pUVM, VERR_INVALID_VM_HANDLE);
     743
    741744    STAM_LOCK_WR(pUVM);
    742745
     
    794797 *
    795798 * @returns VBox status. (Basically, it cannot fail.)
    796  * @param   pVM         Pointer to the VM.
     799 * @param   pUVM        The user mode VM handle.
    797800 * @param   pszPat      The name matching pattern. See somewhere_where_this_is_described_in_detail.
    798801 *                      If NULL all samples are reset.
    799802 * @remarks Don't confuse this with the other 'XYZR3Reset' methods, it's not called at VM reset.
    800803 */
    801 VMMR3DECL(int)  STAMR3ResetU(PUVM pUVM, const char *pszPat)
    802 {
     804VMMR3DECL(int)  STAMR3Reset(PUVM pUVM, const char *pszPat)
     805{
     806    UVM_ASSERT_VALID_EXT_RETURN(pUVM, VERR_INVALID_VM_HANDLE);
     807    VM_ASSERT_VALID_EXT_RETURN(pUVM->pVM, VERR_INVALID_VM_HANDLE);
     808
    803809    int rc = VINF_SUCCESS;
    804810
     
    876882
    877883/**
    878  * Resets statistics for the specified VM.
    879  * It's possible to select a subset of the samples.
    880  *
    881  * @returns VBox status. (Basically, it cannot fail.)
    882  * @param   pVM         Pointer to the VM.
    883  * @param   pszPat      The name matching pattern. See somewhere_where_this_is_described_in_detail.
    884  *                      If NULL all samples are reset.
    885  * @remarks Don't confuse this with the other 'XYZR3Reset' methods, it's not called at VM reset.
    886  */
    887 VMMR3DECL(int)  STAMR3Reset(PVM pVM, const char *pszPat)
    888 {
    889     return STAMR3ResetU(pVM->pUVM, pszPat);
    890 }
    891 
    892 
    893 /**
    894884 * Resets one statistics sample.
    895885 * Callback for stamR3EnumU().
     
    976966 *
    977967 * @returns VBox status. (Basically, it cannot fail.)
    978  * @param   pUVM            Pointer to the user mode VM structure.
     968 * @param   pUVM            The user mode VM handle.
    979969 * @param   pszPat          The name matching pattern. See somewhere_where_this_is_described_in_detail.
    980970 *                          If NULL all samples are reset.
     
    986976 * @param   pcchSnapshot    Where to store the size of the snapshot data. (Excluding the trailing '\0')
    987977 */
    988 VMMR3DECL(int) STAMR3SnapshotU(PUVM pUVM, const char *pszPat, char **ppszSnapshot, size_t *pcchSnapshot, bool fWithDesc)
    989 {
     978VMMR3DECL(int) STAMR3Snapshot(PUVM pUVM, const char *pszPat, char **ppszSnapshot, size_t *pcchSnapshot, bool fWithDesc)
     979{
     980    UVM_ASSERT_VALID_EXT_RETURN(pUVM, VERR_INVALID_VM_HANDLE);
     981    VM_ASSERT_VALID_EXT_RETURN(pUVM->pVM, VERR_INVALID_VM_HANDLE);
     982
    990983    STAMR3SNAPSHOTONE State = { NULL, NULL, NULL, pUVM->pVM, 0, VINF_SUCCESS, fWithDesc };
    991984
     
    10191012        *pcchSnapshot = State.psz - State.pszStart;
    10201013    return rc;
    1021 }
    1022 
    1023 
    1024 /**
    1025  * Get a snapshot of the statistics.
    1026  * It's possible to select a subset of the samples.
    1027  *
    1028  * @returns VBox status. (Basically, it cannot fail.)
    1029  * @param   pVM             Pointer to the VM.
    1030  * @param   pszPat          The name matching pattern. See somewhere_where_this_is_described_in_detail.
    1031  *                          If NULL all samples are reset.
    1032  * @param   fWithDesc       Whether to include the descriptions.
    1033  * @param   ppszSnapshot    Where to store the pointer to the snapshot data.
    1034  *                          The format of the snapshot should be XML, but that will have to be discussed
    1035  *                          when this function is implemented.
    1036  *                          The returned pointer must be freed by calling STAMR3SnapshotFree().
    1037  * @param   pcchSnapshot    Where to store the size of the snapshot data.
    1038  *                          (Excluding the trailing '\\0')
    1039  */
    1040 VMMR3DECL(int) STAMR3Snapshot(PVM pVM, const char *pszPat, char **ppszSnapshot, size_t *pcchSnapshot, bool fWithDesc)
    1041 {
    1042     return STAMR3SnapshotU(pVM->pUVM, pszPat, ppszSnapshot, pcchSnapshot, fWithDesc);
    10431014}
    10441015
     
    12831254 *
    12841255 * @returns VBox status.
    1285  * @param   pUVM        Pointer to the user mode VM structure.
     1256 * @param   pUVM            The user mode VM handle.
    12861257 * @param   pszSnapshot     The snapshot data pointer returned by STAMR3Snapshot().
    12871258 *                          NULL is allowed.
    12881259 */
    1289 VMMR3DECL(int)  STAMR3SnapshotFreeU(PUVM pUVM, char *pszSnapshot)
     1260VMMR3DECL(int)  STAMR3SnapshotFree(PUVM pUVM, char *pszSnapshot)
    12901261{
    12911262    if (!pszSnapshot)
     
    12971268
    12981269/**
    1299  * Releases a statistics snapshot returned by STAMR3Snapshot().
    1300  *
    1301  * @returns VBox status.
    1302  * @param   pVM             Pointer to the VM.
    1303  * @param   pszSnapshot     The snapshot data pointer returned by STAMR3Snapshot().
    1304  *                          NULL is allowed.
    1305  */
    1306 VMMR3DECL(int)  STAMR3SnapshotFree(PVM pVM, char *pszSnapshot)
    1307 {
    1308     return STAMR3SnapshotFreeU(pVM->pUVM, pszSnapshot);
    1309 }
    1310 
    1311 
    1312 /**
    13131270 * Dumps the selected statistics to the log.
    13141271 *
     
    13181275 *                          If NULL all samples are written to the log.
    13191276 */
    1320 VMMR3DECL(int)  STAMR3DumpU(PUVM pUVM, const char *pszPat)
    1321 {
     1277VMMR3DECL(int)  STAMR3Dump(PUVM pUVM, const char *pszPat)
     1278{
     1279    UVM_ASSERT_VALID_EXT_RETURN(pUVM, VERR_INVALID_VM_HANDLE);
     1280    VM_ASSERT_VALID_EXT_RETURN(pUVM->pVM, VERR_INVALID_VM_HANDLE);
     1281
    13221282    STAMR3PRINTONEARGS Args;
    13231283    Args.pVM = pUVM->pVM;
     
    13271287    stamR3EnumU(pUVM, pszPat, true /* fUpdateRing0 */, stamR3PrintOne, &Args);
    13281288    return VINF_SUCCESS;
    1329 }
    1330 
    1331 
    1332 /**
    1333  * Dumps the selected statistics to the log.
    1334  *
    1335  * @returns VBox status.
    1336  * @param   pVM             Pointer to the VM.
    1337  * @param   pszPat          The name matching pattern. See somewhere_where_this_is_described_in_detail.
    1338  *                          If NULL all samples are written to the log.
    1339  */
    1340 VMMR3DECL(int)  STAMR3Dump(PVM pVM, const char *pszPat)
    1341 {
    1342     return STAMR3DumpU(pVM->pUVM, pszPat);
    13431289}
    13441290
     
    13691315 *                          If NULL all samples are written to the log.
    13701316 */
    1371 VMMR3DECL(int)  STAMR3DumpToReleaseLogU(PUVM pUVM, const char *pszPat)
    1372 {
     1317VMMR3DECL(int)  STAMR3DumpToReleaseLog(PUVM pUVM, const char *pszPat)
     1318{
     1319    UVM_ASSERT_VALID_EXT_RETURN(pUVM, VERR_INVALID_VM_HANDLE);
     1320    VM_ASSERT_VALID_EXT_RETURN(pUVM->pVM, VERR_INVALID_VM_HANDLE);
     1321
    13731322    STAMR3PRINTONEARGS Args;
    13741323    Args.pVM = pUVM->pVM;
     
    13791328    return VINF_SUCCESS;
    13801329}
    1381 
    1382 
    1383 /**
    1384  * Dumps the selected statistics to the release log.
    1385  *
    1386  * @returns VBox status.
    1387  * @param   pVM             Pointer to the VM.
    1388  * @param   pszPat          The name matching pattern. See somewhere_where_this_is_described_in_detail.
    1389  *                          If NULL all samples are written to the log.
    1390  */
    1391 VMMR3DECL(int)  STAMR3DumpToReleaseLog(PVM pVM, const char *pszPat)
    1392 {
    1393     return STAMR3DumpToReleaseLogU(pVM->pUVM, pszPat);
    1394 }
    1395 
    13961330
    13971331/**
     
    14161350 *
    14171351 * @returns VBox status.
    1418  * @param   pVM             Pointer to the VM.
     1352 * @param   pUVM            The user mode VM handle.
    14191353 * @param   pszPat          The name matching pattern. See somewhere_where_this_is_described_in_detail.
    14201354 *                          If NULL all samples are reset.
    14211355 */
    1422 VMMR3DECL(int)  STAMR3PrintU(PUVM pUVM, const char *pszPat)
    1423 {
     1356VMMR3DECL(int)  STAMR3Print(PUVM pUVM, const char *pszPat)
     1357{
     1358    UVM_ASSERT_VALID_EXT_RETURN(pUVM, VERR_INVALID_VM_HANDLE);
     1359    VM_ASSERT_VALID_EXT_RETURN(pUVM->pVM, VERR_INVALID_VM_HANDLE);
     1360
    14241361    STAMR3PRINTONEARGS Args;
    14251362    Args.pVM = pUVM->pVM;
     
    14291366    stamR3EnumU(pUVM, pszPat, true /* fUpdateRing0 */, stamR3PrintOne, &Args);
    14301367    return VINF_SUCCESS;
    1431 }
    1432 
    1433 
    1434 /**
    1435  * Prints the selected statistics to standard out.
    1436  *
    1437  * @returns VBox status.
    1438  * @param   pVM             Pointer to the VM.
    1439  * @param   pszPat          The name matching pattern. See somewhere_where_this_is_described_in_detail.
    1440  *                          If NULL all samples are reset.
    1441  */
    1442 VMMR3DECL(int)  STAMR3Print(PVM pVM, const char *pszPat)
    1443 {
    1444     return STAMR3PrintU(pVM->pUVM, pszPat);
    14451368}
    14461369
     
    15901513 * @returns Whatever the callback returns.
    15911514 *
    1592  * @param   pUVM        Pointer to the user mode VM structure.
     1515 * @param   pUVM        The user mode VM handle.
    15931516 * @param   pszPat      The pattern to match samples.
    15941517 * @param   pfnEnum     The callback function.
    15951518 * @param   pvUser      The pvUser argument of the callback function.
    15961519 */
    1597 VMMR3DECL(int) STAMR3EnumU(PUVM pUVM, const char *pszPat, PFNSTAMR3ENUM pfnEnum, void *pvUser)
    1598 {
     1520VMMR3DECL(int) STAMR3Enum(PUVM pUVM, const char *pszPat, PFNSTAMR3ENUM pfnEnum, void *pvUser)
     1521{
     1522    UVM_ASSERT_VALID_EXT_RETURN(pUVM, VERR_INVALID_VM_HANDLE);
     1523    VM_ASSERT_VALID_EXT_RETURN(pUVM->pVM, VERR_INVALID_VM_HANDLE);
     1524
    15991525    STAMR3ENUMONEARGS Args;
    16001526    Args.pVM     = pUVM->pVM;
     
    16031529
    16041530    return stamR3EnumU(pUVM, pszPat, true /* fUpdateRing0 */, stamR3EnumOne, &Args);
    1605 }
    1606 
    1607 
    1608 /**
    1609  * Enumerate the statistics by the means of a callback function.
    1610  *
    1611  * @returns Whatever the callback returns.
    1612  *
    1613  * @param   pVM         Pointer to the VM.
    1614  * @param   pszPat      The pattern to match samples.
    1615  * @param   pfnEnum     The callback function.
    1616  * @param   pvUser      The pvUser argument of the callback function.
    1617  */
    1618 VMMR3DECL(int) STAMR3Enum(PVM pVM, const char *pszPat, PFNSTAMR3ENUM pfnEnum, void *pvUser)
    1619 {
    1620     return STAMR3EnumU(pVM->pUVM, pszPat, pfnEnum, pvUser);
    16211531}
    16221532
     
    20771987     * Execute reset.
    20781988     */
    2079     int rc = STAMR3ResetU(pUVM, cArgs ? paArgs[0].u.pszString : NULL);
     1989    int rc = STAMR3Reset(pUVM, cArgs ? paArgs[0].u.pszString : NULL);
    20801990    if (RT_SUCCESS(rc))
    20811991        return DBGCCmdHlpFailRc(pCmdHlp, pCmd, rc, "STAMR3ResetU");
  • trunk/src/VBox/VMM/VMMR3/VM.cpp

    r44340 r44347  
    21732173            return rc;
    21742174        if (rc >= 7)
    2175             SSMR3Cancel(pVM);
     2175            SSMR3Cancel(pVM->pUVM);
    21762176    }
    21772177
     
    23842384#endif
    23852385#ifdef VBOX_WITH_STATISTICS
    2386         STAMR3Dump(pVM, "*");
     2386        STAMR3Dump(pUVM, "*");
    23872387#else
    23882388        LogRel(("************************* Statistics *************************\n"));
    2389         STAMR3DumpToReleaseLog(pVM, "*");
     2389        STAMR3DumpToReleaseLog(pUVM, "*");
    23902390        LogRel(("********************* End of statistics **********************\n"));
    23912391#endif
     
    33713371    {
    33723372        vmR3SetStateLocked(pVM, pUVM, VMSTATE_GURU_MEDITATION_LS, VMSTATE_RUNNING_LS);
    3373         SSMR3Cancel(pVM);
     3373        SSMR3Cancel(pUVM);
    33743374    }
    33753375
     
    39203920            return rc;
    39213921        if (rc == 2)
    3922             SSMR3Cancel(pVM);
     3922            SSMR3Cancel(pVM->pUVM);
    39233923
    39243924        VM_FF_SET(pVM, VM_FF_CHECK_VM_STATE);
  • trunk/src/VBox/VMM/testcase/tstMicro.cpp

    r44340 r44347  
    356356        rc = VMR3ReqCallVoidWaitU(pUVM, VMCPUID_ANY, (PFNRT)doit, 1, pVM);
    357357        AssertRC(rc);
    358         STAMR3Dump(pVM, "*");
     358        STAMR3Dump(pUVM, "*");
    359359
    360360        /*
  • trunk/src/VBox/VMM/testcase/tstVMM-HM.cpp

    r44340 r44347  
    9595        AssertRC(rc);
    9696
    97         STAMR3Dump(pVM, "*");
     97        STAMR3Dump(pUVM, "*");
    9898
    9999        /*
  • trunk/src/VBox/VMM/testcase/tstVMM.cpp

    r44340 r44347  
    287287        }
    288288
    289         STAMR3Dump(pVM, "*");
     289        STAMR3Dump(pUVM, "*");
    290290
    291291        /*
  • trunk/src/VBox/VMM/testcase/tstVMMFork.cpp

    r44340 r44347  
    135135                VMR3ReqCallWaitU(pUVM, VMCPUID_ANY, (PFNRT)VMMDoTest, 1, pVM);
    136136
    137                 STAMR3Dump(pVM, "*");
     137                STAMR3Dump(pUVM, "*");
    138138            }
    139139        }
  • trunk/src/VBox/VMM/testcase/tstVMREQ.cpp

    r44340 r44347  
    273273         * Print stats.
    274274         */
    275         STAMR3Print(VMR3GetVM(pUVM), "/VM/Req/*");
     275        STAMR3Print(pUVM, "/VM/Req/*");
    276276
    277277        /*
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