Skip to contentSkip to conversation

QE: Use GFP_ATOMIC while spin_lock_irqsave is held

PATCH In review Saurabh Sengar 2 participants 2 messages Jan 24, 2016 – Jan 26, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 QE: Use GFP_ATOMIC while spin_lock_irqsave is held

cpm_muram_alloc_common is called twice and both the times spin_lock_irqsave is held.
Using GFP_KERNEL can sleep in spin_lock_irqsave context and cause deadlock

---
Let me know if there is any other way to fix it.
Also, I would say this function should be static as it is not used in any other file

 drivers/soc/fsl/qe/qe_common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soc/fsl/qe/qe_common.c +1 -1
index 419fa5b..d774e54 100644
@@ -194,7 +194,7 @@ unsigned long cpm_muram_alloc_common(unsigned long size, genpool_algo_t algo,
 		goto out2;
 	start = start - GENPOOL_OFFSET;
 	memset_io(cpm_muram_addr(start), 0, size);
-	entry = kmalloc(sizeof(*entry), GFP_KERNEL);
+	entry = kmalloc(sizeof(*entry), GFP_ATOMIC);
 	if (!entry)
 		goto out1;
 	entry->start = start;
Signature · 1 line
1.9.1
#1 lore raw
Quoted 5 lines · Saurabh Sengar

cpm_muram_alloc_common is called twice and both the times spin_lock_irqsave is held.
Using GFP_KERNEL can sleep in spin_lock_irqsave context and cause deadlock

Quoted 7 lines

---
Let me know if there is any other way to fix it.
Also, I would say this function should be static as it is not used in any other file

 drivers/soc/fsl/qe/qe_common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Yes, it should be static. Do you plan to send a patch for that?

-Scott