From 5aee693f704554a01ab4969974767d1bfb65cc94 Mon Sep 17 00:00:00 2001 From: Christian Helmuth Date: Mon, 27 Sep 2021 09:22:37 +0200 Subject: [PATCH] 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. --- repos/ports/ports/virtualbox6.hash | 2 +- repos/ports/src/virtualbox6/patches/devahci.patch | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/repos/ports/ports/virtualbox6.hash b/repos/ports/ports/virtualbox6.hash index 888a55296c..ba34d84007 100644 --- a/repos/ports/ports/virtualbox6.hash +++ b/repos/ports/ports/virtualbox6.hash @@ -1 +1 @@ -a8a922bf4fe0dc60f00cf3a4cf8fd93b11e146a9 +aa4ee90f7171e1d540ed1c0b19f57088daab53c9 diff --git a/repos/ports/src/virtualbox6/patches/devahci.patch b/repos/ports/src/virtualbox6/patches/devahci.patch index ace9410e37..536d6d476b 100644 --- a/repos/ports/src/virtualbox6/patches/devahci.patch +++ b/repos/ports/src/virtualbox6/patches/devahci.patch @@ -14,7 +14,7 @@ Patch for DevAHCI model to really kick the consumer of requests (WiP) { LogFlowFunc(("Signal event semaphore\n")); int rc = PDMDevHlpSUPSemEventSignal(pDevIns, pAhciPort->hEvtProcess); -+ PDMDevHlpSUPSemEventWaitNoResume(pDevIns, pAhciPort->hEvtProcessAck, RT_INDEFINITE_WAIT); ++ PDMDevHlpSUPSemEventWaitNoResume(pDevIns, pAhciPort->hEvtProcessAck, 15 /* ms */); AssertRC(rc); } @@ -22,7 +22,7 @@ Patch for DevAHCI model to really kick the consumer of requests (WiP) ASMAtomicOrU32(&pAhciPort->u32TasksNew, pAhciPort->regCI); LogFlowFunc(("Signal event semaphore\n")); int rc = PDMDevHlpSUPSemEventSignal(pDevIns, pAhciPort->hEvtProcess); -+ PDMDevHlpSUPSemEventWaitNoResume(pDevIns, pAhciPort->hEvtProcessAck, RT_INDEFINITE_WAIT); ++ PDMDevHlpSUPSemEventWaitNoResume(pDevIns, pAhciPort->hEvtProcessAck, 15 /* ms */); AssertRC(rc); } } @@ -33,7 +33,7 @@ Patch for DevAHCI model to really kick the consumer of requests (WiP) + if (pAhciPort->regIS == 0) { + if (pAhciPort->hEvtProcess != NIL_SUPSEMEVENT) { + 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); - return 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; } @@ -63,7 +63,7 @@ Patch for DevAHCI model to really kick the consumer of requests (WiP) /* Notify the async IO thread. */ int rc = PDMDevHlpSUPSemEventSignal(pDevIns, pAhciPort->hEvtProcess); -+ PDMDevHlpSUPSemEventWaitNoResume(pDevIns, pAhciPort->hEvtProcessAck, RT_INDEFINITE_WAIT); ++ PDMDevHlpSUPSemEventWaitNoResume(pDevIns, pAhciPort->hEvtProcessAck, 15 /* ms */); AssertRC(rc); } }