On 2014/11/17 18:14, Marc Zyngier wrote: > On 17/11/14 09:27, wanghaibin wrote: >> When queue irq(whatever SGI, PPI, SPI) failed, that means the ICH_LRn is not >> enough, so, if this circs happened, skip the follow irq queue logic, and flag >> the HCR.UIE directly. >> >> Signed-off-by: wanghaibin <wanghaibin.wang@xxxxxxxxxx> >> --- >> virt/kvm/arm/vgic.c | 12 +++++++++--- >> 1 files changed, 9 insertions(+), 3 deletions(-) >> >> diff --git a/virt/kvm/arm/vgic.c b/virt/kvm/arm/vgic.c >> index 8390475..12026e6 100644 >> --- a/virt/kvm/arm/vgic.c >> +++ b/virt/kvm/arm/vgic.c >> @@ -1415,20 +1415,26 @@ static void __kvm_vgic_flush_hwstate(struct kvm_vcpu *vcpu) >> >> /* SGIs */ >> for_each_set_bit(i, vgic_cpu->pending_percpu, VGIC_NR_SGIS) { >> - if (!vgic_queue_sgi(vcpu, i)) >> + if (!vgic_queue_sgi(vcpu, i)) { >> overflow = 1; >> + goto epilog; >> + } >> } >> >> /* PPIs */ >> for_each_set_bit_from(i, vgic_cpu->pending_percpu, VGIC_NR_PRIVATE_IRQS) { >> - if (!vgic_queue_hwirq(vcpu, i)) >> + if (!vgic_queue_hwirq(vcpu, i)) { >> overflow = 1; >> + goto epilog; >> + } >> } >> >> /* SPIs */ >> for_each_set_bit(i, vgic_cpu->pending_shared, vgic_nr_shared_irqs(dist)) { >> - if (!vgic_queue_hwirq(vcpu, i + VGIC_NR_PRIVATE_IRQS)) >> + if (!vgic_queue_hwirq(vcpu, i + VGIC_NR_PRIVATE_IRQS)) { >> overflow = 1; >> + goto epilog; >> + } >> } >> >> epilog: >> > > If you had taken some time to actually *read* the code, you would have > noticed that even in an overflow condition, it is possible to queue more > interrupts (hint: You can go from ACTIVE to ACTIVE+PENDING without > allocating a new LR). > > You call this an optimization, I call it an optimization killer. I am mindless, this is a wrong patch. Sorry. > > M. _______________________________________________ kvmarm mailing list kvmarm@xxxxxxxxxxxxxxxxxxxxx https://lists.cs.columbia.edu/mailman/listinfo/kvmarm