Author: jhb
Date: Sat May  4 00:59:11 2019
New Revision: 347074
URL: https://svnweb.freebsd.org/changeset/base/347074

Log:
  MFC 330615: Fix a lock recursion introduced in r327065.

Modified:
  stable/11/sys/amd64/include/vmm.h
  stable/11/sys/amd64/vmm/intel/vmx.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/amd64/include/vmm.h
==============================================================================
--- stable/11/sys/amd64/include/vmm.h   Sat May  4 00:56:47 2019        
(r347073)
+++ stable/11/sys/amd64/include/vmm.h   Sat May  4 00:59:11 2019        
(r347074)
@@ -634,6 +634,7 @@ struct vm_exit {
                } spinup_ap;
                struct {
                        uint64_t        rflags;
+                       uint64_t        intr_status;
                } hlt;
                struct {
                        int             vector;

Modified: stable/11/sys/amd64/vmm/intel/vmx.c
==============================================================================
--- stable/11/sys/amd64/vmm/intel/vmx.c Sat May  4 00:56:47 2019        
(r347073)
+++ stable/11/sys/amd64/vmm/intel/vmx.c Sat May  4 00:59:11 2019        
(r347074)
@@ -2329,6 +2329,11 @@ vmx_exit_process(struct vmx *vmx, int vcpu, struct vm_
                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);
@@ -3369,12 +3374,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) {
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to