Changeset 53142 in vbox for trunk/src/VBox/HostDrivers/Support
- Timestamp:
- Oct 24, 2014 2:03:12 PM (10 years ago)
- svn:sync-xref-src-repo-rev:
- 96675
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/Support/SUPDrv.c
r53106 r53142 5954 5954 /* 5955 5955 * Sleep wait since the TSC frequency is constant, eases host load. 5956 * Shorter interval produces more variance in the frequency (esp. Windows). 5956 5957 */ 5957 #if 05958 RTThreadSleep(98);5959 do5960 {5961 int64_t cNsWaited;5962 u64NanoTsAfter = RTTimeSystemNanoTS();5963 cNsWaited = u64NanoTsAfter - u64NanoTs;5964 if (cNsWaited > RT_NS_100MS)5965 {5966 uint64_t cNsBusyWait = RT_NS_1MS;5967 for (;;)5968 {5969 u64NanoTsAfter = RTTimeSystemNanoTS();5970 if (u64NanoTsAfter < cNsBusyWait + cNsWaited + u64NanoTs)5971 ASMNopPause();5972 else5973 break;5974 }5975 break;5976 }5977 } while (1);5978 #else5979 5958 RTThreadSleep(200); /* Sleeping shorter produces a tad more variance in the frequency than I'd like. */ 5980 5959 u64NanoTsAfter = RTTimeSystemNanoTS(); … … 5982 5961 ASMNopPause(); 5983 5962 u64NanoTsAfter = RTTimeSystemNanoTS(); 5984 #endif5985 5963 } 5986 5964 else … … 6018 5996 && pGipCpuAfter->i64TSCDelta != INT64_MAX) 6019 5997 { 6020 u64TscBefore += pGipCpuBefore->i64TSCDelta;6021 u64TscAfter += pGipCpuAfter->i64TSCDelta;5998 u64TscBefore -= pGipCpuBefore->i64TSCDelta; 5999 u64TscAfter -= pGipCpuAfter->i64TSCDelta; 6022 6000 6023 6001 SUPR0Printf("vboxdrv: TSC frequency is %lu Hz - invariant, kernel timer granularity is %lu Ns\n", … … 6094 6072 /* 6095 6073 * Find a reasonable update interval and initialize the structure. 6096 * 6097 * If we have an invariant TSC, use a larger update interval as then 6098 * we get better accuracy along with lower host load. 6099 */ 6100 u32MinInterval = supdrvIsInvariantTsc() ? RT_NS_100MS : RT_NS_10MS; 6074 */ 6075 /** @todo figure out why using a 100Ms interval upsets timekeeping in VMs. 6076 * See @bugref{6710}. */ 6077 u32MinInterval = RT_NS_10MS; 6101 6078 u32SystemResolution = RTTimerGetSystemGranularity(); 6102 6079 u32Interval = u32MinInterval; … … 6279 6256 */ 6280 6257 if (pGipCpu->i64TSCDelta != INT64_MAX) 6281 u64TSC += pGipCpu->i64TSCDelta;6258 u64TSC -= pGipCpu->i64TSCDelta; 6282 6259 } 6283 6260 … … 7075 7052 static SUPGIPMODE supdrvGipDeterminTscMode(PSUPDRVDEVEXT pDevExt) 7076 7053 { 7054 #if 0 7077 7055 if (supdrvIsInvariantTsc()) 7078 7056 return SUPGIPMODE_SYNC_TSC; /** @todo Switch to SUPGIPMODE_INVARIANT_TSC later. */ 7057 #endif 7079 7058 7080 7059 /* … … 7341 7320 7342 7321 /* 7343 * For invariant TSC support, we take only 1 interval as there is a problem on7344 * Windows where we have an occasional (but reccurring) sour value that messes up7345 * the history. Also, since the update interval is pretty long with the invariant7346 * TSC case this works accurately enough.7347 */7348 if (supdrvIsInvariantTsc())7349 {7350 u32UpdateIntervalTSC = (uint32_t)u64TSCDelta;7351 u32UpdateIntervalTSCSlack = u32UpdateIntervalTSC >> 6;7352 }7353 /*7354 7322 * UpdateIntervalTSC = average of last 8,2,1 intervals depending on update HZ. 7355 */ 7356 else if (pGip->u32UpdateHz >= 1000) 7323 * 7324 * On Windows, we have an occasional (but recurring) sour value that messed up 7325 * the history but taking only 1 interval reduces the precision overall. 7326 * However, this problem existed before the invariant mode was introduced. 7327 */ 7328 if ( supdrvIsInvariantTsc() 7329 || pGip->u32UpdateHz >= 1000) 7357 7330 { 7358 7331 uint32_t u32;
Note:
See TracChangeset
for help on using the changeset viewer.