Changeset 54447 in vbox
- Timestamp:
- Feb 24, 2015 1:38:39 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/Support/SUPDrvGip.cpp
r54409 r54447 712 712 * @param nsElapsed The number of nano seconds elapsed. 713 713 * @param cElapsedTscTicks The corresponding number of TSC ticks. 714 */ 715 static void supdrvGipInitSetCpuFreq(PSUPGLOBALINFOPAGE pGip, uint64_t nsElapsed, uint64_t cElapsedTscTicks) 714 * @param iTick The tick number for debugging. 715 */ 716 static void supdrvGipInitSetCpuFreq(PSUPGLOBALINFOPAGE pGip, uint64_t nsElapsed, uint64_t cElapsedTscTicks, uint32_t iTick) 716 717 { 717 718 /* … … 736 737 ASMAtomicWriteU64(&pGip->u64CpuHz, uCpuHz); 737 738 if (pGip->u32Mode != SUPGIPMODE_ASYNC_TSC) 739 { 738 740 ASMAtomicWriteU64(&pGip->aCPUs[0].u64CpuHz, uCpuHz); 741 742 /* For inspecting the frequency calcs using tstGIP-2, debugger or similar. */ 743 if (iTick + 1 < pGip->cCpus) 744 ASMAtomicWriteU64(&pGip->aCPUs[iTick + 1].u64CpuHz, uCpuHz); 745 } 739 746 } 740 747 … … 833 840 * calculations. 834 841 */ 835 else if (cNsElapsed <= GIP_TSC_REFINE_PERIOD_IN_SECS * 5 * RT_NS_1SEC_64) 836 { 837 int rc = RTTimerStart(pTimer, RT_NS_1SEC); 838 AssertRC(rc); 839 return; 840 } 841 else 842 else if (cNsElapsed > GIP_TSC_REFINE_PERIOD_IN_SECS * 5 * RT_NS_1SEC_64) 842 843 { 843 844 SUPR0Printf("vboxdrv: Failed to refine invariant TSC frequency because deltas are unavailable after %u (%u) seconds\n", … … 845 846 SUPR0Printf("vboxdrv: start: %u, %u, %#llx stop: %u, %u, %#llx\n", 846 847 iStartCpuSet, iStartGipCpu, iStartTscDelta, iStopCpuSet, iStopGipCpu, iStopTscDelta); 848 int rc = RTTimerStop(pTimer); 849 AssertRC(rc); 847 850 return; 848 851 } … … 859 862 || cNsElapsed < RT_NS_1SEC * 2) 860 863 { 861 supdrvGipInitSetCpuFreq(pGip, cNsElapsed, cTscTicksElapsed );864 supdrvGipInitSetCpuFreq(pGip, cNsElapsed, cTscTicksElapsed, iTick); 862 865 863 866 /* 864 * Reschedule the timer if we haven't yetreached the defined refinement period.867 * Stop the timer once we've reached the defined refinement period. 865 868 */ 866 if (cNsElapsed <GIP_TSC_REFINE_PERIOD_IN_SECS * RT_NS_1SEC_64)867 { 868 int rc = RTTimerSt art(pTimer, RT_NS_1SEC);869 if (cNsElapsed > GIP_TSC_REFINE_PERIOD_IN_SECS * RT_NS_1SEC_64) 870 { 871 int rc = RTTimerStop(pTimer); 869 872 AssertRC(rc); 870 873 } 874 } 875 else 876 { 877 int rc = RTTimerStop(pTimer); 878 AssertRC(rc); 871 879 } 872 880 } … … 927 935 * mapped (we want a stable frequency for all VMs). 928 936 */ 929 rc = RTTimerCreateEx(&pDevExt->pInvarTscRefineTimer, 0 /* one-shot */,937 rc = RTTimerCreateEx(&pDevExt->pInvarTscRefineTimer, RT_NS_1SEC, 930 938 RTTIMER_FLAGS_CPU(RTMpCpuIdToSetIndex(pDevExt->idCpuInvarTscRefine)), 931 939 supdrvInitRefineInvariantTscFreqTimer, pDevExt); … … 940 948 if (rc == VERR_CPU_OFFLINE || rc == VERR_NOT_SUPPORTED) 941 949 { 942 rc = RTTimerCreateEx(&pDevExt->pInvarTscRefineTimer, 0 /* one-shot */, RTTIMER_FLAGS_CPU_ANY,950 rc = RTTimerCreateEx(&pDevExt->pInvarTscRefineTimer, RT_NS_1SEC, RTTIMER_FLAGS_CPU_ANY, 943 951 supdrvInitRefineInvariantTscFreqTimer, pDevExt); 944 952 if (RT_SUCCESS(rc)) … … 1169 1177 * Calculate the TSC frequency and update it (shared with the refinement timer). 1170 1178 */ 1171 supdrvGipInitSetCpuFreq(pGip, nsStop - nsStart, uTscStop - uTscStart );1179 supdrvGipInitSetCpuFreq(pGip, nsStop - nsStart, uTscStop - uTscStart, 0); 1172 1180 return VINF_SUCCESS; 1173 1181 }
Note:
See TracChangeset
for help on using the changeset viewer.