aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2008-02-13 18:09:27 +0000
committerKeir Fraser <keir.fraser@citrix.com>2008-02-13 18:09:27 +0000
commit5dfa26a76cefd4220962ac1dfbf9028081c0ac5a (patch)
tree2ade604a7e535f27dcdf8ce7a452f8df3fcfac67
parentdf46d3520618c41dae22794a93ada7abfe20ed95 (diff)
downloadxen-5dfa26a76cefd4220962ac1dfbf9028081c0ac5a.tar.gz
xen-5dfa26a76cefd4220962ac1dfbf9028081c0ac5a.tar.bz2
xen-5dfa26a76cefd4220962ac1dfbf9028081c0ac5a.zip
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>
-rw-r--r--xen/arch/x86/hvm/vmx/realmode.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/xen/arch/x86/hvm/vmx/realmode.c b/xen/arch/x86/hvm/vmx/realmode.c
index dc9f76e645..8d7572e0d5 100644
--- a/xen/arch/x86/hvm/vmx/realmode.c
+++ b/xen/arch/x86/hvm/vmx/realmode.c
@@ -781,7 +781,7 @@ void vmx_realmode(struct cpu_user_regs *regs)
struct vcpu *curr = current;
struct realmode_emulate_ctxt rm_ctxt;
unsigned long intr_info = __vmread(VM_ENTRY_INTR_INFO);
- int i;
+ unsigned int i, emulations = 0;
rm_ctxt.ctxt.regs = regs;
@@ -804,11 +804,19 @@ void vmx_realmode(struct cpu_user_regs *regs)
while ( curr->arch.hvm_vmx.vmxemul &&
!softirq_pending(smp_processor_id()) &&
- !curr->arch.hvm_vmx.real_mode_io_in_progress &&
- /* Check for pending interrupts only in proper real mode. */
- ((curr->arch.hvm_vcpu.guest_cr[0] & X86_CR0_PE) ||
- !hvm_local_events_need_delivery(curr)) )
+ !curr->arch.hvm_vmx.real_mode_io_in_progress )
+ {
+ /*
+ * Check for pending interrupts only every 16 instructions, because
+ * hvm_local_events_need_delivery() is moderately expensive, and only
+ * in real mode, because we don't emulate protected-mode IDT vectoring.
+ */
+ if ( unlikely(!(++emulations & 15)) &&
+ !(curr->arch.hvm_vcpu.guest_cr[0] & X86_CR0_PE) &&
+ hvm_local_events_need_delivery(curr) )
+ break;
realmode_emulate_one(&rm_ctxt);
+ }
if ( !curr->arch.hvm_vmx.vmxemul )
{