Skip to content

Commit

Permalink
[PATCH] raw1394: fix locking in the presence of SMP and interrupts
Browse files Browse the repository at this point in the history
Changes all spinlocks that can be held during an irq handler to disable
interrupts while the lock is held.  Changes spin_[un]lock_irq to use the
irqsave/irqrestore variants for robustness and readability.

In raw1394.c:handle_iso_listen(), don't grab host_info_lock at all -- we're
not accessing host_info_list or host_count, and holding this lock while
trying to tasklet_kill the iso tasklet this can cause an ABBA deadlock if
ohci:dma_rcv_tasklet is running and tries to grab host_info_lock in
raw1394.c:receive_iso.  Test program attached reliably deadlocks all SMP
machines I have been able to test without this patch.

Signed-off-by: Andy Wingo <wingo@pobox.com>
Acked-by: Ben Collins <bcollins@ubuntu.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
Andy Wingo authored and Linus Torvalds committed Oct 20, 2005
1 parent c367c21 commit 4a9949d
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 49 deletions.
6 changes: 3 additions & 3 deletions drivers/ieee1394/ohci1394.c
Original file line number Diff line number Diff line change
Expand Up @@ -2283,8 +2283,9 @@ static void ohci_schedule_iso_tasklets(struct ti_ohci *ohci,
{
struct ohci1394_iso_tasklet *t;
unsigned long mask;
unsigned long flags;

spin_lock(&ohci->iso_tasklet_list_lock);
spin_lock_irqsave(&ohci->iso_tasklet_list_lock, flags);

list_for_each_entry(t, &ohci->iso_tasklet_list, link) {
mask = 1 << t->context;
Expand All @@ -2295,8 +2296,7 @@ static void ohci_schedule_iso_tasklets(struct ti_ohci *ohci,
tasklet_schedule(&t->tasklet);
}

spin_unlock(&ohci->iso_tasklet_list_lock);

spin_unlock_irqrestore(&ohci->iso_tasklet_list_lock, flags);
}

static irqreturn_t ohci_irq_handler(int irq, void *dev_id,
Expand Down
Loading

0 comments on commit 4a9949d

Please sign in to comment.