Re: [PATCH] uio: uio_pdrv_genirq V2

From: Uwe Kleine-König
Date: Thu Jul 10 2008 - 06:30:55 EST


Alan Cox wrote:
>
> > > + else if (!irq_on && !priv->irq_disabled)
> > > + disable_irq(dev_info->irq);
> > I'm not sure if this is a problem on SMP. Should you use
> > disable_irq_nosync here, too? Probably it's OK.
>
> That one will also deadlock.
Can you explain why? I think irqcontrol is only called in task context.
I only see one possible deadlock and that's disable_irq being called
while the irq is IRQ_INPROGRESS on the same cpu. I'm always willing to
learn.

> The easiest fix is probably to use test_and_set and friends for each I/O
> operation.
Actually using spinlock + irq_disabled variable is new in V2 of this
patch. Don't know why this changed, though.

> You would then not need the lock to protect ->irq_disabled.
> Propogating that throughout means your user space has to handle the case
> of an IRQ arriving after disable returns but would be a fair bit saner I
> think ?
I think I didn't understand you right here, with the lock this can
happen, too, doesn't it?

Best regards
Uwe

--
Uwe Kleine-König, Software Engineer
Digi International GmbH Branch Breisach, Küferstrasse 8, 79206 Breisach, Germany
Tax: 315/5781/0242 / VAT: DE153662976 / Reg. Amtsgericht Dortmund HRB 13962
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/