netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pxa: don't ask for a buffer from DMA zone
@ 2011-05-29  8:42 Dmitry Eremin-Solenikov
  2011-05-29 10:24 ` Russell King - ARM Linux
  0 siblings, 1 reply; 3+ messages in thread
From: Dmitry Eremin-Solenikov @ 2011-05-29  8:42 UTC (permalink / raw)
  To: Samuel Ortiz; +Cc: netdev, Eric Miao, linux-arm-kernel

PXA don't have special DMA zone. And since
197b59ae6e8bee56fcef37ea2482dc08414e2ac (mm: fail GFP_DMA allocations
when ZONE_DMA is not configured) allocation with GFP_DMA set will fail
with a trace like this:

------------[ cut here ]------------
WARNING: at mm/page_alloc.c:2251
__alloc_pages_nodemask+0xa0/0x5ac()
Modules linked in:
[<c00385b0>] (unwind_backtrace+0x0/0xf0) from [<c0050b1c>] (warn_slowpath_common+0x4c/0x64)
[<c0050b1c>] (warn_slowpath_common+0x4c/0x64) from [<c0050b4c>] (warn_slowpath_null+0x18/0x1c)
[<c0050b4c>] (warn_slowpath_null+0x18/0x1c) from [<c00908ec>] (__alloc_pages_nodemask+0xa0/0x5ac)
[<c00908ec>] (__alloc_pages_nodemask+0xa0/0x5ac) from [<c0090e74>] (__get_free_pages+0x10/0x3c)
[<c0090e74>] (__get_free_pages+0x10/0x3c) from [<c01d608c>] (pxa_irda_init_iobuf+0x18/0x48)
[<c01d608c>] (pxa_irda_init_iobuf+0x18/0x48) from [<c01d61d8>] (pxa_irda_probe+0x11c/0x32c)
[<c01d61d8>] (pxa_irda_probe+0x11c/0x32c) from [<c019474c>] (platform_drv_probe+0x14/0x18)
[<c019474c>] (platform_drv_probe+0x14/0x18) from [<c0193508>] (really_probe+0xa0/0x158)
[<c0193508>] (really_probe+0xa0/0x158) from [<c019360c>] (driver_probe_device+0x4c/0x64)
[<c019360c>] (driver_probe_device+0x4c/0x64) from [<c0193684>] (__driver_attach+0x60/0x84)
[<c0193684>] (__driver_attach+0x60/0x84) from [<c0192d78>] (bus_for_each_dev+0x48/0x84)
[<c0192d78>] (bus_for_each_dev+0x48/0x84) from [<c01926b8>] (bus_add_driver+0xa8/0x220)
[<c01926b8>] (bus_add_driver+0xa8/0x220) from [<c0193c7c>] (driver_register+0xac/0x13c)
[<c0193c7c>] (driver_register+0xac/0x13c) from [<c0033440>] (do_one_initcall+0x94/0x16c)
[<c0033440>] (do_one_initcall+0x94/0x16c) from [<c00083f4>] (kernel_init+0x94/0x140)
[<c00083f4>] (kernel_init+0x94/0x140) from [<c00348d0>] (kernel_thread_exit+0x0/0x8)
---[ end trace 0b8bf08f70147098 ]---

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
---
 drivers/net/irda/pxaficp_ir.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/irda/pxaficp_ir.c b/drivers/net/irda/pxaficp_ir.c
index 001ed0a..a5ebaef 100644
--- a/drivers/net/irda/pxaficp_ir.c
+++ b/drivers/net/irda/pxaficp_ir.c
@@ -805,7 +805,7 @@ static int pxa_irda_resume(struct platform_device *_dev)
 
 static int pxa_irda_init_iobuf(iobuff_t *io, int size)
 {
-	io->head = kmalloc(size, GFP_KERNEL | GFP_DMA);
+	io->head = kmalloc(size, GFP_KERNEL);
 	if (io->head != NULL) {
 		io->truesize = size;
 		io->in_frame = FALSE;
-- 
1.7.4.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] pxa: don't ask for a buffer from DMA zone
  2011-05-29  8:42 [PATCH] pxa: don't ask for a buffer from DMA zone Dmitry Eremin-Solenikov
@ 2011-05-29 10:24 ` Russell King - ARM Linux
  2011-05-29 10:28   ` Eric Miao
  0 siblings, 1 reply; 3+ messages in thread
From: Russell King - ARM Linux @ 2011-05-29 10:24 UTC (permalink / raw)
  To: Dmitry Eremin-Solenikov; +Cc: Samuel Ortiz, netdev, Eric Miao, linux-arm-kernel

On Sun, May 29, 2011 at 12:42:55PM +0400, Dmitry Eremin-Solenikov wrote:
> PXA don't have special DMA zone. And since
> 197b59ae6e8bee56fcef37ea2482dc08414e2ac (mm: fail GFP_DMA allocations
> when ZONE_DMA is not configured) allocation with GFP_DMA set will fail
> with a trace like this:

These buffers are never used with DMA, its only used with the PIO activity
when in SIR mode.  When in FIR mode, and DMA is being used, we copy it to
a block of memory allocated by dma_coherent_alloc().  So the GFP_DMA
annotation here is redundant.

And that's probably more important to document in the changelog... its not
that PXA doesn't have a special DMA zone, it's that the driver doesn't do
DMA on these buffers so its pointless marking them with GFP_DMA.

>  static int pxa_irda_init_iobuf(iobuff_t *io, int size)
>  {
> -	io->head = kmalloc(size, GFP_KERNEL | GFP_DMA);
> +	io->head = kmalloc(size, GFP_KERNEL);
>  	if (io->head != NULL) {
>  		io->truesize = size;
>  		io->in_frame = FALSE;
> -- 
> 1.7.4.4
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] pxa: don't ask for a buffer from DMA zone
  2011-05-29 10:24 ` Russell King - ARM Linux
