Changeset 53438 in vbox
- Timestamp:
- Dec 3, 2014 7:13:54 PM (10 years ago)
- svn:sync-xref-src-repo-rev:
- 97134
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR3/TM.cpp
r53433 r53438 313 313 314 314 /* 315 * Handle deprecated TM settings. 316 */ 317 do 318 { 319 /** @todo make these runtime warnings instead of errors that refuse to start 320 * the VM? */ 321 bool fTSCVirtualized; 322 rc = CFGMR3QueryBool(pCfgHandle, "TSCVirtualized", &fTSCVirtualized); 323 if (RT_SUCCESS(rc)) 324 return VMSetError(pVM, VERR_CFGM_CONFIG_UNKNOWN_VALUE, RT_SRC_POS, 325 N_("Configuration error: TM setting \"TSCVirtualized\" is no longer supported. Use the \"Mode\" setting instead.")); 326 327 bool fForceUseRealTSC; 328 rc = CFGMR3QueryBool(pCfgHandle, "UseRealTSC", &fForceUseRealTSC); 329 if (RT_SUCCESS(rc)) 330 return VMSetError(pVM, VERR_CFGM_CONFIG_UNKNOWN_VALUE, RT_SRC_POS, 331 N_("Configuration error: TM setting \"UseRealTSC\" is no longer supported. Use the \"Mode\" setting instead.")); 332 333 bool fMaybeUseOffsettedHostTSC; 334 rc = CFGMR3QueryBool(pCfgHandle, "MaybeUseOffsettedHostTSC", &fMaybeUseOffsettedHostTSC); 335 if (RT_SUCCESS(rc)) 336 return VMSetError(pVM, VERR_CFGM_CONFIG_UNKNOWN_VALUE, RT_SRC_POS, 337 N_("Configuration error: TM setting \"MaybeUseOffsettedHostTSC\" is no longer supported. Use the \"Mode\" setting instead.")); 338 } while(0); 315 * Specific errors about some obsolete TM settings (remove after 2015-12-03). 316 */ 317 if (CFGMR3Exists(pCfgHandle, "TSCVirtualized")) 318 return VMSetError(pVM, VERR_CFGM_CONFIG_UNKNOWN_VALUE, RT_SRC_POS, 319 N_("Configuration error: TM setting \"TSCVirtualized\" is no longer supported. Use the \"Mode\" setting instead.")); 320 if (CFGMR3Exists(pCfgHandle, "UseRealTSC")) 321 return VMSetError(pVM, VERR_CFGM_CONFIG_UNKNOWN_VALUE, RT_SRC_POS, 322 N_("Configuration error: TM setting \"UseRealTSC\" is no longer supported. Use the \"Mode\" setting instead.")); 323 324 if (CFGMR3Exists(pCfgHandle, "MaybeUseOffsettedHostTSC")) 325 return VMSetError(pVM, VERR_CFGM_CONFIG_UNKNOWN_VALUE, RT_SRC_POS, 326 N_("Configuration error: TM setting \"MaybeUseOffsettedHostTSC\" is no longer supported. Use the \"Mode\" setting instead.")); 339 327 340 328 /* 341 329 * Validate the rest of the TM settings. 342 330 */ 343 if (!CFGMR3AreValuesValid(pCfgHandle, 344 "Mode\0" 345 "TSCTicksPerSecond\0" 346 "TSCTiedToExecution\0" 347 "TSCNotTiedToHalt\0" 348 "ScheduleSlack\0" 349 "CatchUpStopThreshold\0" 350 "CatchUpGiveUpThreshold\0" 351 "CatchUpStartThreshold0\0CatchUpStartThreshold1\0CatchUpStartThreshold2\0CatchUpStartThreshold3\0" 352 "CatchUpStartThreshold4\0CatchUpStartThreshold5\0CatchUpStartThreshold6\0CatchUpStartThreshold7\0" 353 "CatchUpStartThreshold8\0CatchUpStartThreshold9\0" 354 "CatchUpPrecentage0\0CatchUpPrecentage1\0CatchUpPrecentage2\0CatchUpPrecentage3\0" 355 "CatchUpPrecentage4\0CatchUpPrecentage5\0CatchUpPrecentage6\0CatchUpPrecentage7\0" 356 "CatchUpPrecentage8\0CatchUpPrecentage9\0" 357 "UTCOffset\0" 358 "WarpDrivePercentage\0" 359 "HostHzMax\0" 360 "HostHzFudgeFactorTimerCpu\0" 361 "HostHzFudgeFactorOtherCpu\0" 362 "HostHzFudgeFactorCatchUp100\0" 363 "HostHzFudgeFactorCatchUp200\0" 364 "HostHzFudgeFactorCatchUp400\0" 365 "TimerMillies\0" 366 )) 367 return VMSetError(pVM, VERR_CFGM_CONFIG_UNKNOWN_NODE, RT_SRC_POS, N_("Configuration error: Invalid config key for TM.")); 331 rc = CFGMR3ValidateConfig(pCfgHandle, "/", 332 "Mode|" 333 "TSCTicksPerSecond|" 334 "TSCTiedToExecution|" 335 "TSCNotTiedToHalt|" 336 "ScheduleSlack|" 337 "CatchUpStopThreshold|" 338 "CatchUpGiveUpThreshold|" 339 "CatchUpStartThreshold0|CatchUpStartThreshold1|CatchUpStartThreshold2|CatchUpStartThreshold3|" 340 "CatchUpStartThreshold4|CatchUpStartThreshold5|CatchUpStartThreshold6|CatchUpStartThreshold7|" 341 "CatchUpStartThreshold8|CatchUpStartThreshold9|" 342 "CatchUpPrecentage0|CatchUpPrecentage1|CatchUpPrecentage2|CatchUpPrecentage3|" 343 "CatchUpPrecentage4|CatchUpPrecentage5|CatchUpPrecentage6|CatchUpPrecentage7|" 344 "CatchUpPrecentage8|CatchUpPrecentage9|" 345 "UTCOffset|" 346 "WarpDrivePercentage|" 347 "HostHzMax|" 348 "HostHzFudgeFactorTimerCpu|" 349 "HostHzFudgeFactorOtherCpu|" 350 "HostHzFudgeFactorCatchUp100|" 351 "HostHzFudgeFactorCatchUp200|" 352 "HostHzFudgeFactorCatchUp400|" 353 "TimerMillies", 354 "", 355 "TM", 0); 356 if (RT_FAILURE(rc)) 357 return rc; 368 358 369 359 /* 370 360 * Determine the TSC configuration and frequency. 371 361 */ 372 /** @cfgm{/TM/Mode, string} 373 * The name of the time-keeping mode. The default is picked dynamically based 374 * on configuration of the VM. */ 362 /** @cfgm{/TM/Mode, string, Depends on the CPU and VM config} 363 * The name of the TSC mode to use: VirtTSCEmulated, RealTSCOffset or Dyamic. 364 * The default depends on the VM configuration and the capabilities of the 365 * host CPU. Other config options or runtime changes may override the TSC 366 * mode specified here. 367 * @todo r=bird: s/Mode/TSCMode/g */ 375 368 char szMode[32]; 376 369 rc = CFGMR3QueryString(pCfgHandle, "Mode", szMode, sizeof(szMode)); 377 370 if (rc == VERR_CFGM_VALUE_NOT_FOUND) 378 pVM->tm.s.enmMode = tmR3HasFixedTSC(pVM) ? TMMODE_DYNAMIC : TMMODE_VIRT_TSC_EMULATED; 371 { 372 /** @todo Rainy-day/never: Dynamic mode isn't currently suitable for SMP VMs, so 373 * fall back on the more expensive emulated mode. With the current TSC handling 374 * (frequent switching between offsetted mode and taking VM exits, on all VCPUs 375 * without any kind of coordination) will lead to inconsistent TSC behavior with 376 * guest SMP, including TSC going backwards. */ 377 pVM->tm.s.enmMode = pVM->cCpus == 1 && tmR3HasFixedTSC(pVM) ? TMMODE_DYNAMIC : TMMODE_VIRT_TSC_EMULATED; 378 } 379 379 else if (RT_FAILURE(rc)) 380 380 return VMSetError(pVM, rc, RT_SRC_POS, N_("Configuration error: Failed to querying string value \"Mode\"")); 381 381 else 382 382 { 383 AssertRC(rc);384 383 if (!RTStrCmp(szMode, "VirtTSCEmulated")) 385 384 pVM->tm.s.enmMode = TMMODE_VIRT_TSC_EMULATED; … … 391 390 return VMSetError(pVM, rc, RT_SRC_POS, N_("Configuration error: Unrecognized TM mode value \"%s\""), szMode); 392 391 } 393 394 /** @todo needs a better fix, for now disable offsetted mode for VMs395 * with more than one VCPU. With the current TSC handling (frequent396 * switching between offsetted mode and taking VM exits, on all VCPUs397 * without any kind of coordination) it will lead to inconsistent TSC398 * behavior with guest SMP, including TSC going backwards. */399 if ( pVM->cCpus != 1400 && pVM->tm.s.enmMode != TMMODE_REAL_TSC_OFFSET)401 pVM->tm.s.enmMode = TMMODE_VIRT_TSC_EMULATED;402 392 403 393 /** @cfgm{/TM/TSCTicksPerSecond, uint32_t, Current TSC frequency from GIP} … … 2854 2844 TMR3NotifySuspend(pVM, pVCpu); 2855 2845 2856 /** @todo should probably switch TM mode to virt-tsc-emulated if it isn't 2857 * already. */ 2846 /** @todo Should switch TM mode to virt-tsc-emulated if it isn't alread!. */ 2858 2847 pVM->tm.s.u32VirtualWarpDrivePercentage = u32Percent; 2859 2848 pVM->tm.s.fVirtualWarpDrive = u32Percent != 100; … … 3257 3246 * @param pVM Pointer to the VM. 3258 3247 */ 3259 static const char * 3248 static const char *tmR3GetModeName(PVM pVM) 3260 3249 { 3261 3250 Assert(pVM);
Note:
See TracChangeset
for help on using the changeset viewer.