summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvboxsync <vboxsync@cfe28804-0f27-0410-a406-dd0f0b0b656f>2015-10-09 18:07:59 +0000
committervboxsync <vboxsync@cfe28804-0f27-0410-a406-dd0f0b0b656f>2015-10-09 18:07:59 +0000
commitd9d4b364426523188e812b8e3fcfac22e238cc8f (patch)
tree7462be4a65e35a0eaa4d4c5028ee5322f5aec2a6
parent28e1c43606d632018abf00bf66082b933d1c7469 (diff)
downloadVirtualBox-svn-d9d4b364426523188e812b8e3fcfac22e238cc8f.tar.gz
VMMDev: Heartbeat adjustments and build fix.
git-svn-id: https://www.virtualbox.org/svn/vbox/trunk@58161 cfe28804-0f27-0410-a406-dd0f0b0b656f
-rw-r--r--src/VBox/Devices/VMMDev/VMMDev.cpp28
-rw-r--r--src/VBox/Devices/VMMDev/VMMDevState.h9
-rw-r--r--src/VBox/Devices/testcase/tstDeviceStructSizeRC.cpp12
3 files changed, 26 insertions, 23 deletions
diff --git a/src/VBox/Devices/VMMDev/VMMDev.cpp b/src/VBox/Devices/VMMDev/VMMDev.cpp
index 6e027ee32a0..ac8b24fb7f5 100644
--- a/src/VBox/Devices/VMMDev/VMMDev.cpp
+++ b/src/VBox/Devices/VMMDev/VMMDev.cpp
@@ -437,20 +437,20 @@ static int vmmdevReqHandler_ReportGuestInfo(PVMMDEV pThis, VMMDevRequestHeader *
static int vmmDevReqHandler_GuestHeartbeat(PVMMDEV pThis)
{
int rc;
- if (pThis->fHBCheckEnabled)
+ if (pThis->fHeartbeatActive)
{
- uint64_t const nsNowTS = TMTimerGetNano(pThis->pHearbeatFlatlinedTimer);
- if (!pThis->fHasMissedHB)
+ uint64_t const nsNowTS = TMTimerGetNano(pThis->pFlatlinedTimer);
+ if (!pThis->fFlatlined)
{ /* likely */ }
else
{
LogRel(("VMMDev: GuestHeartBeat: Guest is alive (gone %'llu ns)\n", nsNowTS - pThis->nsLastHeartbeatTS));
- ASMAtomicWriteBool(&pThis->fHasMissedHB, false);
+ ASMAtomicWriteBool(&pThis->fFlatlined, false);
}
ASMAtomicWriteU64(&pThis->nsLastHeartbeatTS, nsNowTS);
/* Postpone (or restart if we missed a beat) the timeout timer. */
- rc = TMTimerSetNano(pThis->pHearbeatFlatlinedTimer, pThis->cNsHeartbeatTimeout);
+ rc = TMTimerSetNano(pThis->pFlatlinedTimer, pThis->cNsHeartbeatTimeout);
}
else
rc = VINF_SUCCESS;
@@ -466,15 +466,15 @@ static int vmmDevReqHandler_GuestHeartbeat(PVMMDEV pThis)
static DECLCALLBACK(void) vmmDevHeartbeatFlatlinedTimer(PPDMDEVINS pDevIns, PTMTIMER pTimer, void *pvUser)
{
PVMMDEV pThis = (PVMMDEV)pvUser;
- if (pThis->fHBCheckEnabled)
+ if (pThis->fHeartbeatActive)
{
uint64_t cNsElapsed = TMTimerGetNano(pTimer) - pThis->nsLastHeartbeatTS;
- if ( !pThis->fHasMissedHB
+ if ( !pThis->fFlatlined
&& cNsElapsed >= pThis->cNsHeartbeatInterval)
{
LogRel(("VMMDev: vmmDevHeartbeatFlatlinedTimer: Guest seems to be unresponsive. Last heartbeat received %RU64 seconds ago\n",
cNsElapsed / RT_NS_1SEC));
- ASMAtomicWriteBool(&pThis->fHasMissedHB, true);
+ ASMAtomicWriteBool(&pThis->fFlatlined, true);
}
}
}
@@ -495,13 +495,13 @@ static int vmmDevReqHandler_HeartbeatConfigure(PVMMDEV pThis, VMMDevRequestHeade
pReq->cNsInterval = pThis->cNsHeartbeatInterval;
- if (pReq->fEnabled != pThis->fHBCheckEnabled)
+ if (pReq->fEnabled != pThis->fHeartbeatActive)
{
- ASMAtomicWriteBool(&pThis->fHBCheckEnabled, pReq->fEnabled);
+ ASMAtomicWriteBool(&pThis->fHeartbeatActive, pReq->fEnabled);
if (pReq->fEnabled)
{
/* Start the countdown. */
- rc = TMTimerSetNano(pThis->pHearbeatFlatlinedTimer, pThis->cNsHeartbeatTimeout);
+ rc = TMTimerSetNano(pThis->pFlatlinedTimer, pThis->cNsHeartbeatTimeout);
if (RT_SUCCESS(rc))
LogRel(("VMMDev: Heartbeat checking timer set to trigger every %RU64 milliseconds\n",
pThis->cNsHeartbeatTimeout / RT_NS_1MS));
@@ -510,13 +510,13 @@ static int vmmDevReqHandler_HeartbeatConfigure(PVMMDEV pThis, VMMDevRequestHeade
}
else
{
- rc = TMTimerStop(pThis->pHearbeatFlatlinedTimer);
+ rc = TMTimerStop(pThis->pFlatlinedTimer);
LogRel(("VMMDev: Heartbeat checking timer has been stopped, rc=%Rrc\n", rc));
}
}
else
{
- LogRel(("VMMDev: vmmDevReqHandler_HeartbeatConfigure: fHBCheckEnabled=%RTbool\n", pThis->fHBCheckEnabled));
+ LogRel(("VMMDev: vmmDevReqHandler_HeartbeatConfigure: fHBCheckEnabled=%RTbool\n", pThis->fHeartbeatActive));
rc = VINF_SUCCESS;
}
@@ -4175,7 +4175,7 @@ static DECLCALLBACK(int) vmmdevConstruct(PPDMDEVINS pDevIns, int iInstance, PCFG
* Create heartbeat checking timer.
*/
rc = PDMDevHlpTMTimerCreate(pDevIns, TMCLOCK_VIRTUAL, vmmDevHeartbeatFlatlinedTimer, pThis,
- TMTIMER_FLAGS_NO_CRIT_SECT, "Heartbeat flatlined", &pThis->pHearbeatFlatlinedTimer);
+ TMTIMER_FLAGS_NO_CRIT_SECT, "Heartbeat flatlined", &pThis->pFlatlinedTimer);
AssertRCReturn(rc, rc);
#ifdef VBOX_WITH_HGCM
diff --git a/src/VBox/Devices/VMMDev/VMMDevState.h b/src/VBox/Devices/VMMDev/VMMDevState.h
index 47840461de4..35407e72d48 100644
--- a/src/VBox/Devices/VMMDev/VMMDevState.h
+++ b/src/VBox/Devices/VMMDev/VMMDevState.h
@@ -359,12 +359,14 @@ typedef struct VMMDevState
RTTEST hTestingTest;
#endif /* !VBOX_WITHOUT_TESTING_FEATURES */
+ /** @name Heartbeat
+ * @{ */
/** Timestamp of the last heartbeat from guest in nanosec. */
uint64_t volatile nsLastHeartbeatTS;
/** Indicates whether we missed HB from guest on last check. */
- bool volatile fHasMissedHB;
+ bool volatile fFlatlined;
/** Indicates whether heartbeat check is active. */
- bool volatile fHBCheckEnabled;
+ bool volatile fHeartbeatActive;
/** Alignment padding. */
bool afAlignment8[6];
/** Guest heartbeat interval in nanoseconds.
@@ -374,7 +376,8 @@ typedef struct VMMDevState
* conclude the guest is doing a Dixie Flatline (Neuromancer) impression. */
uint64_t cNsHeartbeatTimeout;
/** Timer for signalling a flatlined guest. */
- PTMTIMERR3 pHearbeatFlatlinedTimer;
+ PTMTIMERR3 pFlatlinedTimer;
+ /** @} */
} VMMDevState;
typedef VMMDevState VMMDEV;
/** Pointer to the VMM device state. */
diff --git a/src/VBox/Devices/testcase/tstDeviceStructSizeRC.cpp b/src/VBox/Devices/testcase/tstDeviceStructSizeRC.cpp
index a04131a668b..eb69e3ea111 100644
--- a/src/VBox/Devices/testcase/tstDeviceStructSizeRC.cpp
+++ b/src/VBox/Devices/testcase/tstDeviceStructSizeRC.cpp
@@ -1672,12 +1672,12 @@ int main()
GEN_CHECK_OFF(VMMDEV, TestingData.Value.u64Value);
GEN_CHECK_OFF(VMMDEV, TestingData.Value.u32Unit);
GEN_CHECK_OFF(VMMDEV, TestingData.Value.szName);
- GEN_CHECK_OFF(VMMDEV, uLastHBTime);
- GEN_CHECK_OFF(VMMDEV, fHasMissedHB);
- GEN_CHECK_OFF(VMMDEV, fHBCheckEnabled);
- GEN_CHECK_OFF(VMMDEV, u64HeartbeatInterval);
- GEN_CHECK_OFF(VMMDEV, u64HeartbeatTimeout);
- GEN_CHECK_OFF(VMMDEV, pHBCheckTimer);
+ GEN_CHECK_OFF(VMMDEV, nsLastHeartbeatTS);
+ GEN_CHECK_OFF(VMMDEV, fFlatlined);
+ GEN_CHECK_OFF(VMMDEV, fHeartbeatActive);
+ GEN_CHECK_OFF(VMMDEV, cNsHeartbeatInterval);
+ GEN_CHECK_OFF(VMMDEV, cNsHeartbeatTimeout);
+ GEN_CHECK_OFF(VMMDEV, pFlatlinedTimer);
#ifdef VBOX_WITH_BUSLOGIC
GEN_CHECK_SIZE(BUSLOGICDEVICE);