vbox6: limit wait for ack to 15 ms in AHCI model

During Windows 10 boot with sequential block requests, the AHCI request
worker finished earlier than the EMT thread signals hEvtProcess and
begins waiting for hEvtProcessAck indefinitely. The timeouts helps to
survive this short phase.

A better solution would use conditional variables, which are not
provided in VirtualBox's runtime.
This commit is contained in:
Christian Helmuth 2021-09-27 09:22:37 +02:00 committed by Norman Feske
parent f21cf3f8b1
commit 5aee693f70
2 changed files with 6 additions and 6 deletions

View File

@ -1 +1 @@
a8a922bf4fe0dc60f00cf3a4cf8fd93b11e146a9 aa4ee90f7171e1d540ed1c0b19f57088daab53c9

View File

@ -14,7 +14,7 @@ Patch for DevAHCI model to really kick the consumer of requests (WiP)
{ {
LogFlowFunc(("Signal event semaphore\n")); LogFlowFunc(("Signal event semaphore\n"));
int rc = PDMDevHlpSUPSemEventSignal(pDevIns, pAhciPort->hEvtProcess); int rc = PDMDevHlpSUPSemEventSignal(pDevIns, pAhciPort->hEvtProcess);
+ PDMDevHlpSUPSemEventWaitNoResume(pDevIns, pAhciPort->hEvtProcessAck, RT_INDEFINITE_WAIT); + PDMDevHlpSUPSemEventWaitNoResume(pDevIns, pAhciPort->hEvtProcessAck, 15 /* ms */);
AssertRC(rc); AssertRC(rc);
} }
@ -22,7 +22,7 @@ Patch for DevAHCI model to really kick the consumer of requests (WiP)
ASMAtomicOrU32(&pAhciPort->u32TasksNew, pAhciPort->regCI); ASMAtomicOrU32(&pAhciPort->u32TasksNew, pAhciPort->regCI);
LogFlowFunc(("Signal event semaphore\n")); LogFlowFunc(("Signal event semaphore\n"));
int rc = PDMDevHlpSUPSemEventSignal(pDevIns, pAhciPort->hEvtProcess); int rc = PDMDevHlpSUPSemEventSignal(pDevIns, pAhciPort->hEvtProcess);
+ PDMDevHlpSUPSemEventWaitNoResume(pDevIns, pAhciPort->hEvtProcessAck, RT_INDEFINITE_WAIT); + PDMDevHlpSUPSemEventWaitNoResume(pDevIns, pAhciPort->hEvtProcessAck, 15 /* ms */);
AssertRC(rc); AssertRC(rc);
} }
} }
@ -33,7 +33,7 @@ Patch for DevAHCI model to really kick the consumer of requests (WiP)
+ if (pAhciPort->regIS == 0) { + if (pAhciPort->regIS == 0) {
+ if (pAhciPort->hEvtProcess != NIL_SUPSEMEVENT) { + if (pAhciPort->hEvtProcess != NIL_SUPSEMEVENT) {
+ PDMDevHlpSUPSemEventSignal(pDevIns, pAhciPort->hEvtProcess); + PDMDevHlpSUPSemEventSignal(pDevIns, pAhciPort->hEvtProcess);
+ PDMDevHlpSUPSemEventWaitNoResume(pDevIns, pAhciPort->hEvtProcessAck, RT_INDEFINITE_WAIT); + PDMDevHlpSUPSemEventWaitNoResume(pDevIns, pAhciPort->hEvtProcessAck, 15 /* ms */);
+ } + }
+ } + }
+ +
@ -54,7 +54,7 @@ Patch for DevAHCI model to really kick the consumer of requests (WiP)
PAHCIPORT pAhciPort = &RT_SAFE_SUBSCRIPT(pThis->aPorts, pAhciPortR3->iLUN); PAHCIPORT pAhciPort = &RT_SAFE_SUBSCRIPT(pThis->aPorts, pAhciPortR3->iLUN);
- return PDMDevHlpSUPSemEventSignal(pDevIns, pAhciPort->hEvtProcess); - return PDMDevHlpSUPSemEventSignal(pDevIns, pAhciPort->hEvtProcess);
+ int rc = PDMDevHlpSUPSemEventSignal(pDevIns, pAhciPort->hEvtProcess); + int rc = PDMDevHlpSUPSemEventSignal(pDevIns, pAhciPort->hEvtProcess);
+ PDMDevHlpSUPSemEventWaitNoResume(pDevIns, pAhciPort->hEvtProcessAck, RT_INDEFINITE_WAIT); + PDMDevHlpSUPSemEventWaitNoResume(pDevIns, pAhciPort->hEvtProcessAck, 15 /* ms */);
+ return rc; + return rc;
} }
@ -63,7 +63,7 @@ Patch for DevAHCI model to really kick the consumer of requests (WiP)
/* Notify the async IO thread. */ /* Notify the async IO thread. */
int rc = PDMDevHlpSUPSemEventSignal(pDevIns, pAhciPort->hEvtProcess); int rc = PDMDevHlpSUPSemEventSignal(pDevIns, pAhciPort->hEvtProcess);
+ PDMDevHlpSUPSemEventWaitNoResume(pDevIns, pAhciPort->hEvtProcessAck, RT_INDEFINITE_WAIT); + PDMDevHlpSUPSemEventWaitNoResume(pDevIns, pAhciPort->hEvtProcessAck, 15 /* ms */);
AssertRC(rc); AssertRC(rc);
} }
} }