VirtualBox

Changeset 40769 in vbox


Ignore:
Timestamp:
Apr 5, 2012 11:49:20 AM (13 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
77270
Message:

HostDrivers/Support: Moved spinlock to DevExt for Mp event race updating the GIP.

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/sup.h

    r40763 r40769  
    208208    /** The max CPU ID (RTMpGetMaxCpuId). */
    209209    RTCPUID             idCpuMax;
    210     /** Padding to 8 byte alignment. */
    211     uint16_t            au16Padding1[2];
    212     /** Spinlock protecting the GIP array members. */
    213     RTSPINLOCK          Spinlock;                       /* 144 */
    214210
    215211    /** Padding / reserved space for future data. */
    216     uint32_t            au32Padding1[HC_ARCH_BITS == 64 ? 26 : 27];
     212    uint32_t            au32Padding1[29];
    217213
    218214    /** Table indexed by the CPU APIC ID to get the CPU table index. */
  • trunk/include/VBox/sup.mac

    r40743 r40769  
    6363    .u16Padding0                resw 1
    6464    .idCpuMax                   resd 1
    65     .au16Padding1               resw 2
    66     .Spinlock                   RTR0PTR_RES 1
    67 %ifndef HC_ARCH_BITS
    68  %error "Missing HC_ARCH_BITS"
    69 %endif
    70 %if HC_ARCH_BITS == 64
    71     .au32Padding1               resd 26
    72 %else
    73     .au32Padding1               resd 27
    74 %endif
     65    .au32Padding1               resd 29
    7566    .aiCpuFromApicId            resw 256
    7667    .aiCpuFromCpuSetIdx         resw 256
  • trunk/src/VBox/HostDrivers/Support/SUPDrv.c

    r40763 r40769  
    134134static DECLCALLBACK(void)   supdrvGipInitOnCpu(RTCPUID idCpu, void *pvUser1, void *pvUser2);
    135135static void                 supdrvGipTerm(PSUPGLOBALINFOPAGE pGip);
    136 static void                 supdrvGipUpdate(PSUPGLOBALINFOPAGE pGip, uint64_t u64NanoTS, uint64_t u64TSC, RTCPUID idCpu, uint64_t iTick);
    137 static void                 supdrvGipUpdatePerCpu(PSUPGLOBALINFOPAGE pGip, uint64_t u64NanoTS, uint64_t u64TSC,
     136static void                 supdrvGipUpdate(PSUPDRVDEVEXT pDevExt, uint64_t u64NanoTS, uint64_t u64TSC, RTCPUID idCpu, uint64_t iTick);
     137static void                 supdrvGipUpdatePerCpu(PSUPDRVDEVEXT pDevExt, uint64_t u64NanoTS, uint64_t u64TSC,
    138138                                                  RTCPUID idCpu, uint8_t idApic, uint64_t iTick);
    139139static void                 supdrvGipInitCpu(PSUPGLOBALINFOPAGE pGip, PSUPGIPCPU pCpu, uint64_t u64NanoTS);
     
    446446    if (RT_SUCCESS(rc))
    447447    {
     448        rc = RTSpinlockCreate(&pDevExt->spinGip);
     449        if (RT_SUCCESS(rc))
     450        {
    448451#ifdef SUPDRV_USE_MUTEX_FOR_LDR
    449         rc = RTSemMutexCreate(&pDevExt->mtxLdr);
     452            rc = RTSemMutexCreate(&pDevExt->mtxLdr);
    450453#else
    451         rc = RTSemFastMutexCreate(&pDevExt->mtxLdr);
     454            rc = RTSemFastMutexCreate(&pDevExt->mtxLdr);
    452455#endif
    453         if (RT_SUCCESS(rc))
    454         {
    455             rc = RTSemFastMutexCreate(&pDevExt->mtxComponentFactory);
    456456            if (RT_SUCCESS(rc))
    457457            {
    458 #ifdef SUPDRV_USE_MUTEX_FOR_LDR
    459                 rc = RTSemMutexCreate(&pDevExt->mtxGip);
    460 #else
    461                 rc = RTSemFastMutexCreate(&pDevExt->mtxGip);
    462 #endif
     458                rc = RTSemFastMutexCreate(&pDevExt->mtxComponentFactory);
    463459                if (RT_SUCCESS(rc))
    464460                {
    465                     rc = supdrvGipCreate(pDevExt);
     461#ifdef SUPDRV_USE_MUTEX_FOR_LDR
     462                    rc = RTSemMutexCreate(&pDevExt->mtxGip);
     463#else
     464                    rc = RTSemFastMutexCreate(&pDevExt->mtxGip);
     465#endif
    466466                    if (RT_SUCCESS(rc))
    467467                    {
     468                        rc = supdrvGipCreate(pDevExt);
     469                        if (RT_SUCCESS(rc))
     470                        {
    468471#ifdef VBOX_WITH_SUPDRV_GENERIC_TRACER
    469                         rc = supdrvTracerInit(pDevExt);
     472                            rc = supdrvTracerInit(pDevExt);
    470473#elif defined(VBOX_WITH_DTRACE_R0DRV)
    471                         rc = supdrvVtgInit(pDevExt, &g_aFunctions[10]);
    472                         if (RT_SUCCESS(rc))
     474                            rc = supdrvVtgInit(pDevExt, &g_aFunctions[10]);
     475                            if (RT_SUCCESS(rc))
    473476#endif
    474                         {
    475                             pDevExt->pLdrInitImage  = NULL;
    476                             pDevExt->hLdrInitThread = NIL_RTNATIVETHREAD;
    477                             pDevExt->u32Cookie      = BIRD;  /** @todo make this random? */
    478                             pDevExt->cbSession      = (uint32_t)cbSession;
    479 
    480                             /*
    481                              * Fixup the absolute symbols.
    482                              *
    483                              * Because of the table indexing assumptions we'll have a little #ifdef orgy
    484                              * here rather than distributing this to OS specific files. At least for now.
    485                              */
     477                            {
     478                                pDevExt->pLdrInitImage  = NULL;
     479                                pDevExt->hLdrInitThread = NIL_RTNATIVETHREAD;
     480                                pDevExt->u32Cookie      = BIRD;  /** @todo make this random? */
     481                                pDevExt->cbSession      = (uint32_t)cbSession;
     482
     483                                /*
     484                                 * Fixup the absolute symbols.
     485                                 *
     486                                 * Because of the table indexing assumptions we'll have a little #ifdef orgy
     487                                 * here rather than distributing this to OS specific files. At least for now.
     488                                 */
    486489#ifdef RT_OS_DARWIN
    487490# if ARCH_BITS == 32
    488                             if (SUPR0GetPagingMode() >= SUPPAGINGMODE_AMD64)
    489                             {
    490                                 g_aFunctions[0].pfn = (void *)1;                    /* SUPR0AbsIs64bit */
    491                                 g_aFunctions[1].pfn = (void *)0x80;                 /* SUPR0Abs64bitKernelCS - KERNEL64_CS, seg.h */
    492                                 g_aFunctions[2].pfn = (void *)0x88;                 /* SUPR0Abs64bitKernelSS - KERNEL64_SS, seg.h */
    493                                 g_aFunctions[3].pfn = (void *)0x88;                 /* SUPR0Abs64bitKernelDS - KERNEL64_SS, seg.h */
    494                             }
    495                             else
    496                                 g_aFunctions[0].pfn = g_aFunctions[1].pfn = g_aFunctions[2].pfn = g_aFunctions[4].pfn = (void *)0;
    497                             g_aFunctions[4].pfn = (void *)0x08;                     /* SUPR0AbsKernelCS - KERNEL_CS, seg.h */
    498                             g_aFunctions[5].pfn = (void *)0x10;                     /* SUPR0AbsKernelSS - KERNEL_DS, seg.h */
    499                             g_aFunctions[6].pfn = (void *)0x10;                     /* SUPR0AbsKernelDS - KERNEL_DS, seg.h */
    500                             g_aFunctions[7].pfn = (void *)0x10;                     /* SUPR0AbsKernelES - KERNEL_DS, seg.h */
    501                             g_aFunctions[8].pfn = (void *)0x10;                     /* SUPR0AbsKernelFS - KERNEL_DS, seg.h */
    502                             g_aFunctions[9].pfn = (void *)0x48;                     /* SUPR0AbsKernelGS - CPU_DATA_GS, seg.h */
     491                                if (SUPR0GetPagingMode() >= SUPPAGINGMODE_AMD64)
     492                                {
     493                                    g_aFunctions[0].pfn = (void *)1;                    /* SUPR0AbsIs64bit */
     494                                    g_aFunctions[1].pfn = (void *)0x80;                 /* SUPR0Abs64bitKernelCS - KERNEL64_CS, seg.h */
     495                                    g_aFunctions[2].pfn = (void *)0x88;                 /* SUPR0Abs64bitKernelSS - KERNEL64_SS, seg.h */
     496                                    g_aFunctions[3].pfn = (void *)0x88;                 /* SUPR0Abs64bitKernelDS - KERNEL64_SS, seg.h */
     497                                }
     498                                else
     499                                    g_aFunctions[0].pfn = g_aFunctions[1].pfn = g_aFunctions[2].pfn = g_aFunctions[4].pfn = (void *)0;
     500                                g_aFunctions[4].pfn = (void *)0x08;                     /* SUPR0AbsKernelCS - KERNEL_CS, seg.h */
     501                                g_aFunctions[5].pfn = (void *)0x10;                     /* SUPR0AbsKernelSS - KERNEL_DS, seg.h */
     502                                g_aFunctions[6].pfn = (void *)0x10;                     /* SUPR0AbsKernelDS - KERNEL_DS, seg.h */
     503                                g_aFunctions[7].pfn = (void *)0x10;                     /* SUPR0AbsKernelES - KERNEL_DS, seg.h */
     504                                g_aFunctions[8].pfn = (void *)0x10;                     /* SUPR0AbsKernelFS - KERNEL_DS, seg.h */
     505                                g_aFunctions[9].pfn = (void *)0x48;                     /* SUPR0AbsKernelGS - CPU_DATA_GS, seg.h */
    503506# else /* 64-bit darwin: */
    504                             g_aFunctions[0].pfn = (void *)1;                        /* SUPR0AbsIs64bit */
    505                             g_aFunctions[1].pfn = (void *)(uintptr_t)ASMGetCS();    /* SUPR0Abs64bitKernelCS */
    506                             g_aFunctions[2].pfn = (void *)(uintptr_t)ASMGetSS();    /* SUPR0Abs64bitKernelSS */
    507                             g_aFunctions[3].pfn = (void *)0;                        /* SUPR0Abs64bitKernelDS */
    508                             g_aFunctions[4].pfn = (void *)(uintptr_t)ASMGetCS();    /* SUPR0AbsKernelCS */
    509                             g_aFunctions[5].pfn = (void *)(uintptr_t)ASMGetSS();    /* SUPR0AbsKernelSS */
    510                             g_aFunctions[6].pfn = (void *)0;                        /* SUPR0AbsKernelDS */
    511                             g_aFunctions[7].pfn = (void *)0;                        /* SUPR0AbsKernelES */
    512                             g_aFunctions[8].pfn = (void *)0;                        /* SUPR0AbsKernelFS */
    513                             g_aFunctions[9].pfn = (void *)0;                        /* SUPR0AbsKernelGS */
     507                                g_aFunctions[0].pfn = (void *)1;                        /* SUPR0AbsIs64bit */
     508                                g_aFunctions[1].pfn = (void *)(uintptr_t)ASMGetCS();    /* SUPR0Abs64bitKernelCS */
     509                                g_aFunctions[2].pfn = (void *)(uintptr_t)ASMGetSS();    /* SUPR0Abs64bitKernelSS */
     510                                g_aFunctions[3].pfn = (void *)0;                        /* SUPR0Abs64bitKernelDS */
     511                                g_aFunctions[4].pfn = (void *)(uintptr_t)ASMGetCS();    /* SUPR0AbsKernelCS */
     512                                g_aFunctions[5].pfn = (void *)(uintptr_t)ASMGetSS();    /* SUPR0AbsKernelSS */
     513                                g_aFunctions[6].pfn = (void *)0;                        /* SUPR0AbsKernelDS */
     514                                g_aFunctions[7].pfn = (void *)0;                        /* SUPR0AbsKernelES */
     515                                g_aFunctions[8].pfn = (void *)0;                        /* SUPR0AbsKernelFS */
     516                                g_aFunctions[9].pfn = (void *)0;                        /* SUPR0AbsKernelGS */
    514517
    515518# endif
    516519#else  /* !RT_OS_DARWIN */
    517520# if ARCH_BITS == 64
    518                             g_aFunctions[0].pfn = (void *)1;                        /* SUPR0AbsIs64bit */
    519                             g_aFunctions[1].pfn = (void *)(uintptr_t)ASMGetCS();    /* SUPR0Abs64bitKernelCS */
    520                             g_aFunctions[2].pfn = (void *)(uintptr_t)ASMGetSS();    /* SUPR0Abs64bitKernelSS */
    521                             g_aFunctions[3].pfn = (void *)(uintptr_t)ASMGetDS();    /* SUPR0Abs64bitKernelDS */
     521                                g_aFunctions[0].pfn = (void *)1;                        /* SUPR0AbsIs64bit */
     522                                g_aFunctions[1].pfn = (void *)(uintptr_t)ASMGetCS();    /* SUPR0Abs64bitKernelCS */
     523                                g_aFunctions[2].pfn = (void *)(uintptr_t)ASMGetSS();    /* SUPR0Abs64bitKernelSS */
     524                                g_aFunctions[3].pfn = (void *)(uintptr_t)ASMGetDS();    /* SUPR0Abs64bitKernelDS */
    522525# else
    523                             g_aFunctions[0].pfn = g_aFunctions[1].pfn = g_aFunctions[2].pfn = g_aFunctions[4].pfn = (void *)0;
     526                                g_aFunctions[0].pfn = g_aFunctions[1].pfn = g_aFunctions[2].pfn = g_aFunctions[4].pfn = (void *)0;
    524527# endif
    525                             g_aFunctions[4].pfn = (void *)(uintptr_t)ASMGetCS();    /* SUPR0AbsKernelCS */
    526                             g_aFunctions[5].pfn = (void *)(uintptr_t)ASMGetSS();    /* SUPR0AbsKernelSS */
    527                             g_aFunctions[6].pfn = (void *)(uintptr_t)ASMGetDS();    /* SUPR0AbsKernelDS */
    528                             g_aFunctions[7].pfn = (void *)(uintptr_t)ASMGetES();    /* SUPR0AbsKernelES */
    529                             g_aFunctions[8].pfn = (void *)(uintptr_t)ASMGetFS();    /* SUPR0AbsKernelFS */
    530                             g_aFunctions[9].pfn = (void *)(uintptr_t)ASMGetGS();    /* SUPR0AbsKernelGS */
     528                                g_aFunctions[4].pfn = (void *)(uintptr_t)ASMGetCS();    /* SUPR0AbsKernelCS */
     529                                g_aFunctions[5].pfn = (void *)(uintptr_t)ASMGetSS();    /* SUPR0AbsKernelSS */
     530                                g_aFunctions[6].pfn = (void *)(uintptr_t)ASMGetDS();    /* SUPR0AbsKernelDS */
     531                                g_aFunctions[7].pfn = (void *)(uintptr_t)ASMGetES();    /* SUPR0AbsKernelES */
     532                                g_aFunctions[8].pfn = (void *)(uintptr_t)ASMGetFS();    /* SUPR0AbsKernelFS */
     533                                g_aFunctions[9].pfn = (void *)(uintptr_t)ASMGetGS();    /* SUPR0AbsKernelGS */
    531534#endif /* !RT_OS_DARWIN */
    532                             return VINF_SUCCESS;
     535                                return VINF_SUCCESS;
     536                            }
     537
     538#if defined(VBOX_WITH_SUPDRV_GENERIC_TRACER) || defined(VBOX_WITH_DTRACE_R0DRV)
     539                            supdrvGipDestroy(pDevExt);
     540#endif
    533541                        }
    534542
    535 #if defined(VBOX_WITH_SUPDRV_GENERIC_TRACER) || defined(VBOX_WITH_DTRACE_R0DRV)
    536                         supdrvGipDestroy(pDevExt);
     543#ifdef SUPDRV_USE_MUTEX_FOR_GIP
     544                        RTSemMutexDestroy(pDevExt->mtxGip);
     545                        pDevExt->mtxGip = NIL_RTSEMMUTEX;
     546#else
     547                        RTSemFastMutexDestroy(pDevExt->mtxGip);
     548                        pDevExt->mtxGip = NIL_RTSEMFASTMUTEX;
    537549#endif
    538550                    }
    539 
    540 #ifdef SUPDRV_USE_MUTEX_FOR_GIP
    541                     RTSemMutexDestroy(pDevExt->mtxGip);
    542                     pDevExt->mtxGip = NIL_RTSEMMUTEX;
     551                    RTSemFastMutexDestroy(pDevExt->mtxComponentFactory);
     552                    pDevExt->mtxComponentFactory = NIL_RTSEMFASTMUTEX;
     553                }
     554#ifdef SUPDRV_USE_MUTEX_FOR_LDR
     555                RTSemMutexDestroy(pDevExt->mtxLdr);
     556                pDevExt->mtxLdr = NIL_RTSEMMUTEX;
    543557#else
    544                     RTSemFastMutexDestroy(pDevExt->mtxGip);
    545                     pDevExt->mtxGip = NIL_RTSEMFASTMUTEX;
     558                RTSemFastMutexDestroy(pDevExt->mtxLdr);
     559                pDevExt->mtxLdr = NIL_RTSEMFASTMUTEX;
    546560#endif
    547                 }
    548                 RTSemFastMutexDestroy(pDevExt->mtxComponentFactory);
    549                 pDevExt->mtxComponentFactory = NIL_RTSEMFASTMUTEX;
    550561            }
    551 #ifdef SUPDRV_USE_MUTEX_FOR_LDR
    552             RTSemMutexDestroy(pDevExt->mtxLdr);
    553             pDevExt->mtxLdr = NIL_RTSEMMUTEX;
    554 #else
    555             RTSemFastMutexDestroy(pDevExt->mtxLdr);
    556             pDevExt->mtxLdr = NIL_RTSEMFASTMUTEX;
    557 #endif
     562            RTSpinlockDestroy(pDevExt->spinGip);
     563            pDevExt->spinGip = NIL_RTSPINLOCK;
    558564        }
    559565        RTSpinlockDestroy(pDevExt->Spinlock);
     
    627633    /* kill the GIP. */
    628634    supdrvGipDestroy(pDevExt);
     635    RTSpinlockDestroy(pDevExt->spinGip);
     636    pDevExt->spinGip = NIL_RTSPINLOCK;
    629637
    630638#ifdef VBOX_WITH_SUPDRV_GENERIC_TRACER
     
    49264934    supdrvGipInit(pDevExt, pGip, HCPhysGip, RTTimeSystemNanoTS(), 1000000000 / u32Interval /*=Hz*/, cCpus);
    49274935
    4928     /* Creating spinlocks can fail (in theory). supdrvGipInit() returns void. */
    4929     rc = RTSpinlockCreate(&pGip->Spinlock);
    4930     if (RT_FAILURE(rc))
    4931     {
    4932         supdrvGipDestroy(pDevExt);
    4933         return rc;
    4934     }
    4935 
    49364936    /*
    49374937     * Create the timer.
     
    50025002    {
    50035003        supdrvGipTerm(pDevExt->pGip);
    5004         if (pDevExt->pGip->Spinlock != NIL_RTSPINLOCK)
    5005         {
    5006             RTSpinlockDestroy(pDevExt->pGip->Spinlock);
    5007             pDevExt->pGip->Spinlock = NIL_RTSPINLOCK;
    5008         }
    5009 
    50105004        pDevExt->pGip = NULL;
    50115005    }
     
    50515045    uint64_t        NanoTS    = RTTimeSystemNanoTS();
    50525046
    5053     supdrvGipUpdate(pDevExt->pGip, NanoTS, u64TSC, NIL_RTCPUID, iTick);
     5047    supdrvGipUpdate(pDevExt, NanoTS, u64TSC, NIL_RTCPUID, iTick);
    50545048
    50555049    ASMSetFlags(fOldFlags);
     
    50725066    /** @todo reset the transaction number and whatnot when iTick == 1. */
    50735067    if (pDevExt->idGipMaster == idCpu)
    5074         supdrvGipUpdate(pDevExt->pGip, NanoTS, u64TSC, idCpu, iTick);
     5068        supdrvGipUpdate(pDevExt, NanoTS, u64TSC, idCpu, iTick);
    50755069    else
    5076         supdrvGipUpdatePerCpu(pDevExt->pGip, NanoTS, u64TSC, idCpu, ASMGetApicId(), iTick);
     5070        supdrvGipUpdatePerCpu(pDevExt, NanoTS, u64TSC, idCpu, ASMGetApicId(), iTick);
    50775071
    50785072    ASMSetFlags(fOldFlags);
     
    51195113 * This is used by supdrvGipMpEvent as well as the supdrvGipCreate.
    51205114 *
    5121  * @param   pGip                The GIP.
     5115 * @param   pDevExt             The device extension,
    51225116 * @param   idCpu               The CPU ID.
    51235117 */
    5124 static void supdrvGipMpEventOnline(PSUPGLOBALINFOPAGE pGip, RTCPUID idCpu)
     5118static void supdrvGipMpEventOnline(PSUPDRVDEVEXT pDevExt, RTCPUID idCpu)
    51255119{
    51265120    int         iCpuSet = 0;
     
    51295123    uint64_t    u64NanoTS = 0;
    51305124    RTSPINLOCKTMP SpinlockTmp = RTSPINLOCKTMP_INITIALIZER;
    5131 
     5125    PSUPGLOBALINFOPAGE pGip = pDevExt->pGip;
     5126
     5127    AssertPtrReturnVoid(pGip);
    51325128    AssertRelease(idCpu == RTMpCpuId());
    51335129    Assert(pGip->cPossibleCpus == RTMpGetCount());
     
    51375133     * on all CPUs simultaneously, see #6110.
    51385134     */
    5139     RTSpinlockAcquireNoInts(pGip->Spinlock, &SpinlockTmp);
     5135    RTSpinlockAcquireNoInts(pDevExt->spinGip, &SpinlockTmp);
    51405136
    51415137    /*
     
    51725168    ASMAtomicWriteSize(&pGip->aCPUs[i].enmState, SUPGIPCPUSTATE_ONLINE);
    51735169
    5174     RTSpinlockReleaseNoInts(pGip->Spinlock, &SpinlockTmp);
     5170    RTSpinlockReleaseNoInts(pDevExt->spinGip, &SpinlockTmp);
    51755171}
    51765172
     
    51815177 * This is used by supdrvGipMpEvent.
    51825178 *
    5183  * @param   pGip                The GIP.
     5179 * @param   pDevExt             The device extension.
    51845180 * @param   idCpu               The CPU ID.
    51855181 */
    5186 static void supdrvGipMpEventOffline(PSUPGLOBALINFOPAGE pGip, RTCPUID idCpu)
     5182static void supdrvGipMpEventOffline(PSUPDRVDEVEXT pDevExt, RTCPUID idCpu)
    51875183{
    51885184    int         iCpuSet;
    51895185    unsigned    i;
    51905186
     5187    PSUPGLOBALINFOPAGE pGip   = pDevExt->pGip;
    51915188    RTSPINLOCKTMP SpinlockTmp = RTSPINLOCKTMP_INITIALIZER;
    5192     RTSpinlockAcquireNoInts(pGip->Spinlock, &SpinlockTmp);
     5189
     5190    AssertPtrReturnVoid(pGip);
     5191    RTSpinlockAcquireNoInts(pDevExt->spinGip, &SpinlockTmp);
    51935192
    51945193    iCpuSet = RTMpCpuIdToSetIndex(idCpu);
     
    52055204    ASMAtomicWriteSize(&pGip->aCPUs[i].enmState, SUPGIPCPUSTATE_OFFLINE);
    52065205
    5207     RTSpinlockReleaseNoInts(pGip->Spinlock, &SpinlockTmp);
     5206    RTSpinlockReleaseNoInts(pDevExt->spinGip, &SpinlockTmp);
    52085207}
    52095208
     
    52395238            case RTMPEVENT_ONLINE:
    52405239                AssertRelease(idCpu == RTMpCpuId());
    5241                 supdrvGipMpEventOnline(pGip, idCpu);
     5240                supdrvGipMpEventOnline(pDevExt, idCpu);
    52425241                break;
    52435242            case RTMPEVENT_OFFLINE:
    5244                 supdrvGipMpEventOffline(pGip, idCpu);
     5243                supdrvGipMpEventOffline(pDevExt, idCpu);
    52455244                break;
    52465245
     
    55155514    pGip->cPossibleCpus         = RTMpGetCount();
    55165515    pGip->idCpuMax              = RTMpGetMaxCpuId();
    5517     pGip->Spinlock              = NIL_RTSPINLOCK;
    55185516    for (i = 0; i < RT_ELEMENTS(pGip->aiCpuFromApicId); i++)
    55195517        pGip->aiCpuFromApicId[i]    = 0;
     
    55445542    /* This is good enough, even though it will update some of the globals a
    55455543       bit to much. */
    5546     supdrvGipMpEventOnline((PSUPGLOBALINFOPAGE)pvUser2, idCpu);
     5544    supdrvGipMpEventOnline((PSUPDRVDEVEXT)pvUser1, idCpu);
    55475545}
    55485546
     
    55705568 * updates all the per cpu data except the transaction id.
    55715569 *
    5572  * @param   pGip            The GIP.
     5570 * @param   pDevExt         The device extension.
    55735571 * @param   pGipCpu         Pointer to the per cpu data.
    55745572 * @param   u64NanoTS       The current time stamp.
     
    55765574 * @param   iTick           The current timer tick.
    55775575 */
    5578 static void supdrvGipDoUpdateCpu(PSUPGLOBALINFOPAGE pGip, PSUPGIPCPU pGipCpu, uint64_t u64NanoTS, uint64_t u64TSC, uint64_t iTick)
     5576static void supdrvGipDoUpdateCpu(PSUPDRVDEVEXT pDevExt, PSUPGIPCPU pGipCpu, uint64_t u64NanoTS, uint64_t u64TSC, uint64_t iTick)
    55795577{
    55805578    uint64_t    u64TSCDelta;
     
    55845582    uint64_t    u64CpuHz;
    55855583    uint32_t    u32TransactionId;
     5584
     5585    PSUPGLOBALINFOPAGE pGip = pDevExt->pGip;
     5586    AssertPtrReturnVoid(pGip);
    55865587
    55875588    /* Delta between this and the previous update. */
     
    56825683 * Updates the GIP.
    56835684 *
    5684  * @param   pGip            Pointer to the GIP.
     5685 * @param   pDevExt         The device extension.
    56855686 * @param   u64NanoTS       The current nanosecond timesamp.
    56865687 * @param   u64TSC          The current TSC timesamp.
     
    56885689 * @param   iTick           The current timer tick.
    56895690 */
    5690 static void supdrvGipUpdate(PSUPGLOBALINFOPAGE pGip, uint64_t u64NanoTS, uint64_t u64TSC, RTCPUID idCpu, uint64_t iTick)
     5691static void supdrvGipUpdate(PSUPDRVDEVEXT pDevExt, uint64_t u64NanoTS, uint64_t u64TSC, RTCPUID idCpu, uint64_t iTick)
    56915692{
    56925693    /*
     
    56945695     */
    56955696    PSUPGIPCPU pGipCpu;
     5697    PSUPGLOBALINFOPAGE pGip = pDevExt->pGip;
     5698    AssertPtrReturnVoid(pGip);
     5699
    56965700    if (pGip->u32Mode != SUPGIPMODE_ASYNC_TSC)
    56975701        pGipCpu = &pGip->aCPUs[0];
     
    57415745     * Update the data.
    57425746     */
    5743     supdrvGipDoUpdateCpu(pGip, pGipCpu, u64NanoTS, u64TSC, iTick);
     5747    supdrvGipDoUpdateCpu(pDevExt, pGipCpu, u64NanoTS, u64TSC, iTick);
    57445748
    57455749    /*
     
    57535757 * Updates the per cpu GIP data for the calling cpu.
    57545758 *
    5755  * @param   pGip            Pointer to the GIP.
     5759 * @param   pDevExt         The device extension.
    57565760 * @param   u64NanoTS       The current nanosecond timesamp.
    57575761 * @param   u64TSC          The current TSC timesamp.
     
    57605764 * @param   iTick           The current timer tick.
    57615765 */
    5762 static void supdrvGipUpdatePerCpu(PSUPGLOBALINFOPAGE pGip, uint64_t u64NanoTS, uint64_t u64TSC,
     5766static void supdrvGipUpdatePerCpu(PSUPDRVDEVEXT pDevExt, uint64_t u64NanoTS, uint64_t u64TSC,
    57635767                                  RTCPUID idCpu, uint8_t idApic, uint64_t iTick)
    57645768{
    57655769    uint32_t iCpu;
     5770    PSUPGLOBALINFOPAGE pGip = pDevExt->pGip;
    57665771
    57675772    /*
     
    57745779        iCpu = supdrvGipCpuIndexFromCpuId(pGip, idCpu);
    57755780        if (pGip->aCPUs[iCpu].enmState == SUPGIPCPUSTATE_OFFLINE)
    5776             supdrvGipMpEventOnline(pGip, idCpu);
     5781            supdrvGipMpEventOnline(pDevExt, idCpu);
    57775782    }
    57785783
     
    57975802             * Update the data.
    57985803             */
    5799             supdrvGipDoUpdateCpu(pGip, pGipCpu, u64NanoTS, u64TSC, iTick);
     5804            supdrvGipDoUpdateCpu(pDevExt, pGipCpu, u64NanoTS, u64TSC, iTick);
    58005805
    58015806            /*
  • trunk/src/VBox/HostDrivers/Support/SUPDrvInternal.h

    r40759 r40769  
    518518    RTSEMFASTMUTEX                  mtxGip;
    519519#endif
     520    /** GIP spinlock protecting GIP members during Mp events. */
     521    RTSPINLOCK                      spinGip;
    520522    /** Pointer to the Global Info Page (GIP). */
    521523    PSUPGLOBALINFOPAGE              pGip;
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