On Mon, Mar 18, 2013 at 03:24:39PM +0800, Yang Zhang wrote: > From: Yang Zhang <yang.z.zhang@xxxxxxxxx> > > Current interrupt coalescing logci which only used by RTC has conflict > with Posted Interrupt. > This patch introduces a new mechinism to use eoi to track interrupt: > When delivering an interrupt to vcpu, the need_eoi set to number of > vcpu that received the interrupt. And decrease it when each vcpu writing > eoi. No subsequent RTC interrupt can deliver to vcpu until all vcpus > write eoi. > > Signed-off-by: Yang Zhang <yang.z.zhang@xxxxxxxxx> > --- > virt/kvm/ioapic.c | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++ > 1 files changed, 67 insertions(+), 0 deletions(-) > > diff --git a/virt/kvm/ioapic.c b/virt/kvm/ioapic.c > index 7e47da8..8d498e5 100644 > --- a/virt/kvm/ioapic.c > +++ b/virt/kvm/ioapic.c > @@ -130,6 +130,48 @@ static void rtc_irq_get_dest_vcpu(struct kvm_ioapic *ioapic, int irq) > kvm_get_dest_vcpu(ioapic->kvm, &irqe, ioapic->rtc_status.vcpu_map); > } > > +static void rtc_irq_set_eoi(struct kvm_ioapic *ioapic, int irq) > +{ > + union kvm_ioapic_redirect_entry *entry = &ioapic->redirtbl[irq]; > + > + if (irq != 8) > + return; > + > + if (likely(!bitmap_empty(ioapic->rtc_status.vcpu_map, KVM_MAX_VCPUS))) { > + if (entry->fields.delivery_mode == APIC_DM_LOWEST) > + ioapic->rtc_status.need_eoi = 1; > + else { > + int weight; > + weight = bitmap_weight(ioapic->rtc_status.vcpu_map, > + sizeof(ioapic->rtc_status.vcpu_map)); > + ioapic->rtc_status.need_eoi = weight; > + } > + } > +} Why two bitmaps are necessary? One should be enough. -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html