Changeset 64236 in vbox for trunk/src/VBox/HostDrivers/Support
- Timestamp:
- Oct 13, 2016 10:35:47 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/Support/SUPDrvGip.cpp
r64235 r64236 134 134 static void supdrvTscDeltaThreadStartMeasurement(PSUPDRVDEVEXT pDevExt, bool fForceAll); 135 135 #else 136 static int supdrv MeasureInitialTscDeltas(PSUPDRVDEVEXT pDevExt);137 static int supdrv MeasureTscDeltaOne(PSUPDRVDEVEXT pDevExt, uint32_t idxWorker);136 static int supdrvTscMeasureInitialDeltas(PSUPDRVDEVEXT pDevExt); 137 static int supdrvTscMeasureDeltaOne(PSUPDRVDEVEXT pDevExt, uint32_t idxWorker); 138 138 #endif 139 139 … … 898 898 #else 899 899 RTCpuSetCopy(&pDevExt->TscDeltaCpuSet, &pGip->OnlineCpuSet); 900 supdrv MeasureInitialTscDeltas(pDevExt);900 supdrvTscMeasureInitialDeltas(pDevExt); 901 901 #endif 902 902 } … … 1424 1424 #else 1425 1425 uint32_t iCpu = supdrvGipFindOrAllocCpuIndexForCpuId(pGip, idCpu); 1426 supdrv MeasureTscDeltaOne(pDevExt, iCpu);1426 supdrvTscMeasureDeltaOne(pDevExt, iCpu); 1427 1427 #endif 1428 1428 } … … 1925 1925 do 1926 1926 { 1927 rc = supdrv MeasureInitialTscDeltas(pDevExt);1927 rc = supdrvTscMeasureInitialDeltas(pDevExt); 1928 1928 if ( rc != VERR_TRY_AGAIN 1929 1929 && rc != VERR_CPU_OFFLINE) … … 1984 1984 } 1985 1985 else 1986 OSDBGPRINT(("supdrvGipCreate: supdrv MeasureInitialTscDeltas failed. rc=%Rrc\n", rc));1986 OSDBGPRINT(("supdrvGipCreate: supdrvTscMeasureInitialDeltas failed. rc=%Rrc\n", rc)); 1987 1987 1988 1988 /* Releases timer frequency increase too. */ … … 2612 2612 2613 2613 /** 2614 * Argument package/state passed by supdrv MeasureTscDeltaOne() to the RTMpOn2614 * Argument package/state passed by supdrvTscMeasureDeltaOne() to the RTMpOn 2615 2615 * callback worker. 2616 2616 * @todo add … … 2624 2624 /** Pointer to the GIP CPU array entry for the master. */ 2625 2625 PSUPGIPCPU pMaster; 2626 /** The maximum number of ticks to spend in supdrv MeasureTscDeltaCallback.2626 /** The maximum number of ticks to spend in supdrvTscMeasureDeltaCallback. 2627 2627 * (This is what we need a rough TSC frequency for.) */ 2628 2628 uint64_t cMaxTscTicks; … … 3501 3501 /** 3502 3502 * Handles the special abort procedure during synchronization setup in 3503 * supdrv MeasureTscDeltaCallbackUnwrapped().3503 * supdrvTscMeasureDeltaCallbackUnwrapped(). 3504 3504 * 3505 3505 * @returns 0 (dummy, ignored) … … 3510 3510 */ 3511 3511 DECL_NO_INLINE(static, int) 3512 supdrv MeasureTscDeltaCallbackAbortSyncSetup(PSUPDRVGIPTSCDELTARGS pArgs, PSUPTSCDELTASYNC2 pMySync, bool fIsMaster, bool fTimeout)3512 supdrvTscMeasureDeltaCallbackAbortSyncSetup(PSUPDRVGIPTSCDELTARGS pArgs, PSUPTSCDELTASYNC2 pMySync, bool fIsMaster, bool fTimeout) 3513 3513 { 3514 3514 PSUPTSCDELTASYNC2 volatile *ppMySync = fIsMaster ? &pArgs->pSyncMaster : &pArgs->pSyncWorker; … … 3543 3543 3544 3544 /** 3545 * This is used by supdrv MeasureInitialTscDeltas() to read the TSC on two CPUs3545 * This is used by supdrvTscMeasureInitialDeltas() to read the TSC on two CPUs 3546 3546 * and compute the delta between them. 3547 3547 * … … 3560 3560 * doing this on x86 CPUs. 3561 3561 */ 3562 static int supdrv MeasureTscDeltaCallbackUnwrapped(RTCPUID idCpu, PSUPDRVGIPTSCDELTARGS pArgs)3562 static int supdrvTscMeasureDeltaCallbackUnwrapped(RTCPUID idCpu, PSUPDRVGIPTSCDELTARGS pArgs) 3563 3563 { 3564 3564 PSUPDRVDEVEXT pDevExt = pArgs->pDevExt; … … 3606 3606 if ( ASMAtomicReadBool(&pArgs->fAbortSetup) 3607 3607 || !RTMpIsCpuOnline(fIsMaster ? pGipCpuWorker->idCpu : pGipCpuMaster->idCpu) ) 3608 return supdrv MeasureTscDeltaCallbackAbortSyncSetup(pArgs, &MySync, fIsMaster, false /*fTimeout*/);3608 return supdrvTscMeasureDeltaCallbackAbortSyncSetup(pArgs, &MySync, fIsMaster, false /*fTimeout*/); 3609 3609 if ( (iTry++ & 0xff) == 0 3610 3610 && ASMReadTSC() - MySync.uTscStart > pArgs->cMaxTscTicks) 3611 return supdrv MeasureTscDeltaCallbackAbortSyncSetup(pArgs, &MySync, fIsMaster, true /*fTimeout*/);3611 return supdrvTscMeasureDeltaCallbackAbortSyncSetup(pArgs, &MySync, fIsMaster, true /*fTimeout*/); 3612 3612 TSCDELTA_DBG_CHECK_LOOP(); 3613 3613 ASMNopPause(); … … 3617 3617 if (fIsMaster) 3618 3618 if (!ASMAtomicCmpXchgU32(&pOtherSync->uSyncVar, GIP_TSC_DELTA_SYNC2_READY, GIP_TSC_DELTA_SYNC2_PRESTART_WAIT)) /* parnaoia */ 3619 return supdrv MeasureTscDeltaCallbackAbortSyncSetup(pArgs, &MySync, fIsMaster, false /*fTimeout*/);3619 return supdrvTscMeasureDeltaCallbackAbortSyncSetup(pArgs, &MySync, fIsMaster, false /*fTimeout*/); 3620 3620 3621 3621 iTry = 0; … … 3625 3625 ASMNopPause(); 3626 3626 if (ASMAtomicReadBool(&pArgs->fAbortSetup)) 3627 return supdrv MeasureTscDeltaCallbackAbortSyncSetup(pArgs, &MySync, fIsMaster, false /*fTimeout*/);3627 return supdrvTscMeasureDeltaCallbackAbortSyncSetup(pArgs, &MySync, fIsMaster, false /*fTimeout*/); 3628 3628 if ( (iTry++ & 0xff) == 0 3629 3629 && ASMReadTSC() - MySync.uTscStart > pArgs->cMaxTscTicks) … … 3632 3632 && !ASMAtomicCmpXchgU32(&MySync.uSyncVar, GIP_TSC_DELTA_SYNC2_PRESTART_ABORT, GIP_TSC_DELTA_SYNC2_PRESTART_WAIT)) 3633 3633 break; /* race #1: slave has moved on, handle timeout in loop instead. */ 3634 return supdrv MeasureTscDeltaCallbackAbortSyncSetup(pArgs, &MySync, fIsMaster, true /*fTimeout*/);3634 return supdrvTscMeasureDeltaCallbackAbortSyncSetup(pArgs, &MySync, fIsMaster, true /*fTimeout*/); 3635 3635 } 3636 3636 TSCDELTA_DBG_CHECK_LOOP(); … … 3639 3639 if (!fIsMaster) 3640 3640 if (!ASMAtomicCmpXchgU32(&pOtherSync->uSyncVar, GIP_TSC_DELTA_SYNC2_READY, GIP_TSC_DELTA_SYNC2_PRESTART_WAIT)) /* race #1 */ 3641 return supdrv MeasureTscDeltaCallbackAbortSyncSetup(pArgs, &MySync, fIsMaster, false /*fTimeout*/);3641 return supdrvTscMeasureDeltaCallbackAbortSyncSetup(pArgs, &MySync, fIsMaster, false /*fTimeout*/); 3642 3642 3643 3643 /** @todo Add a resumable state to pArgs so we don't waste time if we time … … 3751 3751 3752 3752 /** 3753 * Callback used by supdrv MeasureInitialTscDeltas() to read the TSC on two CPUs3753 * Callback used by supdrvTscMeasureInitialDeltas() to read the TSC on two CPUs 3754 3754 * and compute the delta between them. 3755 3755 * … … 3758 3758 * @param pvUser2 Unused. 3759 3759 */ 3760 static DECLCALLBACK(void) supdrv MeasureTscDeltaCallback(RTCPUID idCpu, void *pvUser1, void *pvUser2)3761 { 3762 supdrv MeasureTscDeltaCallbackUnwrapped(idCpu, (PSUPDRVGIPTSCDELTARGS)pvUser1);3760 static DECLCALLBACK(void) supdrvTscMeasureDeltaCallback(RTCPUID idCpu, void *pvUser1, void *pvUser2) 3761 { 3762 supdrvTscMeasureDeltaCallbackUnwrapped(idCpu, (PSUPDRVGIPTSCDELTARGS)pvUser1); 3763 3763 RT_NOREF1(pvUser2); 3764 3764 } … … 3778 3778 * @remarks This must be called with preemption enabled! 3779 3779 */ 3780 static int supdrv MeasureTscDeltaOne(PSUPDRVDEVEXT pDevExt, uint32_t idxWorker)3780 static int supdrvTscMeasureDeltaOne(PSUPDRVDEVEXT pDevExt, uint32_t idxWorker) 3781 3781 { 3782 3782 int rc; … … 3877 3877 /* 3878 3878 * Do the RTMpOnPair call. We reset i64TSCDelta first so we 3879 * and supdrv MeasureTscDeltaCallback can use it as a success check.3879 * and supdrvTscMeasureDeltaCallback can use it as a success check. 3880 3880 */ 3881 3881 /** @todo Store the i64TSCDelta result in pArgs first? Perhaps deals with … … 3883 3883 ASMAtomicWriteS64(&pGipCpuWorker->i64TSCDelta, INT64_MAX); 3884 3884 rc = RTMpOnPair(pGipCpuMaster->idCpu, pGipCpuWorker->idCpu, RTMPON_F_CONCURRENT_EXEC, 3885 supdrv MeasureTscDeltaCallback, pArgs, NULL);3885 supdrvTscMeasureDeltaCallback, pArgs, NULL); 3886 3886 if (RT_SUCCESS(rc)) 3887 3887 { … … 4022 4022 * supdrvGipInitOnCpu(). 4023 4023 */ 4024 static int supdrv MeasureInitialTscDeltas(PSUPDRVDEVEXT pDevExt)4024 static int supdrvTscMeasureInitialDeltas(PSUPDRVDEVEXT pDevExt) 4025 4025 { 4026 4026 PSUPGIPCPU pGipCpuMaster; … … 4066 4066 && RTCpuSetIsMemberByIndex(&pDevExt->TscDeltaCpuSet, pGipCpuWorker->iCpuSet)) 4067 4067 { 4068 rc = supdrv MeasureTscDeltaOne(pDevExt, iCpu);4068 rc = supdrvTscMeasureDeltaOne(pDevExt, iCpu); 4069 4069 if (RT_FAILURE(rc)) 4070 4070 { 4071 SUPR0Printf("supdrv MeasureTscDeltaOne failed. rc=%d CPU[%u].idCpu=%u Master[%u].idCpu=%u\n", rc, iCpu,4071 SUPR0Printf("supdrvTscMeasureDeltaOne failed. rc=%d CPU[%u].idCpu=%u Master[%u].idCpu=%u\n", rc, iCpu, 4072 4072 pGipCpuWorker->idCpu, idxMaster, pDevExt->idGipMaster, pGipCpuMaster->idCpu); 4073 4073 break; … … 4183 4183 { 4184 4184 RTCpuSetCopy(&pDevExt->TscDeltaCpuSet, &pGip->OnlineCpuSet); 4185 rc = supdrv MeasureInitialTscDeltas(pDevExt);4185 rc = supdrvTscMeasureInitialDeltas(pDevExt); 4186 4186 if ( RT_SUCCESS(rc) 4187 4187 || ( RT_FAILURE(rc) … … 4209 4209 if (pGipCpuWorker->i64TSCDelta == INT64_MAX) 4210 4210 { 4211 int rc2 = supdrv MeasureTscDeltaOne(pDevExt, iCpu);4211 int rc2 = supdrvTscMeasureDeltaOne(pDevExt, iCpu); 4212 4212 if (RT_FAILURE(rc2) && RT_SUCCESS(rc)) 4213 4213 rc = rc2; … … 4611 4611 4612 4612 /* Measure it. */ 4613 rc = supdrv MeasureTscDeltaOne(pDevExt, iGipCpu);4613 rc = supdrvTscMeasureDeltaOne(pDevExt, iGipCpu); 4614 4614 if (rc != VERR_SUPDRV_TSC_DELTA_MEASUREMENT_FAILED) 4615 4615 { … … 4748 4748 4749 4749 /* Need to measure the delta an try again. */ 4750 rc = supdrv MeasureTscDeltaOne(pDevExt, iGipCpu);4750 rc = supdrvTscMeasureDeltaOne(pDevExt, iGipCpu); 4751 4751 Assert(pGip->aCPUs[iGipCpu].i64TSCDelta != INT64_MAX || RT_FAILURE_NP(rc)); 4752 4752 /** @todo should probably delay on failure... dpc watchdogs */
Note:
See TracChangeset
for help on using the changeset viewer.