Changeset 19322 in vbox
- Timestamp:
- May 4, 2009 11:54:21 AM (16 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/EM.cpp
r19300 r19322 3729 3729 case VINF_EM_RESET: 3730 3730 { 3731 EMSTATE enmState = emR3Reschedule(pVM, pVCpu, pVCpu->em.s.pCtx); 3732 Log2(("EMR3ExecuteVM: VINF_EM_RESET: %d -> %d (%s)\n", pVCpu->em.s.enmState, enmState, EMR3GetStateName(enmState))); 3733 pVCpu->em.s.enmState = enmState; 3731 if (pVCpu->idCpu == 0) 3732 { 3733 EMSTATE enmState = emR3Reschedule(pVM, pVCpu, pVCpu->em.s.pCtx); 3734 Log2(("EMR3ExecuteVM: VINF_EM_RESET: %d -> %d (%s)\n", pVCpu->em.s.enmState, enmState, EMR3GetStateName(enmState))); 3735 pVCpu->em.s.enmState = enmState; 3736 } 3737 else 3738 { 3739 /* All other VCPUs go into the halted state until woken up again. */ 3740 pVCpu->em.s.enmState = EMSTATE_HALTED; 3741 } 3734 3742 break; 3735 3743 } -
trunk/src/VBox/VMM/VM.cpp
r19300 r19322 966 966 static int vmR3InitDoCompleted(PVM pVM, VMINITCOMPLETED enmWhat) 967 967 { 968 969 968 return VINF_SUCCESS; 970 969 } … … 1035 1034 */ 1036 1035 PVMREQ pReq; 1037 int rc = VMR3ReqCall(pVM, VMCPUID_ANY, &pReq, RT_INDEFINITE_WAIT, (PFNRT)vmR3PowerOn, 1, pVM);1036 int rc = VMR3ReqCall(pVM, 0 /* VCPU 0 */, &pReq, RT_INDEFINITE_WAIT, (PFNRT)vmR3PowerOn, 1, pVM); 1038 1037 if (RT_SUCCESS(rc)) 1039 1038 { … … 1102 1101 1103 1102 /* 1104 * Request the operation in EMT. 1105 */ 1106 PVMREQ pReq ;1107 int rc = VMR3ReqCall(pVM, VMCPUID_A NY, &pReq, RT_INDEFINITE_WAIT, (PFNRT)vmR3Suspend, 1, pVM);1103 * Request the operation in EMT. (in reverse order as VCPU 0 does the actual work) 1104 */ 1105 PVMREQ pReq = NULL; 1106 int rc = VMR3ReqCall(pVM, VMCPUID_ALL_REVERSE, &pReq, RT_INDEFINITE_WAIT, (PFNRT)vmR3Suspend, 1, pVM); 1108 1107 if (RT_SUCCESS(rc)) 1109 1108 { … … 1111 1110 VMR3ReqFree(pReq); 1112 1111 } 1112 else 1113 Assert(pReq == NULL); 1113 1114 1114 1115 LogFlow(("VMR3Suspend: returns %Rrc\n", rc)); … … 1155 1156 } 1156 1157 1158 PVMCPU pVCpu = VMMGetCpu(pVM); 1159 /* Only VCPU 0 does the actual work. */ 1160 if (pVCpu->idCpu != 0) 1161 return VINF_EM_SUSPEND; 1162 1157 1163 /* 1158 1164 * Change the state, notify the components and resume the execution. … … 1189 1195 1190 1196 /* 1191 * Request the operation in EMT. 1192 */ 1193 PVMREQ pReq ;1194 int rc = VMR3ReqCall(pVM, VMCPUID_A NY, &pReq, RT_INDEFINITE_WAIT, (PFNRT)vmR3Resume, 1, pVM);1197 * Request the operation in EMT. (in VCPU order as VCPU 0 does the actual work) 1198 */ 1199 PVMREQ pReq = NULL; 1200 int rc = VMR3ReqCall(pVM, VMCPUID_ALL, &pReq, RT_INDEFINITE_WAIT, (PFNRT)vmR3Resume, 1, pVM); 1195 1201 if (RT_SUCCESS(rc)) 1196 1202 { … … 1198 1204 VMR3ReqFree(pReq); 1199 1205 } 1206 else 1207 Assert(pReq == NULL); 1200 1208 1201 1209 LogFlow(("VMR3Resume: returns %Rrc\n", rc)); … … 1224 1232 return VERR_VM_INVALID_VM_STATE; 1225 1233 } 1234 1235 PVMCPU pVCpu = VMMGetCpu(pVM); 1236 /* Only VCPU 0 does the actual work. */ 1237 if (pVCpu->idCpu != 0) 1238 return VINF_EM_RESUME; 1226 1239 1227 1240 /* … … 1273 1286 */ 1274 1287 PVMREQ pReq; 1275 int rc = VMR3ReqCall(pVM, VMCPUID_ANY, &pReq, RT_INDEFINITE_WAIT, (PFNRT)vmR3Save, 4, pVM, pszFilename, pfnProgress, pvUser);1288 int rc = VMR3ReqCall(pVM, 0 /* VCPU 0 */, &pReq, RT_INDEFINITE_WAIT, (PFNRT)vmR3Save, 4, pVM, pszFilename, pfnProgress, pvUser); 1276 1289 if (RT_SUCCESS(rc)) 1277 1290 { … … 1368 1381 */ 1369 1382 PVMREQ pReq; 1370 int rc = VMR3ReqCall(pVM, VMCPUID_ANY, &pReq, RT_INDEFINITE_WAIT, (PFNRT)vmR3Load, 4, pVM, pszFilename, pfnProgress, pvUser);1383 int rc = VMR3ReqCall(pVM, 0 /* VCPU 0 */, &pReq, RT_INDEFINITE_WAIT, (PFNRT)vmR3Load, 4, pVM, pszFilename, pfnProgress, pvUser); 1371 1384 if (RT_SUCCESS(rc)) 1372 1385 { … … 1454 1467 1455 1468 /* 1456 * Request the operation in EMT. 1457 */ 1458 PVMREQ pReq ;1459 int rc = VMR3ReqCall(pVM, VMCPUID_A NY, &pReq, RT_INDEFINITE_WAIT, (PFNRT)vmR3PowerOff, 1, pVM);1469 * Request the operation in EMT. (in reverse order as VCPU 0 does the actual work) 1470 */ 1471 PVMREQ pReq = NULL; 1472 int rc = VMR3ReqCall(pVM, VMCPUID_ALL_REVERSE, &pReq, RT_INDEFINITE_WAIT, (PFNRT)vmR3PowerOff, 1, pVM); 1460 1473 if (RT_SUCCESS(rc)) 1461 1474 { … … 1463 1476 VMR3ReqFree(pReq); 1464 1477 } 1478 else 1479 Assert(pReq == NULL); 1465 1480 1466 1481 LogFlow(("VMR3PowerOff: returns %Rrc\n", rc)); … … 1492 1507 return VERR_VM_INVALID_VM_STATE; 1493 1508 } 1509 1510 PVMCPU pVCpu = VMMGetCpu(pVM); 1511 /* Only VCPU 0 does the actual work. */ 1512 if (pVCpu->idCpu != 0) 1513 return VINF_EM_TERMINATE; 1494 1514 1495 1515 /* … … 1616 1636 1617 1637 /* 1618 * If we are the EMT we'll delay the cleanup till later.1619 */ 1620 if (VM _IS_EMT(pVM))1638 * If we are the EMT of VCPU 0, then we'll delay the cleanup till later. 1639 */ 1640 if (VMMGetCpuId(pVM) == 0) 1621 1641 { 1622 1642 pUVM->vm.s.fEMTDoesTheCleanup = true; 1623 1643 pUVM->vm.s.fTerminateEMT = true; 1624 1644 VM_FF_SET(pVM, VM_FF_TERMINATE); 1645 1646 /* Inform all other VCPUs too. */ 1647 for (VMCPUID idCpu = 1; idCpu < pVM->cCPUs; idCpu++) 1648 { 1649 /* 1650 * Request EMT to do the larger part of the destruction. 1651 */ 1652 PVMREQ pReq = NULL; 1653 int rc = VMR3ReqCallU(pUVM, idCpu, &pReq, RT_INDEFINITE_WAIT, 0, (PFNRT)vmR3Destroy, 1, pVM); 1654 if (RT_SUCCESS(rc)) 1655 rc = pReq->iStatus; 1656 AssertRC(rc); 1657 VMR3ReqFree(pReq); 1658 } 1625 1659 } 1626 1660 else … … 2074 2108 /* 2075 2109 * Queue reset request to the emulation thread 2076 * and wait for it to be processed. 2110 * and wait for it to be processed. (in reverse order as VCPU 0 does the real cleanup) 2077 2111 */ 2078 2112 PVMREQ pReq = NULL; 2079 rc = VMR3ReqCall(pVM, VMCPUID_ANY, &pReq, 0, (PFNRT)vmR3Reset, 1, pVM); 2113 rc = VMR3ReqCall(pVM, VMCPUID_ALL_REVERSE, &pReq, RT_INDEFINITE_WAIT, (PFNRT)vmR3Reset, 1, pVM); 2114 /** @note Can this really happen?? */ 2080 2115 while (rc == VERR_TIMEOUT) 2081 2116 rc = VMR3ReqWait(pReq, RT_INDEFINITE_WAIT); 2117 2082 2118 if (RT_SUCCESS(rc)) 2083 2119 rc = pReq->iStatus; 2120 AssertRC(rc); 2084 2121 VMR3ReqFree(pReq); 2085 2122 … … 2112 2149 static DECLCALLBACK(int) vmR3Reset(PVM pVM) 2113 2150 { 2151 PVMCPU pVCpu = VMMGetCpu(pVM); 2152 2153 /* Only VCPU 0 does the full cleanup. */ 2154 if (pVCpu->idCpu != 0) 2155 return VINF_EM_RESET; 2156 2114 2157 /* 2115 2158 * As a safety precaution we temporarily change the state while resetting.
Note:
See TracChangeset
for help on using the changeset viewer.