Commit 29cdd4e4 authored by Jakub Kicinski's avatar Jakub Kicinski Committed by Joerg Roedel

dma-debug: release free_entries_lock before saving stack trace

Saving stack trace can take a while and once the entry
is allocated free_entries_lock is no longer needed.
Signed-off-by: default avatarJakub Kicinski <kubakici@wp.pl>
Signed-off-by: default avatarJoerg Roedel <joerg.roedel@amd.com>
parent 00341028
...@@ -430,7 +430,7 @@ static struct dma_debug_entry *__dma_entry_alloc(void) ...@@ -430,7 +430,7 @@ static struct dma_debug_entry *__dma_entry_alloc(void)
*/ */
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; unsigned long flags;
spin_lock_irqsave(&free_entries_lock, flags); spin_lock_irqsave(&free_entries_lock, flags);
...@@ -438,11 +438,14 @@ static struct dma_debug_entry *dma_entry_alloc(void) ...@@ -438,11 +438,14 @@ static struct dma_debug_entry *dma_entry_alloc(void)
if (list_empty(&free_entries)) { if (list_empty(&free_entries)) {
pr_err("DMA-API: debugging out of memory - disabling\n"); pr_err("DMA-API: debugging out of memory - disabling\n");
global_disable = true; global_disable = true;
goto out; spin_unlock_irqrestore(&free_entries_lock, flags);
return NULL;
} }
entry = __dma_entry_alloc(); entry = __dma_entry_alloc();
spin_unlock_irqrestore(&free_entries_lock, flags);
#ifdef CONFIG_STACKTRACE #ifdef CONFIG_STACKTRACE
entry->stacktrace.max_entries = DMA_DEBUG_STACKTRACE_ENTRIES; entry->stacktrace.max_entries = DMA_DEBUG_STACKTRACE_ENTRIES;
entry->stacktrace.entries = entry->st_entries; entry->stacktrace.entries = entry->st_entries;
...@@ -450,9 +453,6 @@ static struct dma_debug_entry *dma_entry_alloc(void) ...@@ -450,9 +453,6 @@ static struct dma_debug_entry *dma_entry_alloc(void)
save_stack_trace(&entry->stacktrace); save_stack_trace(&entry->stacktrace);
#endif #endif
out:
spin_unlock_irqrestore(&free_entries_lock, flags);
return entry; return entry;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment