From 8104085d9ac1f416e15d464c603b8ac7ea435857 Mon Sep 17 00:00:00 2001 From: Mike Larkin Date: Mon, 4 Jan 2016 01:35:57 +0000 Subject: Do proper termination of VMs by doing proper VCPU run state management. This should fix some of the odd termination errors people have been seeing (vmctl status showing running VMs after they have exited/crashed, and invalid instruction panics on vmptrld during certain races) This diff also implements dropping the biglock when running a VCPU, and reacquiring the lock as needed based on the type of exit (normal vs. external interrupt) diff supplied by Stefan Kempf , many thanks! --- sys/arch/amd64/include/vmmvar.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'sys/arch/amd64/include/vmmvar.h') diff --git a/sys/arch/amd64/include/vmmvar.h b/sys/arch/amd64/include/vmmvar.h index cf52ea6940f..2a56036c393 100644 --- a/sys/arch/amd64/include/vmmvar.h +++ b/sys/arch/amd64/include/vmmvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vmmvar.h,v 1.6 2015/12/17 09:29:28 mlarkin Exp $ */ +/* $OpenBSD: vmmvar.h,v 1.7 2016/01/04 01:35:56 mlarkin Exp $ */ /* * Copyright (c) 2014 Mike Larkin * @@ -103,8 +103,9 @@ enum { VCPU_STATE_STOPPED, VCPU_STATE_RUNNING, - VCPU_STATE_REQSTOP, - VCPU_STATE_UNKNOWN + VCPU_STATE_REQTERM, + VCPU_STATE_TERMINATED, + VCPU_STATE_UNKNOWN, }; enum { @@ -357,11 +358,11 @@ struct vcpu { struct vm *vc_parent; uint32_t vc_id; + u_int vc_state; SLIST_ENTRY(vcpu) vc_vcpu_link; vaddr_t vc_hsa_stack_va; uint8_t vc_virt_mode; - uint8_t vc_state; struct cpu_info *vc_last_pcpu; union vm_exit vc_exit; -- cgit v1.2.3