diff options
author | 2018-04-26 11:37:25 +0000 | |
---|---|---|
committer | 2018-04-26 11:37:25 +0000 | |
commit | 7933eea00b8c3309fe2a7389bcee1918bf97402d (patch) | |
tree | 15387c2fd8e60b7ca876212bb33ffa93ad355f0f | |
parent | Consolidate duplicate error messages, 'return' is not a function so (diff) | |
download | wireguard-openbsd-7933eea00b8c3309fe2a7389bcee1918bf97402d.tar.xz wireguard-openbsd-7933eea00b8c3309fe2a7389bcee1918bf97402d.zip |
vmm(4): remove some unnecessary kernel lock code from the SVM guest loop
that is not needed; this code deals with delaying the relocking of the
kernel lock until after interrupts are processed during external interrupt
exiting, but this is handled differently on SVM. External interrupts are
automatically handled by the CPU as soon as stgi() is performed after
exit. (The original code came from the VMX/Intel guest loop.)
ok guenther@
-rw-r--r-- | sys/arch/amd64/amd64/vmm.c | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/sys/arch/amd64/amd64/vmm.c b/sys/arch/amd64/amd64/vmm.c index 44a75c478dc..455a10a6dcc 100644 --- a/sys/arch/amd64/amd64/vmm.c +++ b/sys/arch/amd64/amd64/vmm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vmm.c,v 1.192 2018/04/26 10:43:58 mlarkin Exp $ */ +/* $OpenBSD: vmm.c,v 1.193 2018/04/26 11:37:25 mlarkin Exp $ */ /* * Copyright (c) 2014 Mike Larkin <mlarkin@openbsd.org> * @@ -6026,7 +6026,7 @@ vmm_handle_cpuid(struct vcpu *vcpu) int vcpu_run_svm(struct vcpu *vcpu, struct vm_run_params *vrp) { - int ret = 0, resume, locked; + int ret = 0, resume; struct region_descriptor gdt; struct cpu_info *ci; uint64_t exit_reason; @@ -6209,6 +6209,7 @@ vcpu_run_svm(struct vcpu *vcpu, struct vm_run_params *vrp) * (external interrupt), the interrupt will be processed now. */ stgi(); + KERNEL_LOCK(); vcpu->vc_gueststate.vg_rip = vmcb->v_rip; vmcb->v_tlb_control = SVM_TLB_CONTROL_FLUSH_NONE; @@ -6220,12 +6221,6 @@ vcpu_run_svm(struct vcpu *vcpu, struct vm_run_params *vrp) vcpu->vc_gueststate.vg_exit_reason = exit_reason; } - if (ret || exit_reason != SVM_VMEXIT_INTR) { - KERNEL_LOCK(); - locked = 1; - } else - locked = 0; - /* If we exited successfully ... */ if (ret == 0) { resume = 1; @@ -6238,9 +6233,6 @@ vcpu_run_svm(struct vcpu *vcpu, struct vm_run_params *vrp) */ ret = svm_handle_exit(vcpu); - if (!locked) - KERNEL_LOCK(); - if (vcpu->vc_gueststate.vg_rflags & PSL_I) vcpu->vc_irqready = 1; else |