[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 5/5] xen/vgic: initialize pending_irqs.lr_queue



On Tue, 26 Jun 2012, Ian Campbell wrote:
> On Wed, 2012-06-06 at 12:22 +0100, Stefano Stabellini wrote:
> > Properly initialize all the pending_irqs.lr_queue like we do for
> > inflight.
> > Check whether we already have the irq in lr_queue before adding it.
> 
> Should this be a fatal error? Can a guest make this happen?

it could happen if the guest keeps enabling and disabling the irqs using
the GICD_ICENABLERn and the GICD_ISENABLERn registers.


> > Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
> > ---
> >  xen/arch/arm/gic.c  |    6 ++++++
> >  xen/arch/arm/vgic.c |    6 ++++++
> >  2 files changed, 12 insertions(+), 0 deletions(-)
> > 
> > diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c
> > index 2e41d75..998033a 100644
> > --- a/xen/arch/arm/gic.c
> > +++ b/xen/arch/arm/gic.c
> > @@ -456,6 +456,12 @@ void gic_set_guest_irq(struct vcpu *v, unsigned int 
> > virtual_irq,
> >      }
> >  
> >      n = irq_to_pending(v, virtual_irq);
> > +    if ( !list_empty(&n->lr_queue) )
> > +    {
> > +        printk(KERN_WARNING "%s: irq %d already in lr_queue\n", __func__,
> > +                virtual_irq);
> > +        goto out;
> > +    }
> >      list_for_each_entry ( iter, &v->arch.vgic.lr_pending, lr_queue )
> >      {
> >          if ( iter->priority > priority )
> > diff --git a/xen/arch/arm/vgic.c b/xen/arch/arm/vgic.c
> > index 4cdfec5..653e8e5 100644
> > --- a/xen/arch/arm/vgic.c
> > +++ b/xen/arch/arm/vgic.c
> > @@ -84,7 +84,10 @@ int domain_vgic_init(struct domain *d)
> >      d->arch.vgic.pending_irqs =
> >          xzalloc_array(struct pending_irq, d->arch.vgic.nr_lines);
> >      for (i=0; i<d->arch.vgic.nr_lines; i++)
> > +    {
> >          INIT_LIST_HEAD(&d->arch.vgic.pending_irqs[i].inflight);
> > +        INIT_LIST_HEAD(&d->arch.vgic.pending_irqs[i].lr_queue);
> > +    }
> >      for (i=0; i<DOMAIN_NR_RANKS(d); i++)
> >          spin_lock_init(&d->arch.vgic.shared_irqs[i].lock);
> >      return 0;
> > @@ -99,7 +102,10 @@ int vcpu_vgic_init(struct vcpu *v)
> >  
> >      memset(&v->arch.vgic.pending_irqs, 0, 
> > sizeof(v->arch.vgic.pending_irqs));
> >      for (i = 0; i < 32; i++)
> > +    {
> >          INIT_LIST_HEAD(&v->arch.vgic.pending_irqs[i].inflight);
> > +        INIT_LIST_HEAD(&v->arch.vgic.pending_irqs[i].lr_queue);
> > +    }
> >      printk("vcpu_vgic_init irq[0] at %p desc is %p\n",
> >             &v->arch.vgic.pending_irqs[0],
> >             v->arch.vgic.pending_irqs[0].desc);
> 
> 
> 

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.