@ 2011-05-29 10:28   ` Eric Miao
  0 siblings, 0 replies; 3+ messages in thread
From: Eric Miao @ 2011-05-29 10:28 UTC (permalink / raw)
  To: Russell King - ARM Linux
  Cc: Dmitry Eremin-Solenikov, Samuel Ortiz, netdev, linux-arm-kernel

On Sun, May 29, 2011 at 6:24 PM, Russell King - ARM Linux
<linux@arm.linux.org.uk> wrote:
> On Sun, May 29, 2011 at 12:42:55PM +0400, Dmitry Eremin-Solenikov wrote:
>> PXA don't have special DMA zone. And since
>> 197b59ae6e8bee56fcef37ea2482dc08414e2ac (mm: fail GFP_DMA allocations
>> when ZONE_DMA is not configured) allocation with GFP_DMA set will fail
>> with a trace like this:
>
> These buffers are never used with DMA, its only used with the PIO activity
> when in SIR mode.  When in FIR mode, and DMA is being used, we copy it to
> a block of memory allocated by dma_coherent_alloc().  So the GFP_DMA
> annotation here is redundant.
>
> And that's probably more important to document in the changelog... its not
> that PXA doesn't have a special DMA zone, it's that the driver doesn't do
> DMA on these buffers so its pointless marking them with GFP_DMA.
>

Not really sure about the whole story, but further speaking, for
architectures like
PXA and most other ARM SoCs, where DMA can happen anywhere, does this
mean we don't even need to put GFP_DMA flag when doing memory allocation?


>>  static int pxa_irda_init_iobuf(iobuff_t *io, int size)
>>  {
>> -     io->head = kmalloc(size, GFP_KERNEL | GFP_DMA);
>> +     io->head = kmalloc(size, GFP_KERNEL);
>>       if (io->head != NULL) {
>>               io->truesize = size;
>>               io->in_frame = FALSE;
>> --
>> 1.7.4.4
>>
>>
>> _______________________________________________
>> linux-arm-kernel mailing list
>> linux-arm-kernel@lists.infradead.org
>> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-05-29 10:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-29  8:42 [PATCH] pxa: don't ask for a buffer from DMA zone Dmitry Eremin-Solenikov
2011-05-29 10:24 ` Russell King - ARM Linux
2011-05-29 10:28   ` Eric Miao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).