Changeset 71293 in vbox for trunk/src/VBox/VMM/VMMR3
- Timestamp:
- Mar 9, 2018 9:11:20 PM (7 years ago)
- svn:sync-xref-src-repo-rev:
- 121228
- Location:
- trunk/src/VBox/VMM/VMMR3
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR3/EM.cpp
r71020 r71293 430 430 EM_REG_PROFILE(&pVCpu->em.s.StatIEMThenREM, "/PROF/CPU%d/EM/IEMThenRem", "Profiling IEM-then-REM instruction execution (by IEM)."); 431 431 EM_REG_PROFILE(&pVCpu->em.s.StatNEMEntry, "/PROF/CPU%d/EM/NEMEnter", "Profiling NEM entry overhead."); 432 #endif /* VBOX_WITH_STATISTICS */ 432 433 EM_REG_PROFILE(&pVCpu->em.s.StatNEMExec, "/PROF/CPU%d/EM/NEMExec", "Profiling NEM execution."); 433 434 EM_REG_COUNTER(&pVCpu->em.s.StatNEMExecuteCalled, "/PROF/CPU%d/EM/NEMExecuteCalled", "Number of times enmR3NEMExecute is called."); 435 #ifdef VBOX_WITH_STATISTICS 434 436 EM_REG_PROFILE(&pVCpu->em.s.StatREMEmu, "/PROF/CPU%d/EM/REMEmuSingle", "Profiling single instruction REM execution."); 435 437 EM_REG_PROFILE(&pVCpu->em.s.StatREMExec, "/PROF/CPU%d/EM/REMExec", "Profiling REM execution."); … … 438 440 EM_REG_PROFILE(&pVCpu->em.s.StatRAWExec, "/PROF/CPU%d/EM/RAWExec", "Profiling Raw Mode execution."); 439 441 EM_REG_PROFILE(&pVCpu->em.s.StatRAWTail, "/PROF/CPU%d/EM/RAWTail", "Profiling Raw Mode tail overhead."); 440 441 442 #endif /* VBOX_WITH_STATISTICS */ 442 443 -
trunk/src/VBox/VMM/VMMR3/EMR3Nem.cpp
r71031 r71293 361 361 *pfFFDone = false; 362 362 363 STAM_ COUNTER_INC(&pVCpu->em.s.StatNEMExecuteCalled);363 STAM_REL_COUNTER_INC(&pVCpu->em.s.StatNEMExecuteCalled); 364 364 365 365 /* … … 421 421 * Execute the code. 422 422 */ 423 STAM_PROFILE_ADV_STOP(&pVCpu->em.s.StatNEMEntry, a);424 425 423 if (RT_LIKELY(emR3IsExecutionAllowed(pVM, pVCpu))) 426 424 { 427 STAM_PROFILE_START(&pVCpu->em.s.StatNEMExec, x); 425 STAM_PROFILE_ADV_STOP(&pVCpu->em.s.StatNEMEntry, a); 426 STAM_REL_PROFILE_START(&pVCpu->em.s.StatNEMExec, x); 428 427 rcStrict = NEMR3RunGC(pVM, pVCpu); 429 STAM_ PROFILE_STOP(&pVCpu->em.s.StatNEMExec, x);428 STAM_REL_PROFILE_STOP(&pVCpu->em.s.StatNEMExec, x); 430 429 } 431 430 else 432 431 { 433 432 /* Give up this time slice; virtual time continues */ 433 STAM_PROFILE_ADV_STOP(&pVCpu->em.s.StatNEMEntry, a); 434 434 STAM_REL_PROFILE_ADV_START(&pVCpu->em.s.StatCapped, u); 435 435 RTThreadSleep(5); -
trunk/src/VBox/VMM/VMMR3/NEMR3Native-win.cpp
r71289 r71293 1100 1100 VM_SET_MAIN_EXECUTION_ENGINE(pVM, VM_EXEC_ENGINE_NATIVE_API); 1101 1101 Log(("NEM: Marked active!\n")); 1102 1103 /* Register release statistics */ 1104 for (VMCPUID iCpu = 0; iCpu < pVM->cCpus; iCpu++) 1105 { 1106 PNEMCPU pNemCpu = &pVM->aCpus[iCpu].nem.s; 1107 STAMR3RegisterF(pVM, &pNemCpu->StatExitPortIo, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, "Number of port I/O exits", "/NEM/CPU%u/ExitPortIo", iCpu); 1108 STAMR3RegisterF(pVM, &pNemCpu->StatExitMemUnmapped, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, "Number of unmapped memory exits", "/NEM/CPU%u/ExitMemUnmapped", iCpu); 1109 STAMR3RegisterF(pVM, &pNemCpu->StatExitMemIntercept, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, "Number of intercepted memory exits", "/NEM/CPU%u/ExitMemIntercept", iCpu); 1110 STAMR3RegisterF(pVM, &pNemCpu->StatExitHalt, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, "Number of HLT exits", "/NEM/CPU%u/ExitHalt", iCpu); 1111 STAMR3RegisterF(pVM, &pNemCpu->StatGetMsgTimeout, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, "Number of get message timeouts/alerts", "/NEM/CPU%u/GetMsgTimeout", iCpu); 1112 STAMR3RegisterF(pVM, &pNemCpu->StatStopCpuSuccess, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, "Number of successful CPU stops", "/NEM/CPU%u/StopCpuSuccess", iCpu); 1113 STAMR3RegisterF(pVM, &pNemCpu->StatStopCpuPending, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, "Number of pending CPU stops", "/NEM/CPU%u/StopCpuPending", iCpu); 1114 STAMR3RegisterF(pVM, &pNemCpu->StatCancelChangedState, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, "Number of cancel changed state", "/NEM/CPU%u/CancelChangedState", iCpu); 1115 STAMR3RegisterF(pVM, &pNemCpu->StatCancelAlertedThread, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, "Number of cancel alerted EMT", "/NEM/CPU%u/CancelAlertedEMT", iCpu); 1116 STAMR3RegisterF(pVM, &pNemCpu->StatBreakOnFFPre, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, "Number of pre execution FF breaks", "/NEM/CPU%u/BreakOnFFPre", iCpu); 1117 STAMR3RegisterF(pVM, &pNemCpu->StatBreakOnFFPost, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, "Number of post execution FF breaks", "/NEM/CPU%u/BreakOnFFPost", iCpu); 1118 STAMR3RegisterF(pVM, &pNemCpu->StatBreakOnCancel, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, "Number of cancel execution breaks", "/NEM/CPU%u/BreakOnCancel", iCpu); 1119 STAMR3RegisterF(pVM, &pNemCpu->StatBreakOnStatus, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, "Number of status code breaks", "/NEM/CPU%u/BreakOnStatus", iCpu); 1120 } 1102 1121 } 1103 1122 } … … 1275 1294 int nemR3NativeInitCompleted(PVM pVM, VMINITCOMPLETED enmWhat) 1276 1295 { 1296 //BOOL fRet = SetThreadPriority(GetCurrentThread(), 0); 1297 //AssertLogRel(fRet); 1298 1277 1299 NOREF(pVM); NOREF(enmWhat); 1278 1300 return VINF_SUCCESS; … … 2235 2257 * The CPU creation function boils down to a VidMessageSlotMap call that sets up 2236 2258 * and maps a message buffer into ring-3 for async communication with hyper-V 2237 * and/or the VID.SYS thread actually running the CPU . When for instance a2238 * VMEXIT is encountered, hyper-V sends a message that the2239 * WHvRunVirtualProcessor API retrieves (and later acknowledges) via2240 * VidMessageSlotHandleAndGetNext. It should be noteded that2259 * and/or the VID.SYS thread actually running the CPU thru 2260 * WinHvRunVpDispatchLoop(). When for instance a VMEXIT is encountered, hyper-V 2261 * sends a message that the WHvRunVirtualProcessor API retrieves (and later 2262 * acknowledges) via VidMessageSlotHandleAndGetNext. It should be noteded that 2241 2263 * WHvDeleteVirtualProcessor doesn't do much as there seems to be no partner 2242 2264 * function VidMessagesSlotMap that reverses what it did. … … 2257 2279 * VMEXIT message. Hyper-V / VID.SYS will return information about the message 2258 2280 * in the message buffer mapping, and WHvRunVirtualProcessor will convert that 2259 * into it's own WHV_RUN_VP_EXIT_CONTEXT format.2281 * finto it's own WHV_RUN_VP_EXIT_CONTEXT format. 2260 2282 * 2261 2283 * Other threads can interrupt the execution by using WHvCancelVirtualProcessor, … … 2288 2310 * and 5% for MMIO. 2289 2311 * 2312 * While the tests we've done are using tight tight loops only doing port I/O 2313 * and MMIO, the problem is clearly visible when running regular guest OSes. 2314 * Anything that hammers the VGA device would be suffering, for example: 2315 * 2316 * - Windows 2000 boot screen animation overloads us with MMIO exits 2317 * and won't even boot because all the time is spent in interrupt 2318 * handlers and redrawin the screen. 2319 * 2320 * - DSL 4.4 and its bootmenu logo is slower than molasses in january. 2321 * 2322 * We have not found a workaround for this yet. 2323 * 2324 * Something that might improve the issue a little is to detect blocks with 2325 * excessive MMIO and port I/O exits and emulate instructions to cover 2326 * multiple exits before letting Hyper-V have a go at the guest execution 2327 * again. This will only improve the situation under some circumstances, 2328 * since emulating instructions without recompilation can be expensive, so 2329 * there will only be real gains if the exitting instructions are tightly 2330 * packed. 2331 * 2290 2332 * 2291 2333 * - The WHvCancelVirtualProcessor API schedules a dummy usermode APC callback … … 2417 2459 * 2418 2460 * 2419 * - Why does WINHVR.SYS (or VID.SYS) only query/set 32 registers at the time2420 * thru theHvCallGetVpRegisters and HvCallSetVpRegisters hypercalls?2461 * - Why does VID.SYS only query/set 32 registers at the time thru the 2462 * HvCallGetVpRegisters and HvCallSetVpRegisters hypercalls? 2421 2463 * 2422 2464 * We've not trouble getting/setting all the registers defined by 2423 * WHV_REGISTER_NAME in one hypercall (around 80)... 2465 * WHV_REGISTER_NAME in one hypercall (around 80). Some kind of stack 2466 * buffering or similar? 2424 2467 * 2425 2468 *
Note:
See TracChangeset
for help on using the changeset viewer.