ia64/xen-unstable

changeset 17055:e7085b40dc08

vmx realmode: Only check for pending interrupts every 16th
instruction, since it is a moderately expensive operation.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Wed Feb 13 18:09:27 2008 +0000 (2008-02-13)
parents ec1fa84147ad
children e1dde6f8bc87
files xen/arch/x86/hvm/vmx/realmode.c
line diff
     1.1 --- a/xen/arch/x86/hvm/vmx/realmode.c	Wed Feb 13 16:35:51 2008 +0000
     1.2 +++ b/xen/arch/x86/hvm/vmx/realmode.c	Wed Feb 13 18:09:27 2008 +0000
     1.3 @@ -781,7 +781,7 @@ void vmx_realmode(struct cpu_user_regs *
     1.4      struct vcpu *curr = current;
     1.5      struct realmode_emulate_ctxt rm_ctxt;
     1.6      unsigned long intr_info = __vmread(VM_ENTRY_INTR_INFO);
     1.7 -    int i;
     1.8 +    unsigned int i, emulations = 0;
     1.9  
    1.10      rm_ctxt.ctxt.regs = regs;
    1.11  
    1.12 @@ -804,11 +804,19 @@ void vmx_realmode(struct cpu_user_regs *
    1.13  
    1.14      while ( curr->arch.hvm_vmx.vmxemul &&
    1.15              !softirq_pending(smp_processor_id()) &&
    1.16 -            !curr->arch.hvm_vmx.real_mode_io_in_progress &&
    1.17 -            /* Check for pending interrupts only in proper real mode. */
    1.18 -            ((curr->arch.hvm_vcpu.guest_cr[0] & X86_CR0_PE) ||
    1.19 -             !hvm_local_events_need_delivery(curr)) )
    1.20 +            !curr->arch.hvm_vmx.real_mode_io_in_progress )
    1.21 +    {
    1.22 +        /*
    1.23 +         * Check for pending interrupts only every 16 instructions, because
    1.24 +         * hvm_local_events_need_delivery() is moderately expensive, and only
    1.25 +         * in real mode, because we don't emulate protected-mode IDT vectoring.
    1.26 +         */
    1.27 +        if ( unlikely(!(++emulations & 15)) &&
    1.28 +             !(curr->arch.hvm_vcpu.guest_cr[0] & X86_CR0_PE) &&
    1.29 +             hvm_local_events_need_delivery(curr) )
    1.30 +            break;
    1.31          realmode_emulate_one(&rm_ctxt);
    1.32 +    }
    1.33  
    1.34      if ( !curr->arch.hvm_vmx.vmxemul )
    1.35      {