diff mbox

[2/3] ARM: DMA-Mapping: print warning when atomic coherent allocation fails

Message ID 1345459648-24263-3-git-send-email-m.szyprowski@samsung.com
State New
Headers show

Commit Message

Marek Szyprowski Aug. 20, 2012, 10:47 a.m. UTC
Print a loud warning when system runs out of memory from atomic coherent
pool to let users notice the potential problem.

Reported-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
---
 arch/arm/mm/dma-mapping.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

Comments

Aaro Koskinen Aug. 20, 2012, 11:01 p.m. UTC | #1
Hi,

On Mon, Aug 20, 2012 at 12:47:27PM +0200, Marek Szyprowski wrote:
> @@ -461,6 +461,9 @@ static void *__alloc_from_pool(size_t size, struct page **ret_page)
>  		bitmap_set(pool->bitmap, pageno, count);
>  		ptr = pool->vaddr + PAGE_SIZE * pageno;
>  		*ret_page = pool->page + pageno;
> +	} else {
> +		pr_err("Atomic coherent pool too small!\n"
> +		       "Please increase it with coherent_pool= kernel parameter!\n");

This should be rate limited, perhaps even printed only once.

A.
Marek Szyprowski Aug. 21, 2012, 10:14 a.m. UTC | #2
Hello,

On Tuesday, August 21, 2012 1:01 AM Aaro Koskinen wrote:

> On Mon, Aug 20, 2012 at 12:47:27PM +0200, Marek Szyprowski wrote:
> > @@ -461,6 +461,9 @@ static void *__alloc_from_pool(size_t size, struct page **ret_page)
> >  		bitmap_set(pool->bitmap, pageno, count);
> >  		ptr = pool->vaddr + PAGE_SIZE * pageno;
> >  		*ret_page = pool->page + pageno;
> > +	} else {
> > +		pr_err("Atomic coherent pool too small!\n"
> > +		       "Please increase it with coherent_pool= kernel parameter!\n");
> 
> This should be rate limited, perhaps even printed only once.

Ok, I will change it to pr_err_once().

Best regards
Hiroshi Doyu Aug. 22, 2012, 5:30 a.m. UTC | #3
On Mon, 20 Aug 2012 12:47:27 +0200
Marek Szyprowski <m.szyprowski@samsung.com> wrote:

> Print a loud warning when system runs out of memory from atomic coherent
> pool to let users notice the potential problem.
> 
> Reported-by: Aaro Koskinen <aaro.koskinen@iki.fi>
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> ---
>  arch/arm/mm/dma-mapping.c |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
> index d1cc9c1..25963ea 100644
> --- a/arch/arm/mm/dma-mapping.c
> +++ b/arch/arm/mm/dma-mapping.c
> @@ -461,6 +461,9 @@ static void *__alloc_from_pool(size_t size, struct page **ret_page)
>  		bitmap_set(pool->bitmap, pageno, count);
>  		ptr = pool->vaddr + PAGE_SIZE * pageno;
>  		*ret_page = pool->page + pageno;
> +	} else {
> +		pr_err("Atomic coherent pool too small!\n"
> +		       "Please increase it with  kernel parameter!\n");

It might be a little bit nicer if the current pool size is printed in
the above too. That could be the hint for how much to specify in
"coherent_pool=".
diff mbox

Patch

diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index d1cc9c1..25963ea 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -461,6 +461,9 @@  static void *__alloc_from_pool(size_t size, struct page **ret_page)
 		bitmap_set(pool->bitmap, pageno, count);
 		ptr = pool->vaddr + PAGE_SIZE * pageno;
 		*ret_page = pool->page + pageno;
+	} else {
+		pr_err("Atomic coherent pool too small!\n"
+		       "Please increase it with coherent_pool= kernel parameter!\n");
 	}
 	spin_unlock_irqrestore(&pool->lock, flags);