Index: /trunk/src/VBox/VMM/VMMR0/VMMR0.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMR0/VMMR0.cpp	(revision 54716)
+++ /trunk/src/VBox/VMM/VMMR0/VMMR0.cpp	(revision 54717)
@@ -510,4 +510,7 @@
 VMMR0DECL(int) VMMR0ThreadCtxHooksDeregister(PVMCPU pVCpu)
 {
+    /* Clear the VCPU <-> host CPU mapping as we've left HM context. See @bugref{7726} comment #19. */
+    ASMAtomicWriteU32(&pVCpu->idHostCpu, NIL_RTCPUID);
+
     if (pVCpu->vmm.s.hR0ThreadCtx != NIL_RTTHREADCTX)
     {
@@ -516,7 +519,4 @@
         AssertRCReturn(rc, rc);
     }
-
-    /* Clear the VCPU <-> host CPU mapping as we've left HM context. See @bugref{7726} comment #19. */
-    ASMAtomicWriteU32(&pVCpu->idHostCpu, NIL_RTCPUID);
     return VINF_SUCCESS;
 }
