aboutsummaryrefslogtreecommitdiff
path: root/sys/amd64
diff options
context:
space:
mode:
authorTycho Nightingale <tychon@FreeBSD.org>2018-03-07 18:03:22 +0000
committerTycho Nightingale <tychon@FreeBSD.org>2018-03-07 18:03:22 +0000
commit490768e24ab73c8e4ac0c3dc01d3d43028fee0c4 (patch)
treedddfc4af2f03e33bcb57db71fcc95a7bb6b425ac /sys/amd64
parent28f52545ae10bf5332fdf82e7a34d7fedffcd22f (diff)
downloadsrc-490768e24ab73c8e4ac0c3dc01d3d43028fee0c4.tar.gz
src-490768e24ab73c8e4ac0c3dc01d3d43028fee0c4.zip
Fix a lock recursion introduced in r327065.
Reported by: kmacy Reviewed by: grehan, jhb Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D14548
Notes
Notes: svn path=/head/; revision=330615
Diffstat (limited to 'sys/amd64')
-rw-r--r--sys/amd64/include/vmm.h1
-rw-r--r--sys/amd64/vmm/intel/vmx.c14
2 files changed, 11 insertions, 4 deletions
diff --git a/sys/amd64/include/vmm.h b/sys/amd64/include/vmm.h
index bc8fdfd34cd2..9d8fa6a4750b 100644
--- a/sys/amd64/include/vmm.h
+++ b/sys/amd64/include/vmm.h
@@ -636,6 +636,7 @@ struct vm_exit {
} spinup_ap;
struct {
uint64_t rflags;
+ uint64_t intr_status;
} hlt;
struct {
int vector;
diff --git a/sys/amd64/vmm/intel/vmx.c b/sys/amd64/vmm/intel/vmx.c
index 25e87f58c7e2..b0618d72dcb7 100644
--- a/sys/amd64/vmm/intel/vmx.c
+++ b/sys/amd64/vmm/intel/vmx.c
@@ -2282,6 +2282,11 @@ vmx_exit_process(struct vmx *vmx, int vcpu, struct vm_exit *vmexit)
vmm_stat_incr(vmx->vm, vcpu, VMEXIT_HLT, 1);
vmexit->exitcode = VM_EXITCODE_HLT;
vmexit->u.hlt.rflags = vmcs_read(VMCS_GUEST_RFLAGS);
+ if (virtual_interrupt_delivery)
+ vmexit->u.hlt.intr_status =
+ vmcs_read(VMCS_GUEST_INTR_STATUS);
+ else
+ vmexit->u.hlt.intr_status = 0;
break;
case EXIT_REASON_MTF:
vmm_stat_incr(vmx->vm, vcpu, VMEXIT_MTRAP, 1);
@@ -3267,12 +3272,13 @@ vmx_pending_intr(struct vlapic *vlapic, int *vecptr)
* interrupt by reevaluating virtual interrupts
* following Section 29.2.1 in the Intel SDM Volume 3.
*/
- uint64_t val;
+ struct vm_exit *vmexit;
uint8_t rvi, ppr;
- vmx_getreg(vlapic_vtx->vmx, vlapic->vcpuid,
- VMCS_IDENT(VMCS_GUEST_INTR_STATUS), &val);
- rvi = val & APIC_TPR_INT;
+ vmexit = vm_exitinfo(vlapic->vm, vlapic->vcpuid);
+ KASSERT(vmexit->exitcode == VM_EXITCODE_HLT,
+ ("vmx_pending_intr: exitcode not 'HLT'"));
+ rvi = vmexit->u.hlt.intr_status & APIC_TPR_INT;
lapic = vlapic->apic_page;
ppr = lapic->ppr & APIC_TPR_INT;
if (rvi > ppr) {