Re: Interrupt/Sleep deadlock

From: Linus Torvalds (torvalds@transmeta.com)
Date: Tue Oct 10 2000 - 13:17:48 EST


In article <Pine.LNX.4.10.10010101035290.24876-100000@main.cyclades.com>,
Ivan Passos <lists@cyclades.com> wrote:
>
>"You could use a semaphore for this. Initialize it to 0, then call
>down() from the ioctl, and up() from the interrupt handler. If the
>up() happens before the down(), the down() won't go to sleep."
>
>Initializing it to 0 means:
>
> cfg_sem = MUTEX_LOCKED;
>
>It's the simplest to understand, and it works great!!
>
>Does anybody see a problem with this implementation??

No.

This is in fact how the SCSI layer has handled similar issues for a
_loong_ time now, so it had better work - and it does.

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



This archive was generated by hypermail 2b29 : Sun Oct 15 2000 - 21:00:15 EST