Index: /trunk/include/VBox/vmm/pdmasynccompletion.h
===================================================================
--- /trunk/include/VBox/vmm/pdmasynccompletion.h	(revision 36000)
+++ /trunk/include/VBox/vmm/pdmasynccompletion.h	(revision 36001)
@@ -228,5 +228,5 @@
  * @{ */
 /** Open the file in read-only mode. */
-#define PDMACEP_FILE_FLAGS_READ_ONLY    RT_BIT_32(0)
+#define PDMACEP_FILE_FLAGS_READ_ONLY             RT_BIT_32(0)
 /** Whether the file should not be write protected.
  * The default is to protect the file against writes by other processes
@@ -234,5 +234,7 @@
  * concurrent access which can occur if the local writeback cache is enabled.
  */
-#define PDMACEP_FILE_FLAGS_DONT_LOCK    RT_BIT_32(2)
+#define PDMACEP_FILE_FLAGS_DONT_LOCK             RT_BIT_32(2)
+/** Open the endpoint with the host cache enabled. */
+#define PDMACEP_FILE_FLAGS_HOST_CACHE_ENABLED    RT_BIT_32(3)
 /** @} */
 
Index: /trunk/src/VBox/VMM/VMMR3/PDMAsyncCompletion.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMR3/PDMAsyncCompletion.cpp	(revision 36000)
+++ /trunk/src/VBox/VMM/VMMR3/PDMAsyncCompletion.cpp	(revision 36001)
@@ -1191,5 +1191,5 @@
 
     /* Check that the flags are valid. */
-    AssertReturn(((~(PDMACEP_FILE_FLAGS_READ_ONLY | PDMACEP_FILE_FLAGS_DONT_LOCK) & fFlags) == 0),
+    AssertReturn(((~(PDMACEP_FILE_FLAGS_READ_ONLY | PDMACEP_FILE_FLAGS_DONT_LOCK | PDMACEP_FILE_FLAGS_HOST_CACHE_ENABLED) & fFlags) == 0),
                  VERR_INVALID_PARAMETER);
 
Index: /trunk/src/VBox/VMM/VMMR3/PDMAsyncCompletionFile.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMR3/PDMAsyncCompletionFile.cpp	(revision 36000)
+++ /trunk/src/VBox/VMM/VMMR3/PDMAsyncCompletionFile.cpp	(revision 36001)
@@ -431,4 +431,6 @@
         else
             pAioMgrNew->enmMgrType = pEpClass->enmMgrTypeOverride;
+
+        pAioMgrNew->msBwLimitExpired = RT_INDEFINITE_WAIT;
 
         rc = RTSemEventCreate(&pAioMgrNew->EventSem);
@@ -863,8 +865,18 @@
     PDMACFILEEPBACKEND enmEpBackend = pEpClassFile->enmEpBackendDefault;
 
-    AssertMsgReturn((fFlags & ~(PDMACEP_FILE_FLAGS_READ_ONLY | PDMACEP_FILE_FLAGS_DONT_LOCK)) == 0,
+    AssertMsgReturn((fFlags & ~(PDMACEP_FILE_FLAGS_READ_ONLY | PDMACEP_FILE_FLAGS_DONT_LOCK | PDMACEP_FILE_FLAGS_HOST_CACHE_ENABLED)) == 0,
                     ("PDMAsyncCompletion: Invalid flag specified\n"), VERR_INVALID_PARAMETER);
 
     unsigned fFileFlags = RTFILE_O_OPEN;
+
+    /*
+     * Revert to the simple manager and the buffered backend if
+     * the host cache should be enabled.
+     */
+    if (fFlags & PDMACEP_FILE_FLAGS_HOST_CACHE_ENABLED)
+    {
+        enmMgrType   = PDMACEPFILEMGRTYPE_SIMPLE;
+        enmEpBackend = PDMACFILEEPBACKEND_BUFFERED;
+    }
 
     if (fFlags & PDMACEP_FILE_FLAGS_READ_ONLY)
Index: /trunk/src/VBox/VMM/VMMR3/PDMAsyncCompletionFileFailsafe.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMR3/PDMAsyncCompletionFileFailsafe.cpp	(revision 36000)
+++ /trunk/src/VBox/VMM/VMMR3/PDMAsyncCompletionFileFailsafe.cpp	(revision 36001)
@@ -27,6 +27,34 @@
 #include "PDMAsyncCompletionFileInternal.h"
 
-
-static int pdmacFileAioMgrFailsafeProcessEndpointTaskList(PPDMASYNCCOMPLETIONENDPOINTFILE pEndpoint,
+/**
+ * Put a list of tasks in the pending request list of an endpoint.
+ */
+DECLINLINE(void) pdmacFileAioMgrEpAddTaskList(PPDMASYNCCOMPLETIONENDPOINTFILE pEndpoint, PPDMACTASKFILE pTaskHead)
+{
+    /* Add the rest of the tasks to the pending list */
+    if (!pEndpoint->AioMgr.pReqsPendingHead)
+    {
+        Assert(!pEndpoint->AioMgr.pReqsPendingTail);
+        pEndpoint->AioMgr.pReqsPendingHead = pTaskHead;
+    }
+    else
+    {
+        Assert(pEndpoint->AioMgr.pReqsPendingTail);
+        pEndpoint->AioMgr.pReqsPendingTail->pNext = pTaskHead;
+    }
+
+    /* Update the tail. */
+    while (pTaskHead->pNext)
+        pTaskHead = pTaskHead->pNext;
+
+    pEndpoint->AioMgr.pReqsPendingTail = pTaskHead;
+    pTaskHead->pNext = NULL;
+}
+
+/**
+ * Processes a given task list for assigned to the given endpoint.
+ */
+static int pdmacFileAioMgrFailsafeProcessEndpointTaskList(PPDMACEPFILEMGR pAioMgr,
+                                                          PPDMASYNCCOMPLETIONENDPOINTFILE pEndpoint,
                                                           PPDMACTASKFILE pTasks)
 {
@@ -35,5 +63,12 @@
     while (pTasks)
     {
+        RTMSINTERVAL msWhenNext;
         PPDMACTASKFILE pCurr = pTasks;
+
+        if (!pdmacEpIsTransferAllowed(&pEndpoint->Core, (uint32_t)pCurr->DataSeg.cbSeg, &msWhenNext))
+        {
+            pAioMgr->msBwLimitExpired = RT_MIN(pAioMgr->msBwLimitExpired, msWhenNext);
+            break;
+        }
 
         pTasks = pTasks->pNext;
@@ -80,8 +115,15 @@
     }
 
+    if (pTasks)
+    {
+        /* Add the rest of the tasks to the pending list */
+        pdmacFileAioMgrEpAddTaskList(pEndpoint, pTasks);
+    }
+
     return VINF_SUCCESS;
 }
 
-static int pdmacFileAioMgrFailsafeProcessEndpoint(PPDMASYNCCOMPLETIONENDPOINTFILE pEndpoint)
+static int pdmacFileAioMgrFailsafeProcessEndpoint(PPDMACEPFILEMGR pAioMgr,
+                                                  PPDMASYNCCOMPLETIONENDPOINTFILE pEndpoint)
 {
     int rc = VINF_SUCCESS;
@@ -93,5 +135,5 @@
     /* Process the request pending list first in case the endpoint was migrated due to an error. */
     if (pTasks)
-        rc = pdmacFileAioMgrFailsafeProcessEndpointTaskList(pEndpoint, pTasks);
+        rc = pdmacFileAioMgrFailsafeProcessEndpointTaskList(pAioMgr, pEndpoint, pTasks);
 
     if (RT_SUCCESS(rc))
@@ -100,5 +142,5 @@
 
         if (pTasks)
-            rc = pdmacFileAioMgrFailsafeProcessEndpointTaskList(pEndpoint, pTasks);
+            rc = pdmacFileAioMgrFailsafeProcessEndpointTaskList(pAioMgr, pEndpoint, pTasks);
     }
 
@@ -120,7 +162,7 @@
         ASMAtomicWriteBool(&pAioMgr->fWaitingEventSem, true);
         if (!ASMAtomicReadBool(&pAioMgr->fWokenUp))
-            rc = RTSemEventWait(pAioMgr->EventSem, RT_INDEFINITE_WAIT);
+            rc = RTSemEventWait(pAioMgr->EventSem, pAioMgr->msBwLimitExpired);
         ASMAtomicWriteBool(&pAioMgr->fWaitingEventSem, false);
-        AssertRC(rc);
+        Assert(RT_SUCCESS(rc) || rc == VERR_TIMEOUT);
 
         LogFlow(("Got woken up\n"));
@@ -131,5 +173,6 @@
         while (pEndpoint)
         {
-            rc = pdmacFileAioMgrFailsafeProcessEndpoint(pEndpoint);
+            pAioMgr->msBwLimitExpired = RT_INDEFINITE_WAIT;
+            rc = pdmacFileAioMgrFailsafeProcessEndpoint(pAioMgr, pEndpoint);
             AssertRC(rc);
             pEndpoint = pEndpoint->AioMgr.pEndpointNext;
@@ -160,5 +203,5 @@
                      * if the endpoint was migrated from another endpoint.
                      */
-                    rc = pdmacFileAioMgrFailsafeProcessEndpoint(pEndpointNew);
+                    rc = pdmacFileAioMgrFailsafeProcessEndpoint(pAioMgr, pEndpointNew);
                     AssertRC(rc);
                     break;
@@ -193,5 +236,5 @@
 
                     /* Make sure all tasks finished. */
-                    rc = pdmacFileAioMgrFailsafeProcessEndpoint(pEndpointClose);
+                    rc = pdmacFileAioMgrFailsafeProcessEndpoint(pAioMgr, pEndpointClose);
                     AssertRC(rc);
                     break;
Index: /trunk/src/VBox/VMM/VMMR3/PDMAsyncCompletionFileNormal.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMR3/PDMAsyncCompletionFileNormal.cpp	(revision 36000)
+++ /trunk/src/VBox/VMM/VMMR3/PDMAsyncCompletionFileNormal.cpp	(revision 36001)
@@ -62,5 +62,4 @@
         pAioMgr->cReqEntries      = pAioMgr->cRequestsActiveMax;
         pAioMgr->pahReqsFree      = (RTFILEAIOREQ *)RTMemAllocZ(pAioMgr->cReqEntries * sizeof(RTFILEAIOREQ));
-        pAioMgr->msBwLimitExpired = RT_INDEFINITE_WAIT;
 
         if (pAioMgr->pahReqsFree)
