From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcelo Tosatti Subject: Re: [PATCH v2 8/8] KVM: Use eoi to track RTC interrupt delivery status Date: Tue, 19 Mar 2013 20:28:12 -0300 Message-ID: <20130319232811.GA27459@amt.cnet> References: <1363591479-4653-1-git-send-email-yang.z.zhang@intel.com> <1363591479-4653-9-git-send-email-yang.z.zhang@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: kvm@vger.kernel.org, gleb@redhat.com, xiantao.zhang@intel.com To: Yang Zhang Return-path: Received: from mx1.redhat.com ([209.132.183.28]:1320 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755048Ab3CSX21 (ORCPT ); Tue, 19 Mar 2013 19:28:27 -0400 Content-Disposition: inline In-Reply-To: <1363591479-4653-9-git-send-email-yang.z.zhang@intel.com> Sender: kvm-owner@vger.kernel.org List-ID: On Mon, Mar 18, 2013 at 03:24:39PM +0800, Yang Zhang wrote: > From: Yang Zhang > > 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 > --- > 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.