From owner-dev-commits-ports-all@freebsd.org Sat Sep 4 16:22:33 2021 Return-Path: Delivered-To: dev-commits-ports-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E8021668507; Sat, 4 Sep 2021 16:22:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H20Ld5nvnz4X88; Sat, 4 Sep 2021 16:22:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A46EF1AE72; Sat, 4 Sep 2021 16:22:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 184GMXEI061482; Sat, 4 Sep 2021 16:22:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 184GMXKX061481; Sat, 4 Sep 2021 16:22:33 GMT (envelope-from git) Date: Sat, 4 Sep 2021 16:22:33 GMT Message-Id: <202109041622.184GMXKX061481@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Guido Falsi Subject: git: 95ac4999a82d - main - emulators/virtualbox-ose(-legacy): Make VirtualBox limit AIO requests MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: madpilot X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 95ac4999a82d493d3d0bc0b2160e07bcc6d80ddf Auto-Submitted: auto-generated X-BeenThere: dev-commits-ports-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the ports repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Sep 2021 16:22:34 -0000 The branch main has been updated by madpilot: URL: https://cgit.FreeBSD.org/ports/commit/?id=95ac4999a82d493d3d0bc0b2160e07bcc6d80ddf commit 95ac4999a82d493d3d0bc0b2160e07bcc6d80ddf Author: Tom Rushworth AuthorDate: 2021-09-04 16:19:11 +0000 Commit: Guido Falsi CommitDate: 2021-09-04 16:22:00 +0000 emulators/virtualbox-ose(-legacy): Make VirtualBox limit AIO requests Import patch to teach VirtualBox to check availability of AIO resources before trying to allocate more. This prevents crashes when using AIO in VirtualBox. PR: 168298 --- emulators/virtualbox-ose-legacy/Makefile | 2 +- ...VBox_VMM_VMMR3_PDMAsyncCompletionFileNormal.cpp | 59 ++++++++++++++++++++++ emulators/virtualbox-ose/Makefile | 2 +- ...VBox_VMM_VMMR3_PDMAsyncCompletionFileNormal.cpp | 59 ++++++++++++++++++++++ 4 files changed, 120 insertions(+), 2 deletions(-) diff --git a/emulators/virtualbox-ose-legacy/Makefile b/emulators/virtualbox-ose-legacy/Makefile index 624e970a5dfb..3dbc450f08f0 100644 --- a/emulators/virtualbox-ose-legacy/Makefile +++ b/emulators/virtualbox-ose-legacy/Makefile @@ -2,7 +2,7 @@ PORTNAME= virtualbox-ose PORTVERSION= 5.2.44 -PORTREVISION= 6 +PORTREVISION= 7 CATEGORIES= emulators MASTER_SITES= https://download.oracle.com/virtualbox/${PORTVERSION}/ PKGNAMESUFFIX?= -legacy diff --git a/emulators/virtualbox-ose-legacy/files/patch-src_VBox_VMM_VMMR3_PDMAsyncCompletionFileNormal.cpp b/emulators/virtualbox-ose-legacy/files/patch-src_VBox_VMM_VMMR3_PDMAsyncCompletionFileNormal.cpp new file mode 100644 index 000000000000..b04b05811f86 --- /dev/null +++ b/emulators/virtualbox-ose-legacy/files/patch-src_VBox_VMM_VMMR3_PDMAsyncCompletionFileNormal.cpp @@ -0,0 +1,59 @@ +--- src/VBox/VMM/VMMR3/PDMAsyncCompletionFileNormal.cpp.orig 2021-04-19 21:33:04.000000000 -0700 ++++ src/VBox/VMM/VMMR3/PDMAsyncCompletionFileNormal.cpp 2021-05-18 11:45:08.396136000 -0700 +@@ -27,6 +27,13 @@ + #include + #include + #include ++/* TBR: we need a complicated crawl through the data structure to get the AIO system limits ++ to check when considering growing the number of active AIO requests.... */ ++/* We need the PDMInternal *before* the UVM, or it isn't visible afterwards. (src/VBox/VMM/include/PDMInternal.h) */ ++#include ++#include ++#include ++/* TBR: end of extra includes. */ + + #include "PDMAsyncCompletionFileInternal.h" + +@@ -1120,8 +1127,40 @@ + */ + pdmacFileAioMgrNormalBalanceLoad(pAioMgr); + #else +- /* Grow the I/O manager */ +- pAioMgr->enmState = PDMACEPFILEMGRSTATE_GROWING; ++ /* TBR: Check the global AIO system limit before growing. ++ This is the complicateds crawl through the data structure mentioned ++ near the start of this file. ++ There HAS to be a better way and better time to get this limit! */ ++ PPDMASYNCCOMPLETIONEPCLASS pEpClass = NULL; ++ PCPDMASYNCCOMPLETIONEPCLASSOPS pEndpointOps = NULL; ++ PDMASYNCCOMPLETIONEPCLASSTYPE enmClassType; ++ PPDMASYNCCOMPLETIONEPCLASSFILE pEpClassFile = NULL; ++ PVM pVM = NULL; ++ PUVM pUVM = NULL; ++ unsigned int aio_system_reqests_max = RTFILEAIO_UNLIMITED_REQS; ++ pEpClass = pEndpoint->Core.pEpClass; ++ AssertMsg((NULL != pEpClass),("ep->class is NULL")); ++ pEndpointOps = pEpClass->pEndpointOps; ++ AssertMsg((NULL != pEndpointOps),("ep->class->ops is NULL")); ++ enmClassType = pEndpointOps->enmClassType; ++ AssertMsg((PDMASYNCCOMPLETIONEPCLASSTYPE_FILE == enmClassType), ++ ("ep->class->ops->type != PDMASYNCCOMPLETIONEPCLASSTYPE_FILE")); ++ pVM = pEpClass->pVM; ++ AssertMsg((NULL != pVM),("ep->class->VM is NULL")); ++ pUVM = pVM->pUVM; ++ AssertMsg((NULL != pUVM),("ep->class->VM->UVM is NULL")); ++ pEpClassFile = (PPDMASYNCCOMPLETIONEPCLASSFILE) (pUVM->pdm.s.apAsyncCompletionEndpointClass[enmClassType]); ++ AssertMsg((NULL != pEpClassFile),("ep->class->VM->UVM->pdn[globals] is NULL")); ++ aio_system_reqests_max = pEpClassFile->cReqsOutstandingMax; ++#if 0 ++ /* A one time check during development to verify getting the right number. */ ++ AssertMsg((256 != aio_system_reqests_max), ++ ("aio_system_reqests_max != 256 (val=%u)",aio_system_reqests_max)); ++#endif ++ if (RT_UNLIKELY( aio_system_reqests_max == RTFILEAIO_UNLIMITED_REQS ++ || (pAioMgr->cRequestsActiveMax+PDMACEPFILEMGR_REQS_STEP) <= aio_system_reqests_max)) ++ /* Grow the I/O manager */ ++ pAioMgr->enmState = PDMACEPFILEMGRSTATE_GROWING; + #endif + } + } diff --git a/emulators/virtualbox-ose/Makefile b/emulators/virtualbox-ose/Makefile index 52fdddd4e0e0..35dd54183088 100644 --- a/emulators/virtualbox-ose/Makefile +++ b/emulators/virtualbox-ose/Makefile @@ -2,7 +2,7 @@ PORTNAME= virtualbox-ose PORTVERSION= 6.1.26 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= emulators MASTER_SITES= https://download.virtualbox.org/virtualbox/${PORTVERSION}/ DISTFILES= VirtualBox-${PORTVERSION}${EXTRACT_SUFX} ${GUESTADDITIONS} diff --git a/emulators/virtualbox-ose/files/patch-src_VBox_VMM_VMMR3_PDMAsyncCompletionFileNormal.cpp b/emulators/virtualbox-ose/files/patch-src_VBox_VMM_VMMR3_PDMAsyncCompletionFileNormal.cpp new file mode 100644 index 000000000000..b04b05811f86 --- /dev/null +++ b/emulators/virtualbox-ose/files/patch-src_VBox_VMM_VMMR3_PDMAsyncCompletionFileNormal.cpp @@ -0,0 +1,59 @@ +--- src/VBox/VMM/VMMR3/PDMAsyncCompletionFileNormal.cpp.orig 2021-04-19 21:33:04.000000000 -0700 ++++ src/VBox/VMM/VMMR3/PDMAsyncCompletionFileNormal.cpp 2021-05-18 11:45:08.396136000 -0700 +@@ -27,6 +27,13 @@ + #include + #include + #include ++/* TBR: we need a complicated crawl through the data structure to get the AIO system limits ++ to check when considering growing the number of active AIO requests.... */ ++/* We need the PDMInternal *before* the UVM, or it isn't visible afterwards. (src/VBox/VMM/include/PDMInternal.h) */ ++#include ++#include ++#include ++/* TBR: end of extra includes. */ + + #include "PDMAsyncCompletionFileInternal.h" + +@@ -1120,8 +1127,40 @@ + */ + pdmacFileAioMgrNormalBalanceLoad(pAioMgr); + #else +- /* Grow the I/O manager */ +- pAioMgr->enmState = PDMACEPFILEMGRSTATE_GROWING; ++ /* TBR: Check the global AIO system limit before growing. ++ This is the complicateds crawl through the data structure mentioned ++ near the start of this file. ++ There HAS to be a better way and better time to get this limit! */ ++ PPDMASYNCCOMPLETIONEPCLASS pEpClass = NULL; ++ PCPDMASYNCCOMPLETIONEPCLASSOPS pEndpointOps = NULL; ++ PDMASYNCCOMPLETIONEPCLASSTYPE enmClassType; ++ PPDMASYNCCOMPLETIONEPCLASSFILE pEpClassFile = NULL; ++ PVM pVM = NULL; ++ PUVM pUVM = NULL; ++ unsigned int aio_system_reqests_max = RTFILEAIO_UNLIMITED_REQS; ++ pEpClass = pEndpoint->Core.pEpClass; ++ AssertMsg((NULL != pEpClass),("ep->class is NULL")); ++ pEndpointOps = pEpClass->pEndpointOps; ++ AssertMsg((NULL != pEndpointOps),("ep->class->ops is NULL")); ++ enmClassType = pEndpointOps->enmClassType; ++ AssertMsg((PDMASYNCCOMPLETIONEPCLASSTYPE_FILE == enmClassType), ++ ("ep->class->ops->type != PDMASYNCCOMPLETIONEPCLASSTYPE_FILE")); ++ pVM = pEpClass->pVM; ++ AssertMsg((NULL != pVM),("ep->class->VM is NULL")); ++ pUVM = pVM->pUVM; ++ AssertMsg((NULL != pUVM),("ep->class->VM->UVM is NULL")); ++ pEpClassFile = (PPDMASYNCCOMPLETIONEPCLASSFILE) (pUVM->pdm.s.apAsyncCompletionEndpointClass[enmClassType]); ++ AssertMsg((NULL != pEpClassFile),("ep->class->VM->UVM->pdn[globals] is NULL")); ++ aio_system_reqests_max = pEpClassFile->cReqsOutstandingMax; ++#if 0 ++ /* A one time check during development to verify getting the right number. */ ++ AssertMsg((256 != aio_system_reqests_max), ++ ("aio_system_reqests_max != 256 (val=%u)",aio_system_reqests_max)); ++#endif ++ if (RT_UNLIKELY( aio_system_reqests_max == RTFILEAIO_UNLIMITED_REQS ++ || (pAioMgr->cRequestsActiveMax+PDMACEPFILEMGR_REQS_STEP) <= aio_system_reqests_max)) ++ /* Grow the I/O manager */ ++ pAioMgr->enmState = PDMACEPFILEMGRSTATE_GROWING; + #endif + } + }