Skip to content

Commit

Permalink
dma-debug: release free_entries_lock before saving stack trace
Browse files Browse the repository at this point in the history
Saving stack trace can take a while and once the entry
is allocated free_entries_lock is no longer needed.

Signed-off-by: Jakub Kicinski <kubakici@wp.pl>
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
  • Loading branch information
Jakub Kicinski authored and Joerg Roedel committed Apr 12, 2012
1 parent 0034102 commit 29cdd4e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/dma-debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -430,29 +430,29 @@ static struct dma_debug_entry *__dma_entry_alloc(void)
*/
static struct dma_debug_entry *dma_entry_alloc(void)
{
struct dma_debug_entry *entry = NULL;
struct dma_debug_entry *entry;
unsigned long flags;

spin_lock_irqsave(&free_entries_lock, flags);

if (list_empty(&free_entries)) {
pr_err("DMA-API: debugging out of memory - disabling\n");
global_disable = true;
goto out;
spin_unlock_irqrestore(&free_entries_lock, flags);
return NULL;
}

entry = __dma_entry_alloc();

spin_unlock_irqrestore(&free_entries_lock, flags);

#ifdef CONFIG_STACKTRACE
entry->stacktrace.max_entries = DMA_DEBUG_STACKTRACE_ENTRIES;
entry->stacktrace.entries = entry->st_entries;
entry->stacktrace.skip = 2;
save_stack_trace(&entry->stacktrace);
#endif

out:
spin_unlock_irqrestore(&free_entries_lock, flags);

return entry;
}

Expand Down

0 comments on commit 29cdd4e

Please sign in to comment.