Changeset 72687 in vbox for trunk/src/VBox
- Timestamp:
- Jun 26, 2018 1:52:02 AM (7 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/NEMAllNativeTemplate-win.cpp.h
r72684 r72687 1373 1373 if (VMCPU_CMPXCHG_STATE(pVCpu, VMCPUSTATE_STARTED_EXEC_NEM_CANCELED, VMCPUSTATE_STARTED_EXEC_NEM)) 1374 1374 { 1375 DBGFTRACE_CUSTOM(pVM, "VMCPUSTATE_STARTED_EXEC_NEM -> CANCELED"); 1375 1376 Log8(("nemHCWinCancelRunVirtualProcessor: Switched %u to canceled state\n", pVCpu->idCpu)); 1376 1377 STAM_REL_COUNTER_INC(&pVCpu->nem.s.StatCancelChangedState); … … 1382 1383 if (VMCPU_CMPXCHG_STATE(pVCpu, VMCPUSTATE_STARTED_EXEC_NEM_CANCELED, VMCPUSTATE_STARTED_EXEC_NEM_WAIT)) 1383 1384 { 1385 DBGFTRACE_CUSTOM(pVM, "VMCPUSTATE_STARTED_EXEC_NEM_WAIT -> CANCELED"); 1384 1386 # ifdef IN_RING0 1385 1387 NTSTATUS rcNt = KeAlertThread(??); 1388 DBGFTRACE_CUSTOM(pVM, "KeAlertThread -> %#x", rcNt); 1386 1389 # else 1387 1390 NTSTATUS rcNt = NtAlertThread(pVCpu->nem.s.hNativeThreadHandle); 1391 DBGFTRACE_CUSTOM(pVM, "NtAlertThread -> %#x", rcNt); 1388 1392 # endif 1389 1393 Log8(("nemHCWinCancelRunVirtualProcessor: Alerted %u: %#x\n", pVCpu->idCpu, rcNt)); … … 3741 3745 PGVM pGVM, PGVMCPU pGVCpu) 3742 3746 { 3747 # ifdef DBGFTRACE_ENABLED 3748 HV_MESSAGE const volatile *pMsgForTrace = (HV_MESSAGE const volatile *)(pMappingHeader + 1); 3749 # endif 3750 3743 3751 /* 3744 3752 * Try stopping the processor. If we're lucky we manage to do this before it 3745 3753 * does another VM exit. 3746 3754 */ 3755 DBGFTRACE_CUSTOM(pVM, "nemStop#0"); 3747 3756 # ifdef IN_RING0 3748 3757 pVCpu->nem.s.uIoCtlBuf.idCpu = pGVCpu->idCpu; … … 3752 3761 if (NT_SUCCESS(rcNt)) 3753 3762 { 3763 DBGFTRACE_CUSTOM(pVM, "nemStop#0: okay (%#x)", rcNt); 3754 3764 Log8(("nemHCWinStopCpu: Stopping CPU succeeded (cpu status %u)\n", nemHCWinCpuGetRunningStatus(pVCpu) )); 3755 3765 STAM_REL_COUNTER_INC(&pVCpu->nem.s.StatStopCpuSuccess); … … 3760 3770 if (fRet) 3761 3771 { 3772 DBGFTRACE_CUSTOM(pVM, "nemStop#0: okay"); 3762 3773 Log8(("nemHCWinStopCpu: Stopping CPU succeeded (cpu status %u)\n", nemHCWinCpuGetRunningStatus(pVCpu) )); 3763 3774 STAM_REL_COUNTER_INC(&pVCpu->nem.s.StatStopCpuSuccess); … … 3771 3782 */ 3772 3783 # ifdef IN_RING0 3784 DBGFTRACE_CUSTOM(pVM, "nemStop#0: pending (%#x)", rcNt); 3773 3785 AssertLogRelMsgReturn(rcNt == ERROR_VID_STOP_PENDING, ("rcNt=%#x\n", rcNt), 3774 3786 RT_SUCCESS(rcStrict) ? VERR_NEM_IPE_5 : rcStrict); 3775 3787 # else 3776 3788 DWORD dwErr = RTNtLastErrorValue(); 3789 DBGFTRACE_CUSTOM(pVM, "nemStop#0: pending (%#x)", dwErr); 3777 3790 AssertLogRelMsgReturn(dwErr == ERROR_VID_STOP_PENDING, ("dwErr=%#u (%#x)\n", dwErr, dwErr), 3778 3791 RT_SUCCESS(rcStrict) ? VERR_NEM_IPE_5 : rcStrict); … … 3789 3802 pVCpu->nem.s.uIoCtlBuf.MsgSlotHandleAndGetNext.fFlags = VID_MSHAGN_F_GET_NEXT_MESSAGE; 3790 3803 pVCpu->nem.s.uIoCtlBuf.MsgSlotHandleAndGetNext.cMillies = 30000; /*ms*/ 3791 rcNt = nemR0NtPerformIoControl(pGVM, pGVM->nem.s.IoCtlMessageSlotHandleAndGetNext.uFunction, 3792 &pVCpu->nem.s.uIoCtlBuf.MsgSlotHandleAndGetNext, 3793 sizeof(pVCpu->nem.s.uIoCtlBuf.MsgSlotHandleAndGetNext), 3794 NULL, 0); 3795 AssertLogRelMsgReturn(NT_SUCCESS(rcNt), ("1st VidMessageSlotHandleAndGetNext after ERROR_VID_STOP_PENDING failed: %#x\n", rcNt), 3804 rcNt = nemR0NtPerformIoControlRestart(pGVM, pGVM->nem.s.IoCtlMessageSlotHandleAndGetNext.uFunction, 3805 &pVCpu->nem.s.uIoCtlBuf.MsgSlotHandleAndGetNext, 3806 sizeof(pVCpu->nem.s.uIoCtlBuf.MsgSlotHandleAndGetNext)); 3807 DBGFTRACE_CUSTOM(pVM, "nemStop#1: %#x / %#x %#x %#x", rcNt, pMappingHeader->enmVidMsgType, pMappingHeader->cbMessage, 3808 pMsgForTrace->Header.MessageType); 3809 AssertLogRelMsgReturn(rcNt == STATUS_SUCCESS, 3810 ("1st VidMessageSlotHandleAndGetNext after ERROR_VID_STOP_PENDING failed: %#x\n", rcNt), 3796 3811 RT_SUCCESS(rcStrict) ? VERR_NEM_IPE_5 : rcStrict); 3797 3812 # else 3798 3813 BOOL fWait = g_pfnVidMessageSlotHandleAndGetNext(pVM->nem.s.hPartitionDevice, pVCpu->idCpu, 3799 3814 VID_MSHAGN_F_GET_NEXT_MESSAGE, 30000 /*ms*/); 3815 DBGFTRACE_CUSTOM(pVM, "nemStop#1: %d+%#x / %#x %#x %#x", fWait, RTNtLastErrorValue(), pMappingHeader->enmVidMsgType, 3816 pMappingHeader->cbMessage, pMsgForTrace->Header.MessageType); 3800 3817 AssertLogRelMsgReturn(fWait, ("1st VidMessageSlotHandleAndGetNext after ERROR_VID_STOP_PENDING failed: %u\n", RTNtLastErrorValue()), 3801 3818 RT_SUCCESS(rcStrict) ? VERR_NEM_IPE_5 : rcStrict); … … 3808 3825 if (rcStrict2 != VINF_SUCCESS && RT_SUCCESS(rcStrict)) 3809 3826 rcStrict = rcStrict2; 3827 DBGFTRACE_CUSTOM(pVM, "nemStop#1: handled %#x -> %d", pMsgForTrace->Header.MessageType, VBOXSTRICTRC_VAL(rcStrict)); 3810 3828 3811 3829 /* … … 3817 3835 pVCpu->nem.s.uIoCtlBuf.MsgSlotHandleAndGetNext.fFlags = VID_MSHAGN_F_HANDLE_MESSAGE | VID_MSHAGN_F_GET_NEXT_MESSAGE; 3818 3836 pVCpu->nem.s.uIoCtlBuf.MsgSlotHandleAndGetNext.cMillies = 30000; /*ms*/ 3819 rcNt = nemR0NtPerformIoControl(pGVM, pGVM->nem.s.IoCtlMessageSlotHandleAndGetNext.uFunction, 3820 &pVCpu->nem.s.uIoCtlBuf.MsgSlotHandleAndGetNext, 3821 sizeof(pVCpu->nem.s.uIoCtlBuf.MsgSlotHandleAndGetNext), 3822 NULL, 0); 3823 AssertLogRelMsgReturn(NT_SUCCESS(rcNt), ("2nd VidMessageSlotHandleAndGetNext after ERROR_VID_STOP_PENDING failed: %#x\n", rcNt), 3837 rcNt = nemR0NtPerformIoControlRestart(pGVM, pGVM->nem.s.IoCtlMessageSlotHandleAndGetNext.uFunction, 3838 &pVCpu->nem.s.uIoCtlBuf.MsgSlotHandleAndGetNext, 3839 sizeof(pVCpu->nem.s.uIoCtlBuf.MsgSlotHandleAndGetNext)); 3840 DBGFTRACE_CUSTOM(pVM, "nemStop#2: %#x / %#x %#x %#x", rcNt, pMappingHeader->enmVidMsgType, pMappingHeader->cbMessage, 3841 pMsgForTrace->Header.MessageType); 3842 AssertLogRelMsgReturn(rcNt == STATUS_SUCCESS, 3843 ("2nd VidMessageSlotHandleAndGetNext after ERROR_VID_STOP_PENDING failed: %#x\n", rcNt), 3824 3844 RT_SUCCESS(rcStrict) ? VERR_NEM_IPE_5 : rcStrict); 3825 3845 # else 3826 3846 fWait = g_pfnVidMessageSlotHandleAndGetNext(pVM->nem.s.hPartitionDevice, pVCpu->idCpu, 3827 3847 VID_MSHAGN_F_HANDLE_MESSAGE | VID_MSHAGN_F_GET_NEXT_MESSAGE, 30000 /*ms*/); 3848 DBGFTRACE_CUSTOM(pVM, "nemStop#2: %d+%#x / %#x %#x %#x", fWait, RTNtLastErrorValue(), pMappingHeader->enmVidMsgType, 3849 pMappingHeader->cbMessage, pMsgForTrace->Header.MessageType); 3828 3850 AssertLogRelMsgReturn(fWait, ("2nd VidMessageSlotHandleAndGetNext after ERROR_VID_STOP_PENDING failed: %u\n", RTNtLastErrorValue()), 3829 3851 RT_SUCCESS(rcStrict) ? VERR_NEM_IPE_5 : rcStrict); … … 3844 3866 pVCpu->nem.s.uIoCtlBuf.MsgSlotHandleAndGetNext.fFlags = VID_MSHAGN_F_HANDLE_MESSAGE; 3845 3867 pVCpu->nem.s.uIoCtlBuf.MsgSlotHandleAndGetNext.cMillies = 30000; /*ms*/ 3846 rcNt = nemR0NtPerformIoControl(pGVM, pGVM->nem.s.IoCtlMessageSlotHandleAndGetNext.uFunction, 3847 &pVCpu->nem.s.uIoCtlBuf.MsgSlotHandleAndGetNext, 3848 sizeof(pVCpu->nem.s.uIoCtlBuf.MsgSlotHandleAndGetNext), 3849 NULL, 0); 3850 AssertLogRelMsgReturn(NT_SUCCESS(rcNt), ("3rd VidMessageSlotHandleAndGetNext after ERROR_VID_STOP_PENDING failed: %#x\n", rcNt), 3868 rcNt = nemR0NtPerformIoControlRestart(pGVM, pGVM->nem.s.IoCtlMessageSlotHandleAndGetNext.uFunction, 3869 &pVCpu->nem.s.uIoCtlBuf.MsgSlotHandleAndGetNext, 3870 sizeof(pVCpu->nem.s.uIoCtlBuf.MsgSlotHandleAndGetNext)); 3871 DBGFTRACE_CUSTOM(pVM, "nemStop#3: %#x / %#x %#x %#x", rcNt, pMappingHeader->enmVidMsgType, 3872 pMsgForTrace->Header.MessageType, pMappingHeader->cbMessage, pMsgForTrace->Header.MessageType); 3873 AssertLogRelMsgReturn(rcNt == STATUS_SUCCESS, 3874 ("3rd VidMessageSlotHandleAndGetNext after ERROR_VID_STOP_PENDING failed: %#x\n", rcNt), 3851 3875 RT_SUCCESS(rcStrict) ? VERR_NEM_IPE_5 : rcStrict); 3852 3876 # else 3853 3877 fWait = g_pfnVidMessageSlotHandleAndGetNext(pVM->nem.s.hPartitionDevice, pVCpu->idCpu, VID_MSHAGN_F_HANDLE_MESSAGE, 30000 /*ms*/); 3878 DBGFTRACE_CUSTOM(pVM, "nemStop#3: %d+%#x / %#x %#x %#x", fWait, RTNtLastErrorValue(), pMappingHeader->enmVidMsgType, 3879 pMsgForTrace->Header.MessageType, pMappingHeader->cbMessage, pMsgForTrace->Header.MessageType); 3854 3880 AssertLogRelMsgReturn(fWait, ("3rd VidMessageSlotHandleAndGetNext after ERROR_VID_STOP_PENDING failed: %u\n", RTNtLastErrorValue()), 3855 3881 RT_SUCCESS(rcStrict) ? VERR_NEM_IPE_5 : rcStrict); … … 3859 3885 else 3860 3886 { 3887 DBGFTRACE_CUSTOM(pVM, "nemStop#9: %#x %#x %#x", pMappingHeader->enmVidMsgType, 3888 pMappingHeader->cbMessage, pMsgForTrace->Header.MessageType); 3861 3889 STAM_REL_COUNTER_INC(&pVCpu->nem.s.StatStopCpuPendingOdd); 3862 3890 Log8(("nemHCWinStopCpu: Stopped the CPU (rcStrict=%Rrc) - 1st VidMessageSlotHandleAndGetNext got VidMessageStopRequestComplete.\n", -
trunk/src/VBox/VMM/VMMR0/NEMR0Native-win.cpp
r72546 r72687 32 32 #include <VBox/vmm/apic.h> 33 33 #include <VBox/vmm/pdm.h> 34 #include <VBox/vmm/dbgftrace.h> 34 35 #include "NEMInternal.h" 35 36 #include <VBox/vmm/gvm.h> … … 87 88 DECLINLINE(NTSTATUS) nemR0NtPerformIoControl(PGVM pGVM, uint32_t uFunction, void *pvInput, uint32_t cbInput, 88 89 void *pvOutput, uint32_t cbOutput); 90 DECLINLINE(NTSTATUS) nemR0NtPerformIoControlRestart(PGVM pGVM, uint32_t uFunction, void *pvInput, uint32_t cbInput); 89 91 90 92 … … 269 271 270 272 /** 273 * Perform an I/O control operation on the partition handle (VID.SYS), 274 * restarting on alert-like behaviour. 275 * 276 * @returns NT status code. 277 * @param pGVM The ring-0 VM structure. 278 * @param uFunction The function to perform. 279 * @param pvInput The input buffer. This must point within the VM 280 * structure so we can easily convert to a ring-3 281 * pointer if necessary. 282 * @param cbInput The size of the input. @a pvInput must be NULL when 283 * zero. 284 */ 285 DECLINLINE(NTSTATUS) nemR0NtPerformIoControlRestart(PGVM pGVM, uint32_t uFunction, void *pvInput, uint32_t cbInput) 286 { 287 #ifdef RT_STRICT 288 /* 289 * Input and output parameters are part of the VM CPU structure. 290 */ 291 PVM pVM = pGVM->pVM; 292 size_t const cbVM = RT_UOFFSETOF(VM, aCpus[pGVM->cCpus]); 293 if (pvInput) 294 AssertReturn(((uintptr_t)pvInput + cbInput) - (uintptr_t)pVM <= cbVM, VERR_INVALID_PARAMETER); 295 #endif 296 297 int32_t rcNt = STATUS_UNSUCCESSFUL; 298 int rc = SUPR0IoCtlPerform(pGVM->nem.s.pIoCtlCtx, uFunction, 299 pvInput, 300 pvInput ? (uintptr_t)pvInput + pGVM->nem.s.offRing3ConversionDelta : NIL_RTR3PTR, 301 cbInput, 302 NULL, 303 NIL_RTR3PTR, 304 0, 305 &rcNt); 306 if (RT_SUCCESS(rc) || !NT_SUCCESS((NTSTATUS)rcNt)) 307 { 308 if (RT_LIKELY(rcNt == STATUS_SUCCESS)) 309 return rcNt; 310 311 if ( rcNt == STATUS_TIMEOUT 312 || rcNt == STATUS_ALERTED) 313 { 314 DBGFTRACE_CUSTOM(pVM, "nemR0NtPerformIoControlRestart/1 %#x", rcNt); 315 rcNt = STATUS_UNSUCCESSFUL; 316 rc = SUPR0IoCtlPerform(pGVM->nem.s.pIoCtlCtx, uFunction, 317 pvInput, 318 pvInput ? (uintptr_t)pvInput + pGVM->nem.s.offRing3ConversionDelta : NIL_RTR3PTR, 319 cbInput, 320 NULL, 321 NIL_RTR3PTR, 322 0, 323 &rcNt); 324 if (!RT_SUCCESS(rc) && NT_SUCCESS((NTSTATUS)rcNt)) 325 rcNt = STATUS_UNSUCCESSFUL; 326 DBGFTRACE_CUSTOM(pVM, "nemR0NtPerformIoControlRestart/2 %#x", rcNt); 327 } 328 return (NTSTATUS)rcNt; 329 } 330 return STATUS_UNSUCCESSFUL; 331 } 332 333 334 /** 271 335 * 2nd part of the initialization, after we've got a partition handle. 272 336 * -
trunk/src/VBox/VMM/VMMR3/NEMR3Native-win.cpp
r72673 r72687 50 50 #include <VBox/vmm/apic.h> 51 51 #include <VBox/vmm/pdm.h> 52 #include <VBox/vmm/dbgftrace.h> 52 53 #include "NEMInternal.h" 53 54 #include <VBox/vmm/vm.h>
Note:
See TracChangeset
for help on using the changeset viewer.