From: Stefano Stabellini Subject: Re: [PATCH 1 of 4] xen: interrupt remapping in HVM guests Date: Mon, 30 Aug 2010 13:40:10 +0100 Message-ID: References: <1283167504-7787-1-git-send-email-stefano.stabellini@eu.citrix.com> <4C7BBD210200007800012D3E@vpn.id2.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Return-path: In-Reply-To: <4C7BBD210200007800012D3E@vpn.id2.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Jan Beulich Cc: "xen-devel@lists.xensource.com" , Stefano Stabellini List-Id: xen-devel@lists.xenproject.org On Mon, 30 Aug 2010, Jan Beulich wrote: > >>> On 30.08.10 at 13:25, wrote: > > --- a/xen/arch/x86/domain.c Tue Aug 17 19:32:37 2010 +0100 > > +++ b/xen/arch/x86/domain.c Fri Aug 20 16:47:36 2010 +0100 > > @@ -490,6 +490,16 @@ int arch_domain_create(struct domain *d, > > if ( !IO_APIC_IRQ(i) ) > > d->arch.irq_pirq[i] = d->arch.pirq_irq[i] = i; > > > > + d->arch.pirq_emuirq = xmalloc_array(int, d->nr_pirqs); > > + d->arch.emuirq_pirq = xmalloc_array(int, nr_irqs); > > + if ( !d->arch.pirq_emuirq || !d->arch.emuirq_pirq ) > > + goto fail; > > + memset(d->arch.pirq_emuirq, IRQ_UNBOUND, > > + d->nr_pirqs * sizeof(*d->arch.pirq_emuirq)); > > + memset(d->arch.emuirq_pirq, IRQ_UNBOUND, > > + d->nr_pirqs * sizeof(*d->arch.emuirq_pirq)); > > + > > + > > if ( (rc = iommu_domain_init(d)) != 0 ) > > goto fail; > > > > Shouldn't this be done for HVM domains only, and should you free > these arrays both in the error path of that function and in e.g. > arch_domain_destroy()? Yes, you are right about that, I'll fix and resend. > > Additionally, shouldn't you add a build time check making sure > that IRQ_UNBOUND is actually suitable for initialization via > memset() (or alternatively use a loop)? > something like typeof?