Changeset 92522 in vbox for trunk/src/VBox/VMM/VMMR3/NEMR3Native-linux.cpp
- Timestamp:
- Nov 20, 2021 2:41:05 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR3/NEMR3Native-linux.cpp
r92520 r92522 534 534 STAMR3RegisterF(pVM, &pNemCpu->StatImportPendingInterrupt, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, "Number of times an interrupt was pending when importing from KVM", "/NEM/CPU%u/ImportPendingInterrupt", idCpu); 535 535 STAMR3RegisterF(pVM, &pNemCpu->StatExportPendingInterrupt, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, "Number of times an interrupt was pending when exporting to KVM", "/NEM/CPU%u/ExportPendingInterrupt", idCpu); 536 STAMR3RegisterF(pVM, &pNemCpu->StatFlushExitOnReturn, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, "Number of times a KVM_EXIT_IO or KVM_EXIT_MMIO was flushed before returning to EM", "/NEM/CPU%u/FlushExitOnReturn", idCpu); 536 537 STAMR3RegisterF(pVM, &pNemCpu->StatQueryCpuTick, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, "Number of TSC queries", "/NEM/CPU%u/QueryCpuTick", idCpu); 537 538 STAMR3RegisterF(pVM, &pNemCpu->StatExitTotal, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, "All exits", "/NEM/CPU%u/Exit", idCpu); … … 2247 2248 2248 2249 2249 static VBOXSTRICTRC nemHCLnxHandleExit(PVMCC pVM, PVMCPUCC pVCpu, struct kvm_run *pRun )2250 static VBOXSTRICTRC nemHCLnxHandleExit(PVMCC pVM, PVMCPUCC pVCpu, struct kvm_run *pRun, bool *pfStatefulExit) 2250 2251 { 2251 2252 STAM_REL_COUNTER_INC(&pVCpu->nem.s.StatExitTotal); … … 2258 2259 case KVM_EXIT_IO: 2259 2260 STAM_REL_COUNTER_INC(&pVCpu->nem.s.StatExitIo); 2261 *pfStatefulExit = true; 2260 2262 return nemHCLnxHandleExitIo(pVM, pVCpu, pRun); 2261 2263 2262 2264 case KVM_EXIT_MMIO: 2263 2265 STAM_REL_COUNTER_INC(&pVCpu->nem.s.StatExitMmio); 2266 *pfStatefulExit = true; 2264 2267 return nemHCLnxHandleExitMmio(pVM, pVCpu, pRun); 2265 2268 … … 2411 2414 const bool fSingleStepping = DBGFIsStepping(pVCpu); 2412 2415 VBOXSTRICTRC rcStrict = VINF_SUCCESS; 2416 bool fStatefulExit = false; /* For MMIO and IO exits. */ 2413 2417 for (unsigned iLoop = 0;; iLoop++) 2414 2418 { … … 2491 2495 } 2492 2496 #endif 2497 fStatefulExit = false; 2493 2498 if (RT_LIKELY(rcLnx == 0 || errno == EINTR)) 2494 2499 { 2495 2500 /* 2496 * Deal with the message.2501 * Deal with the exit. 2497 2502 */ 2498 rcStrict = nemHCLnxHandleExit(pVM, pVCpu, pRun );2503 rcStrict = nemHCLnxHandleExit(pVM, pVCpu, pRun, &fStatefulExit); 2499 2504 if (rcStrict == VINF_SUCCESS) 2500 2505 { /* hopefully likely */ } … … 2539 2544 } /* the run loop */ 2540 2545 2546 2547 /* 2548 * If the last exit was stateful, commit the state we provided before 2549 * returning to the EM loop so we have a consistent state and can safely 2550 * be rescheduled and whatnot. (There is no 'ing way to reset the kernel 2551 * side completion callback for these stateful i/o exits.) 2552 */ 2553 if (fStatefulExit) 2554 { 2555 pRun->immediate_exit = 1; 2556 int rcLnx = ioctl(pVCpu->nem.s.fdVCpu, KVM_RUN, 0UL); 2557 pRun->immediate_exit = 0; 2558 Log(("NEM/%u: Flushed stateful exit -> %d/%d exit_reason=%d\n", pVCpu->idCpu, rcLnx, errno, pRun->exit_reason)); 2559 STAM_REL_COUNTER_INC(&pVCpu->nem.s.StatFlushExitOnReturn); 2560 } 2541 2561 2542 2562 /*
Note:
See TracChangeset
for help on using the changeset viewer.