• Michael S. Tsirkin's avatar
    KVM: optimize ISR lookups · 8680b94b
    Michael S. Tsirkin authored
    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: default avatarMichael S. Tsirkin <mst@redhat.com>
    Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
    8680b94b
lapic.c 34.6 KB