Re: [PATCH v2] genirq: don't sync irq thread if current happen to be the very irq thread

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

 



On Tue, May 22, 2012 at 03:50:38PM +0200, Thomas Gleixner wrote:
> On Sun, 20 May 2012, Yong Zhang wrote:
> > On Sun, May 20, 2012 at 01:27:31PM +0800, Yong Zhang wrote:
> > > --- a/kernel/irq/manage.c
> > > +++ b/kernel/irq/manage.c
> > > @@ -41,6 +41,7 @@ early_param("threadirqs", setup_forced_irqthreads);
> > >  void synchronize_irq(unsigned int irq)
> > >  {
> > >  	struct irq_desc *desc = irq_to_desc(irq);
> > > +	struct irqaction *action = desc->action;
> > 
> > Bad time for dereferencing *action.
> 
> You meant dereferencing *desc :)

Ah, yes :)

>  
> >  	/*
> >  	 * We made sure that no hardirq handler is running. Now verify
> >  	 * that no threaded handlers are active.
> > +	 * But for theaded irq, we don't sync if current happens to be
> > +	 * the irq thread; otherwise we could deadlock.
> >  	 */
> > +	action = desc->action;
> 
> And dereferencing action w/o being protected by desc->lock is buggy.
> 
> +	while (action) {
> > +		if (action->thread && action->thread == current)
> > +			return;
> > +		action = action->next;
> > +	}
> > +
> 
> Aside of that I really do not like that change. It'll hide real
> deadlocks when disable_irq() is called from the interrupt handler.
> 
> Also this will not cure all problems of that MMC driver on RT or with
> forced threaded interrupts.
> 
> Assume that tasklet code runs from the softirq thread so it will
> schedule when desc->threads_active > 0. This will trigger a
> "scheduling while atomic" warning.

Yes.

> 
> The irq_enable/disable dance in that driver is amazing. I have no time
> at the moment to grok the logic behind this, but it bet this can be
> done way simpler and less horrible.

I'll reconsider this issue and try to find the simpler way.

Thanks,
Yong
--
To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [RT Stable]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux