VirtualBox

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


Ignore:
Timestamp:
Mar 10, 2011 5:22:08 PM (14 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
70492
Message:

GIP,++: Lots of CPUs (disabled).

File:
1 edited

Legend:

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

    r35346 r36254  
    122122#define LOG_GROUP LOG_GROUP_TM
    123123#include <VBox/vmm/tm.h>
     124#include <iprt/asm-amd64-x86.h> /* for SUPGetCpuHzFromGIP from sup.h  */
    124125#include <VBox/vmm/vmm.h>
    125126#include <VBox/vmm/mm.h>
     
    139140#include <iprt/asm.h>
    140141#include <iprt/asm-math.h>
    141 #include <iprt/asm-amd64-x86.h>
    142142#include <iprt/assert.h>
    143143#include <iprt/thread.h>
     
    222222    pVM->tm.s.pvGIPR3 = (void *)g_pSUPGlobalInfoPage;
    223223    AssertMsgReturn(pVM->tm.s.pvGIPR3, ("GIP support is now required!\n"), VERR_INTERNAL_ERROR);
     224    AssertMsgReturn((g_pSUPGlobalInfoPage->u32Version >> 16) == (SUPGLOBALINFOPAGE_VERSION >> 16),
     225                    ("Unsupported GIP version!\n"), VERR_INTERNAL_ERROR);
     226
    224227    RTHCPHYS HCPhysGIP;
    225228    rc = SUPR3GipGetPhys(&HCPhysGIP);
     
    227230
    228231    RTGCPTR GCPtr;
     232#ifdef SUP_WITH_LOTS_OF_CPUS
     233    rc = MMR3HyperMapHCPhys(pVM, pVM->tm.s.pvGIPR3, NIL_RTR0PTR, HCPhysGIP, (size_t)g_pSUPGlobalInfoPage->cPages * PAGE_SIZE,
     234                            "GIP", &GCPtr);
     235#else
    229236    rc = MMR3HyperMapHCPhys(pVM, pVM->tm.s.pvGIPR3, NIL_RTR0PTR, HCPhysGIP, PAGE_SIZE, "GIP", &GCPtr);
     237#endif
    230238    if (RT_FAILURE(rc))
    231239    {
     
    795803     * Use GIP when available present.
    796804     */
    797     uint64_t    u64Hz;
    798     PSUPGLOBALINFOPAGE pGip = g_pSUPGlobalInfoPage;
    799     if (    pGip
    800         &&  pGip->u32Magic == SUPGLOBALINFOPAGE_MAGIC)
    801     {
    802         unsigned iCpu = pGip->u32Mode != SUPGIPMODE_ASYNC_TSC ? 0 : ASMGetApicId();
    803         if (iCpu >= RT_ELEMENTS(pGip->aCPUs))
    804             AssertReleaseMsgFailed(("iCpu=%d - the ApicId is too high. send VBox.log and hardware specs!\n", iCpu));
     805    uint64_t u64Hz = SUPGetCpuHzFromGIP(g_pSUPGlobalInfoPage);
     806    if (u64Hz != UINT64_MAX)
     807    {
     808        if (tmR3HasFixedTSC(pVM))
     809            /* Sleep a bit to get a more reliable CpuHz value. */
     810            RTThreadSleep(32);
    805811        else
    806812        {
    807             if (tmR3HasFixedTSC(pVM))
    808                 /* Sleep a bit to get a more reliable CpuHz value. */
    809                 RTThreadSleep(32);
    810             else
    811             {
    812                 /* Spin for 40ms to try push up the CPU frequency and get a more reliable CpuHz value. */
    813                 const uint64_t u64 = RTTimeMilliTS();
    814                 while ((RTTimeMilliTS() - u64) < 40 /*ms*/)
    815                     /* nothing */;
    816             }
    817 
    818             pGip = g_pSUPGlobalInfoPage;
    819             if (    pGip
    820                 &&  pGip->u32Magic == SUPGLOBALINFOPAGE_MAGIC
    821                 &&  (u64Hz = pGip->aCPUs[iCpu].u64CpuHz)
    822                 &&  u64Hz != ~(uint64_t)0)
    823                 return u64Hz;
     813            /* Spin for 40ms to try push up the CPU frequency and get a more reliable CpuHz value. */
     814            const uint64_t u64 = RTTimeMilliTS();
     815            while ((RTTimeMilliTS() - u64) < 40 /*ms*/)
     816                /* nothing */;
    824817        }
     818
     819        u64Hz = SUPGetCpuHzFromGIP(g_pSUPGlobalInfoPage);
     820        if (u64Hz != UINT64_MAX)
     821            return u64Hz;
    825822    }
    826823
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