WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] [PATCH 1 of 4] xen: interrupt remapping in HVM guests

>>> On 30.08.10 at 13:25, <stefano.stabellini@xxxxxxxxxxxxx> 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()?

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)?

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel