Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1315835 > unrolled thread

[PATCH] QE: Use GFP_ATOMIC while spin_lock_irqsave is held

Started bySaurabh Sengar <saurabh.truth@gmail.com>
First post2016-01-24 08:00 +0100
Last post2016-01-26 02:00 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] QE: Use GFP_ATOMIC while spin_lock_irqsave is held Saurabh Sengar <saurabh.truth@gmail.com> - 2016-01-24 08:00 +0100
    Re: [PATCH] QE: Use GFP_ATOMIC while spin_lock_irqsave is held Scott Wood <oss@buserror.net> - 2016-01-26 02:00 +0100

#1315835 — [PATCH] QE: Use GFP_ATOMIC while spin_lock_irqsave is held

FromSaurabh Sengar <saurabh.truth@gmail.com>
Date2016-01-24 08:00 +0100
Subject[PATCH] QE: Use GFP_ATOMIC while spin_lock_irqsave is held
Message-ID<qUmOu-Wv-3@gated-at.bofh.it>
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

Signed-off-by: Saurabh Sengar <saurabh.truth@gmail.com>
---
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(-)

diff --git a/drivers/soc/fsl/qe/qe_common.c b/drivers/soc/fsl/qe/qe_common.c
index 419fa5b..d774e54 100644
--- a/drivers/soc/fsl/qe/qe_common.c
+++ b/drivers/soc/fsl/qe/qe_common.c
@@ -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;
-- 
1.9.1

[toc] | [next] | [standalone]


#1317436

FromScott Wood <oss@buserror.net>
Date2016-01-26 02:00 +0100
Message-ID<qV09c-3JU-7@gated-at.bofh.it>
In reply to#1315835
On Sun, 2016-01-24 at 12:24 +0530, Saurabh Sengar wrote:
> 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
> 
> Signed-off-by: Saurabh Sengar <saurabh.truth@gmail.com>
> ---
> 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

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web