aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/irq.h
diff options
context:
space:
mode:
authorMarcelo Tosatti <mtosatti@redhat.com>2008-09-24 19:28:34 -0400
committerAvi Kivity <avi@redhat.com>2008-10-15 08:25:28 -0400
commite48258009d941891fca35348986b8d280caf31cd (patch)
tree73d1fb56a9fc22c1e55160bb04e772bd6b2244fb /arch/x86/kvm/irq.h
parent582801a95d2f2ceab841779e1dec0e11dfec44c0 (diff)
KVM: PIC: enhance IPI avoidance
The PIC code makes little effort to avoid kvm_vcpu_kick(), resulting in unnecessary guest exits in some conditions. For example, if the timer interrupt is routed through the IOAPIC, IRR for IRQ 0 will get set but not cleared, since the APIC is handling the acks. This means that everytime an interrupt < 16 is triggered, the priority logic will find IRQ0 pending and send an IPI to vcpu0 (in case IRQ0 is not masked, which is Linux's case). Introduce a new variable isr_ack to represent the IRQ's for which the guest has been signalled / cleared the ISR. Use it to avoid more than one IPI per trigger-ack cycle, in addition to the avoidance when ISR is set in get_priority(). Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm/irq.h')
-rw-r--r--arch/x86/kvm/irq.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/arch/x86/kvm/irq.h b/arch/x86/kvm/irq.h
index 479a3d2d5614..4748532fd1da 100644
--- a/arch/x86/kvm/irq.h
+++ b/arch/x86/kvm/irq.h
@@ -42,6 +42,7 @@ struct kvm_kpic_state {
42 u8 irr; /* interrupt request register */ 42 u8 irr; /* interrupt request register */
43 u8 imr; /* interrupt mask register */ 43 u8 imr; /* interrupt mask register */
44 u8 isr; /* interrupt service register */ 44 u8 isr; /* interrupt service register */
45 u8 isr_ack; /* interrupt ack detection */
45 u8 priority_add; /* highest irq priority */ 46 u8 priority_add; /* highest irq priority */
46 u8 irq_base; 47 u8 irq_base;
47 u8 read_reg_select; 48 u8 read_reg_select;
@@ -70,6 +71,7 @@ struct kvm_pic *kvm_create_pic(struct kvm *kvm);
70void kvm_pic_set_irq(void *opaque, int irq, int level); 71void kvm_pic_set_irq(void *opaque, int irq, int level);
71int kvm_pic_read_irq(struct kvm *kvm); 72int kvm_pic_read_irq(struct kvm *kvm);
72void kvm_pic_update_irq(struct kvm_pic *s); 73void kvm_pic_update_irq(struct kvm_pic *s);
74void kvm_pic_clear_isr_ack(struct kvm *kvm);
73 75
74static inline struct kvm_pic *pic_irqchip(struct kvm *kvm) 76static inline struct kvm_pic *pic_irqchip(struct kvm *kvm)
75{ 77{