[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] Question, Lock of pending_irq struct in Xen ARM.
On Mon, 9 Mar 2015, ììì wrote: > HI. > > I'm now modifying GIC in Xen 4.5.0. > > I have some question about lock of pending_irq struct in Xen ARM. > >  > > pending_irq of SGI and PPI is stored in 'vcpu struct'. (IRQ num 0 ~ 31) > > pending_irq of SPI is stored in 'domain struct'. (IRQ num 32 ~ ) > >  > > For accessing pending_irq struct, Xen use 'irq_to_pending(struct vcpu *v, int > Âirq)' function. > > irq_to_pending function return properÂpending_irqÂdepending on IRQ number. > >  > >  > > * 'gic_update_one_lr' function process > > 1) before callÂgic_update_one_lr, xen acquire like this > "spin_lock_irqsave(&v->arch.vgic.lock, flags)"; > > 2) InÂgic_update_one_lr, getÂpending_irq throughÂirq_to_pendingÂfunction. > > 3) change state ofÂirq_to_pendingÂand update lr > >  > > When IRQ number is below 31,Âirq_to_pendingÂfunction return pending_irq > stored in vcpu struct. > > It's ok to changeÂirq_to_pendingÂstate, becauseÂ&v->arch.vgic.lock acquire. > > But When IRQ number is above 32,Âirq_to_pendingÂfunction return pending_irq > stored in domain struct. > > And change state ofÂirq_to_pendingÂwithout domain's lock. > > I think thatÂpending_irq of SPI stored in domain struct is shared among > vcpus. and need to acquire domain's lockÂbefore > changeÂpending_irq. > > But why don't use domain's lock in Xen Code ?? Thanks for the good analysis and the well framed question. It is safe to acquire just the vcpu lock, rather than the domain lock, because we always configure the system so that SPIs are delivered to just one physical cpu/one vcpu. It is not possible to receive an SPI in pcpu0 or pcpu1. Therefore it is not possible to change the same pending_irq on two different cpus simultaneously. _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |