digged some more. The freeze is caused by the following wait function (in red): vmm\ssm.cpp /** * The I/O thread. * * @returns VINF_SUCCESS (ignored). * @param hSelf The thread handle. * @param pvStrm The stream handle. */ static DECLCALLBACK(int) ssmR3StrmIoThread(RTTHREAD hSelf, void *pvStrm) { PSSMSTRM pStrm = (PSSMSTRM)pvStrm; ASMAtomicWriteHandle(&pStrm->hIoThread, hSelf); /* paranoia */ Log(("ssmR3StrmIoThread: starts working\n")); if (pStrm->fWrite) { /* * Write until error or terminated. */ for (;;) { int rc = ssmR3StrmWriteBuffers(pStrm); if ( RT_FAILURE(rc) || rc == VINF_EOF) { Log(("ssmR3StrmIoThread: quitting writing with rc=%Rrc.\n", rc)); break; } if (RT_FAILURE(pStrm->rc)) { Log(("ssmR3StrmIoThread: quitting writing with stream rc=%Rrc\n", pStrm->rc)); break; } if (ASMAtomicReadBool(&pStrm->fTerminating)) { if (!ASMAtomicReadPtrT(&pStrm->pHead, PSSMSTRMBUF)) { Log(("ssmR3StrmIoThread: quitting writing because of pending termination.\n")); break; } Log(("ssmR3StrmIoThread: postponing termination because of pending buffers.\n")); } else if (!ASMAtomicReadPtrT(&pStrm->pHead, PSSMSTRMBUF)) { rc = RTSemEventWait(pStrm->hEvtHead, RT_INDEFINITE_WAIT); <=== stuck here AssertLogRelRC(rc); } } if (!ASMAtomicReadBool(&pStrm->fTerminating)) RTSemEventSignal(pStrm->hEvtFree); } else { /* * Read until end of file, error or termination. */ for (;;) { if (ASMAtomicReadBool(&pStrm->fTerminating)) { Log(("ssmR3StrmIoThread: quitting reading because of pending termination.\n")); break; } int rc = ssmR3StrmReadMore(pStrm); if ( RT_FAILURE(rc) || rc == VINF_EOF) { Log(("ssmR3StrmIoThread: quitting reading with rc=%Rrc\n", rc)); break; } if (RT_FAILURE(pStrm->rc)) { Log(("ssmR3StrmIoThread: quitting reading with stream rc=%Rrc\n", pStrm->rc)); break; } } if (!ASMAtomicReadBool(&pStrm->fTerminating)) RTSemEventSignal(pStrm->hEvtHead); } return VINF_SUCCESS; }
--- On Mon, 8/9/10, Huihong Luo <huisi...@yahoo.com> wrote: From: Huihong Luo <huisi...@yahoo.com> Subject: Re: [vbox-dev] savestate still hangs sometimes (reported before) To: "Huihong Luo" <huisi...@yahoo.com> Cc: "vbox-dev@virtualbox.org" <vbox-dev@virtualbox.org> Date: Monday, August 9, 2010, 7:40 PM This change causes serious side effects, pls ignore it. Switching display mode won't work well. Sent from my iPhone On Aug 9, 2010, at 1:53 PM, Huihong Luo <huisi...@yahoo.com> wrote: did more debugging, and I found adding QCoreApplication::processEvents() might help to solve the freeze problems when powering off with saving state. Add "QCoreApplication::processEvents();" as first line to the following two methods. if there is no other side effects, pls check in the changes: UIMachineLogic.cpp: void UIMachineLogic::sltMachineStateChanged() { // this is extremely import, freezes when hibernating otherwise QCoreApplication::processEvents(); ... } UIMachineView.cpp: void UIMachineView::sltMachineStateChanged() { // this is extremely import, freezes when hibernating otherwise QCoreApplication::processEvents(); ... } --- On Mon, 8/9/10, Huihong Luo <huisi...@yahoo.com> wrote: From: Huihong Luo <huisi...@yahoo.com> Subject: Re: [vbox-dev] savestate still hangs sometimes (reported before) To: vbox-dev@virtualbox.org Date: Monday, August 9, 2010, 10:12 AM I did some more investigation, the hang is caused by this call: DECLCALLBACK(int) Console::saveStateThread(RTTHREAD Thread, void *pvUser) { int vrc = VMR3Save(that->mpVM, task->mSavedStateFile.c_str(), false, /*fContinueAfterwards*/ Console::stateProgressCallback, static_cast<VMProgressTask*>(task.get()), &fSuspenededBySave); <==== } after 0% was printed out, VMR3Save() never returns. Interestingly, the freeze might to do with 2D accleration, because if I disble 2D acceleration, it does not occur that often. The freeze won't occur if doing saving state from the vm GUI console, the Close button. --- On Fri, 7/23/10, Huihong Luo <huisi...@yahoo.com> wrote: From: Huihong Luo <huisi...@yahoo.com> Subject: savestate still hangs sometimes (reported before) To: vbox-dev@virtualbox.org Date: Friday, July 23, 2010, 6:53 PM when 2D acceleration is enabled c:\virtualbox-dev\vbox\out\win.x86\release\bin>VBoxManage.exe controlvm vm1 savestate 0%... hangs after 0% is displayed. If doing from the Close menu, after dialog box is displayed, then choose Save State, then works well. I tried to break the code, it seems stop inside some Windows message loop. renderspu_init.c renderSPUWindowThreadProc() { ... else { TranslateMessage(&msg); DispatchMessage(&msg); } ... } This is very annoying. need to fix these crash bugs when vm is shutting down. -----Inline Attachment Follows----- _______________________________________________ vbox-dev mailing list vbox-dev@virtualbox.org http://vbox.innotek.de/mailman/listinfo/vbox-dev _______________________________________________ vbox-dev mailing list vbox-dev@virtualbox.org http://vbox.innotek.de/mailman/listinfo/vbox-dev
_______________________________________________ vbox-dev mailing list vbox-dev@virtualbox.org http://vbox.innotek.de/mailman/listinfo/vbox-dev