Changeset 72526 in vbox for trunk/src/VBox/VMM/VMMR3
- Timestamp:
- Jun 12, 2018 1:06:02 PM (6 years ago)
- Location:
- trunk/src/VBox/VMM/VMMR3
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR3/NEMR3.cpp
r72470 r72526 307 307 308 308 309 /** 310 * Indicates to TM that TMTSCMODE_NATIVE_API should be used for TSC. 311 * 312 * @returns true if TMTSCMODE_NATIVE_API must be used, otherwise @c false. 313 * @param pVM The cross context VM structure. 314 */ 315 VMMR3_INT_DECL(bool) NEMR3NeedSpecialTscMode(PVM pVM) 316 { 317 #ifdef VBOX_WITH_NATIVE_NEM 318 # ifdef RT_OS_WINDOWS 319 if (VM_IS_NEM_ENABLED(pVM)) 320 return true; 321 # endif 322 #else 323 RT_NOREF(pVM); 324 #endif 325 return false; 326 } 327 328 329 309 330 VMMR3_INT_DECL(VBOXSTRICTRC) NEMR3RunGC(PVM pVM, PVMCPU pVCpu) 310 331 { -
trunk/src/VBox/VMM/VMMR3/NEMR3Native-win.cpp
r72522 r72526 1238 1238 STAMR3RegisterF(pVM, &pNemCpu->StatImportOnReturn, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, "Number of state imports on loop return", "/NEM/CPU%u/ImportOnReturn", iCpu); 1239 1239 STAMR3RegisterF(pVM, &pNemCpu->StatImportOnReturnSkipped, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, "Number of skipped state imports on loop return", "/NEM/CPU%u/ImportOnReturnSkipped", iCpu); 1240 STAMR3RegisterF(pVM, &pNemCpu->StatQueryCpuTick, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, "Number of TSC queries", "/NEM/CPU%u/QueryCpuTick", iCpu); 1240 1241 } 1241 1242 -
trunk/src/VBox/VMM/VMMR3/TM.cpp
r72522 r72526 127 127 #include <VBox/vmm/mm.h> 128 128 #include <VBox/vmm/hm.h> 129 #include <VBox/vmm/nem.h> 129 130 #include <VBox/vmm/gim.h> 130 131 #include <VBox/vmm/ssm.h> … … 381 382 * without any kind of coordination) will lead to inconsistent TSC behavior with 382 383 * guest SMP, including TSC going backwards. */ 383 pVM->tm.s.enmTSCMode = pVM->cCpus == 1 && tmR3HasFixedTSC(pVM) ? TMTSCMODE_DYNAMIC : TMTSCMODE_VIRT_TSC_EMULATED; 384 pVM->tm.s.enmTSCMode = NEMR3NeedSpecialTscMode(pVM) ? TMTSCMODE_NATIVE_API 385 : pVM->cCpus == 1 && tmR3HasFixedTSC(pVM) ? TMTSCMODE_DYNAMIC : TMTSCMODE_VIRT_TSC_EMULATED; 384 386 } 385 387 else if (RT_FAILURE(rc)) … … 395 397 else 396 398 return VMSetError(pVM, rc, RT_SRC_POS, N_("Configuration error: Unrecognized TM TSC mode value \"%s\""), szTSCMode); 399 if (NEMR3NeedSpecialTscMode(pVM)) 400 { 401 LogRel(("TM: NEM overrides the /TM/TSCMode=%s settings.\n", szTSCMode)); 402 pVM->tm.s.enmTSCMode = TMTSCMODE_NATIVE_API; 403 } 397 404 } 398 405 … … 411 418 else if (RT_FAILURE(rc)) 412 419 return VMSetError(pVM, rc, RT_SRC_POS, N_("Configuration error: Failed to querying bool value \"TSCModeSwitchAllowed\"")); 420 if (pVM->tm.s.fTSCModeSwitchAllowed && pVM->tm.s.enmTSCMode == TMTSCMODE_NATIVE_API) 421 { 422 LogRel(("TM: NEM overrides the /TM/TSCModeSwitchAllowed setting.\n")); 423 pVM->tm.s.fTSCModeSwitchAllowed = false; 424 } 413 425 414 426 /** @cfgm{/TM/TSCTicksPerSecond, uint32_t, Current TSC frequency from GIP} … … 420 432 { 421 433 pVM->tm.s.cTSCTicksPerSecond = tmR3CalibrateTSC(); 422 if ( pVM->tm.s.enmTSCMode != TMTSCMODE_REAL_TSC_OFFSET 434 if ( ( pVM->tm.s.enmTSCMode == TMTSCMODE_DYNAMIC 435 || pVM->tm.s.enmTSCMode == TMTSCMODE_VIRT_TSC_EMULATED) 423 436 && pVM->tm.s.cTSCTicksPerSecond >= _4G) 424 437 { … … 435 448 N_("Configuration error: \"TSCTicksPerSecond\" = %RI64 is not in the range 1MHz..4GHz-1"), 436 449 pVM->tm.s.cTSCTicksPerSecond); 450 else if (pVM->tm.s.enmTSCMode != TMTSCMODE_NATIVE_API) 451 pVM->tm.s.enmTSCMode = TMTSCMODE_VIRT_TSC_EMULATED; 437 452 else 438 pVM->tm.s.enmTSCMode = TMTSCMODE_VIRT_TSC_EMULATED; 453 { 454 LogRel(("TM: NEM overrides the /TM/TSCTicksPerSecond=%RU64 setting.\n", pVM->tm.s.cTSCTicksPerSecond)); 455 pVM->tm.s.cTSCTicksPerSecond = tmR3CalibrateTSC(); 456 } 439 457 440 458 /** @cfgm{/TM/TSCTiedToExecution, bool, false} … … 449 467 return VMSetError(pVM, rc, RT_SRC_POS, 450 468 N_("Configuration error: Failed to querying bool value \"TSCTiedToExecution\"")); 469 if (pVM->tm.s.fTSCTiedToExecution && pVM->tm.s.enmTSCMode == TMTSCMODE_NATIVE_API) 470 return VMSetError(pVM, VERR_INVALID_PARAMETER, RT_SRC_POS, N_("/TM/TSCTiedToExecution is not supported in NEM mode!")); 451 471 if (pVM->tm.s.fTSCTiedToExecution) 452 472 pVM->tm.s.enmTSCMode = TMTSCMODE_VIRT_TSC_EMULATED; 453 473 454 /** @cfgm{/TM/TSCNotTiedToHalt, bool, true} 455 * For overriding the default of TM/TSCTiedToExecution, i.e. set this to false 456 * to make the TSC freeze during HLT. */ 474 475 /** @cfgm{/TM/TSCNotTiedToHalt, bool, false} 476 * This is used with /TM/TSCTiedToExecution to control how TSC operates 477 * accross HLT instructions. When true HLT is considered execution time and 478 * TSC continues to run, while when false (default) TSC stops during halt. */ 457 479 rc = CFGMR3QueryBoolDef(pCfgHandle, "TSCNotTiedToHalt", &pVM->tm.s.fTSCNotTiedToHalt, false); 458 480 if (RT_FAILURE(rc)) … … 572 594 if (pVM->tm.s.fVirtualWarpDrive) 573 595 { 574 pVM->tm.s.enmTSCMode = TMTSCMODE_VIRT_TSC_EMULATED; 575 LogRel(("TM: Warp-drive active. u32VirtualWarpDrivePercentage=%RI32\n", pVM->tm.s.u32VirtualWarpDrivePercentage)); 596 if (pVM->tm.s.enmTSCMode == TMTSCMODE_NATIVE_API) 597 LogRel(("TM: Warp-drive active, escept for TSC which is in NEM mode. u32VirtualWarpDrivePercentage=%RI32\n", 598 pVM->tm.s.u32VirtualWarpDrivePercentage)); 599 else 600 { 601 pVM->tm.s.enmTSCMode = TMTSCMODE_VIRT_TSC_EMULATED; 602 LogRel(("TM: Warp-drive active. u32VirtualWarpDrivePercentage=%RI32\n", pVM->tm.s.u32VirtualWarpDrivePercentage)); 603 } 576 604 } 577 605
Note:
See TracChangeset
for help on using the changeset viewer.