@@ -1300,9 +1300,10 @@ DEFINE_IDTENTRY_VC_SAFE_STACK(exc_vmm_communication)
return;
}
+ instrumentation_begin();
+
irq_state = irqentry_nmi_enter(regs);
lockdep_assert_irqs_disabled();
- instrumentation_begin();
/*
* This is invoked through an interrupt gate, so IRQs are disabled. The
@@ -1352,13 +1353,19 @@ DEFINE_IDTENTRY_VC_SAFE_STACK(exc_vmm_communication)
BUG();
}
-out:
- instrumentation_end();
irqentry_nmi_exit(regs, irq_state);
+ instrumentation_end();
return;
fail:
+ /*
+ * Leave NMI mode - the GHCB is not busy anymore and depending on where
+ * the #VC came from this code is about to either kill the task (when in
+ * task context) or kill the machine.
+ */
+ irqentry_nmi_exit(regs, irq_state);
+
if (user_mode(regs)) {
/*
* Do not kill the machine if user-space triggered the
@@ -1380,7 +1387,9 @@ DEFINE_IDTENTRY_VC_SAFE_STACK(exc_vmm_communication)
panic("Returned from Terminate-Request to Hypervisor\n");
}
- goto out;
+ instrumentation_end();
+
+ return;
}
/* This handler runs on the #VC fall-back stack. It can cause further #VC exceptions */