All of lore.kernel.org
 help / color / mirror / Atom feed
From: Will Deacon <will.deacon-5wv7dgnIgG8@public.gmane.org>
To: Robin Murphy <robin.murphy-5wv7dgnIgG8@public.gmane.org>
Cc: geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org,
	iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Subject: Re: [PATCH] iommu/io-pgtable-armv7s: Fix kmem_cache_alloc() flags
Date: Tue, 1 Mar 2016 18:53:13 +0000	[thread overview]
Message-ID: <20160301185312.GC14022@arm.com> (raw)
In-Reply-To: <cbd13a3db3924a67f8aa8a352f04c883c47d8815.1456856051.git.robin.murphy-5wv7dgnIgG8@public.gmane.org>

On Tue, Mar 01, 2016 at 06:17:38PM +0000, Robin Murphy wrote:
> Whilst the default SLUB allocator happily just merges the original
> allocation flags from kmem_cache_create() with those passed through
> kmem_cache_alloc(), there is a code path in the SLAB allocator which
> will aggressively BUG_ON() if the cache was created with SLAB_CACHE_DMA
> but GFP_DMA is not specified for an allocation.

It would be nice to include the backtrace here.

> Keep the peace by adding GFP_DMA when allocating a table.
> 
> Reported-by: Geert Uytterhoeven <geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org>
> Signed-off-by: Robin Murphy <robin.murphy-5wv7dgnIgG8@public.gmane.org>
> ---
>  drivers/iommu/io-pgtable-arm-v7s.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iommu/io-pgtable-arm-v7s.c b/drivers/iommu/io-pgtable-arm-v7s.c
> index 9fcceb1..9488e3c 100644
> --- a/drivers/iommu/io-pgtable-arm-v7s.c
> +++ b/drivers/iommu/io-pgtable-arm-v7s.c
> @@ -192,7 +192,7 @@ static void *__arm_v7s_alloc_table(int lvl, gfp_t gfp,
>  	if (lvl == 1)
>  		table = (void *)__get_dma_pages(__GFP_ZERO, get_order(size));
>  	else if (lvl == 2)
> -		table = kmem_cache_zalloc(data->l2_tables, gfp);
> +		table = kmem_cache_zalloc(data->l2_tables, gfp | GFP_DMA);
>  	if (table && !selftest_running) {
>  		dma = dma_map_single(dev, table, size, DMA_TO_DEVICE);
>  		if (dma_mapping_error(dev, dma))

Acked-by: Will Deacon <will.deacon-5wv7dgnIgG8@public.gmane.org>

Will

WARNING: multiple messages have this Message-ID (diff)
From: will.deacon@arm.com (Will Deacon)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] iommu/io-pgtable-armv7s: Fix kmem_cache_alloc() flags
Date: Tue, 1 Mar 2016 18:53:13 +0000	[thread overview]
Message-ID: <20160301185312.GC14022@arm.com> (raw)
In-Reply-To: <cbd13a3db3924a67f8aa8a352f04c883c47d8815.1456856051.git.robin.murphy@arm.com>

On Tue, Mar 01, 2016 at 06:17:38PM +0000, Robin Murphy wrote:
> Whilst the default SLUB allocator happily just merges the original
> allocation flags from kmem_cache_create() with those passed through
> kmem_cache_alloc(), there is a code path in the SLAB allocator which
> will aggressively BUG_ON() if the cache was created with SLAB_CACHE_DMA
> but GFP_DMA is not specified for an allocation.

It would be nice to include the backtrace here.

> Keep the peace by adding GFP_DMA when allocating a table.
> 
> Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
> Signed-off-by: Robin Murphy <robin.murphy@arm.com>
> ---
>  drivers/iommu/io-pgtable-arm-v7s.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iommu/io-pgtable-arm-v7s.c b/drivers/iommu/io-pgtable-arm-v7s.c
> index 9fcceb1..9488e3c 100644
> --- a/drivers/iommu/io-pgtable-arm-v7s.c
> +++ b/drivers/iommu/io-pgtable-arm-v7s.c
> @@ -192,7 +192,7 @@ static void *__arm_v7s_alloc_table(int lvl, gfp_t gfp,
>  	if (lvl == 1)
>  		table = (void *)__get_dma_pages(__GFP_ZERO, get_order(size));
>  	else if (lvl == 2)
> -		table = kmem_cache_zalloc(data->l2_tables, gfp);
> +		table = kmem_cache_zalloc(data->l2_tables, gfp | GFP_DMA);
>  	if (table && !selftest_running) {
>  		dma = dma_map_single(dev, table, size, DMA_TO_DEVICE);
>  		if (dma_mapping_error(dev, dma))

Acked-by: Will Deacon <will.deacon@arm.com>

Will

  parent reply	other threads:[~2016-03-01 18:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-01 18:17 [PATCH] iommu/io-pgtable-armv7s: Fix kmem_cache_alloc() flags Robin Murphy
2016-03-01 18:17 ` Robin Murphy
     [not found] ` <cbd13a3db3924a67f8aa8a352f04c883c47d8815.1456856051.git.robin.murphy-5wv7dgnIgG8@public.gmane.org>
2016-03-01 18:53   ` Will Deacon [this message]
2016-03-01 18:53     ` Will Deacon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160301185312.GC14022@arm.com \
    --to=will.deacon-5wv7dgnigg8@public.gmane.org \
    --cc=geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org \
    --cc=iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=robin.murphy-5wv7dgnIgG8@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.