Re: raw memory & PCI bus access

Rogier Wolff (R.E.Wolff@BitWizard.nl)
Fri, 22 Oct 1999 00:48:05 +0200 (MEST)


Alan Cox wrote:
> > Alan Cox wrote:
> > > Infinite if your IRQ is shared.
> > >
> > > You probably want to handle the IRQ in the kernel including retrieving the
> > > status you need and clearing the irq state.
> >
> > Without documentation, sometimes we don't know how to clear the irq state ;-)
> > disable_irq() works wonders in this case.
>
> Not if its shared.

Alan is a bit terse every now and then. In this case, that's because
he's been explaining this over and over again.

It is kind of tricky, let me try to explain it.

You have two drivers that share an interrupt. Normally the two drivers
both get called when an interrupt happens, they both check if there is
something to do for their device, and they both clear the interrupt if
their device was the one interrupting.

In this case, we have one real (e.g. disk) device, and one
"user-device" on an interrupt. What can happen (but not the first time
you try it!: The first time you try it it will work...) is that the
user-device interrupts, disables the interrupt, and tries to wake the
program. However, this program causes a pagefault which requires the
disk. So the disk driver may then reenable interrupts. If it does,
this will cause an immidate call of both interrupt routines, but the
disk is not yet ready. The user-level driver will then redisable
interrupts, to let the user-level program figure it out. Deadlock.

(IDE will timeout after a few seconds, and try anyway. I've seen a few
disks that somehow diddn't interrupt, and it still worked, albeit very
very slowly.... )

Roger.

-- 
** R.E.Wolff@BitWizard.nl ** http://www.BitWizard.nl/ ** +31-15-2137555 **
*-- BitWizard writes Linux device drivers for any device you may have! --*
 "I didn't say it was your fault. I said I was going to blame it on you."

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/