KVM: optimize ISR lookups
We perform ISR lookups twice: during interrupt injection and on EOI. Typical workloads only have a single bit set there. So we can avoid ISR scans by 1. counting bits as we set/clear them in ISR 2. on set, caching the injected vector number 3. on clear, invalidating the cache The real purpose of this is enabling PV EOI which needs to quickly validate the vector. But non PV guests also benefit: with this patch, and without interrupt nesting, apic_find_highest_isr will always return immediately without scanning ISR. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
This commit is contained in:

zatwierdzone przez
Avi Kivity

rodzic
5eadf916df
commit
8680b94b0e
@@ -13,6 +13,10 @@ struct kvm_lapic {
|
||||
u32 divide_count;
|
||||
struct kvm_vcpu *vcpu;
|
||||
bool irr_pending;
|
||||
/* Number of bits set in ISR. */
|
||||
s16 isr_count;
|
||||
/* The highest vector set in ISR; if -1 - invalid, must scan ISR. */
|
||||
int highest_isr_cache;
|
||||
/**
|
||||
* APIC register page. The layout matches the register layout seen by
|
||||
* the guest 1:1, because it is accessed by the vmx microcode.
|
||||
|
Reference in New Issue
Block a user