Skip to content

Commit

Permalink
lib/dma-debug.c: make locking work for RT
Browse files Browse the repository at this point in the history
Interrupt enable/disabled with spinlock is not a valid operation for RT
as it can make executing tasks sleep from a non-sleepable context.  So
convert it to spin_lock_irq[save, restore].

Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Pankaj Gupta <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Niklas Söderlund <[email protected]>
Cc: Vinod Koul <[email protected]>
Cc: Andy Lutomirski <[email protected]>
Cc: Ville Syrjl <[email protected]>
Cc: Miles Chen <[email protected]>
Cc: Marcelo Tosatti <[email protected]>
Cc: Joerg Roedel <[email protected]>
Cc: Stanislaw Gruszka <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Pankaj Gupta authored and torvalds committed May 3, 2017
1 parent 46f0537 commit 6a5cd60
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions lib/dma-debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -942,21 +942,17 @@ static int device_dma_allocations(struct device *dev, struct dma_debug_entry **o
unsigned long flags;
int count = 0, i;

local_irq_save(flags);

for (i = 0; i < HASH_SIZE; ++i) {
spin_lock(&dma_entry_hash[i].lock);
spin_lock_irqsave(&dma_entry_hash[i].lock, flags);
list_for_each_entry(entry, &dma_entry_hash[i].list, list) {
if (entry->dev == dev) {
count += 1;
*out_entry = entry;
}
}
spin_unlock(&dma_entry_hash[i].lock);
spin_unlock_irqrestore(&dma_entry_hash[i].lock, flags);
}

local_irq_restore(flags);

return count;
}

Expand Down

0 comments on commit 6a5cd60

Please sign in to comment.