All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joel Fernandes <joelf@ti.com>
To: "linux-omap@vger.kernel.org" <linux-omap@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>
Cc: Russell King - ARM Linux <linux@arm.linux.org.uk>
Subject: dma_unmap causing issues with __get_free_pages
Date: Thu, 15 Aug 2013 02:35:59 -0500	[thread overview]
Message-ID: <520C84DF.5050707@ti.com> (raw)

Hi,

I'm having some trouble with using the dma_map/unmap API.

On unmapping a particular page using dma_unmap, it seems that the
PG_dcache_clean flag is set in the page->flags. This is set by the
following statement in __dma_page_dev_to_cpu function in
arch/arm/mm/dma-mapping.c
                set_bit(PG_dcache_clean, &page->flags);

Due to this, on any subsequent page allocations using __get_free_pages,
the following BUG gets triggered.

[   15.267913] BUG: Bad page state in process insmod  pfn:acb26
[   15.274017] page:c151e4c0 count:0 mapcount:0 mapping:  (null) index:0x0
[   15.281097] page flags: 0x200(arch_1)
[   15.285003] Modules linked in: tcrypt(+)
[   15.289062] CPU: 0 PID: 1616 Comm: insmod Tainted: G    B
3.10.0-00038-gbafd29d-dirty #89
[   15.298706] [<c001c720>] (unwind_backtrace+0x0/0xfc) from
[<c0018794>] (show_stack+0x20/0x24)
[   15.307861] [<c0018794>] (show_stack+0x20/0x24) from [<c05a7284>]
(dump_stack+0x20/0x28)
[   15.316497] [<c05a7284>] (dump_stack+0x20/0x28) from [<c00fa220>]
(bad_page+0xbc/0x11c)
[   15.325195] [<c00fa220>] (bad_page+0xbc/0x11c) from [<c00fa8c8>]
(get_page_from_freelist+0x4dc/0x620)
[   15.335083] [<c00fa8c8>] (get_page_from_freelist+0x4dc/0x620) from
[<c00fb57c>] (__alloc_pages_nodemask+0x114/0x8b4)
[   15.346343] [<c00fb57c>] (__alloc_pages_nodemask+0x114/0x8b4) from
[<c00fbd3c>] (__get_free_pages+0x20/0x3c)
[   15.356872] [<c00fbd3c>] (__get_free_pages+0x20/0x3c) from
[<c0486bd0>] (omap_aes_copy_sgs+0x48/0x1bc)


If I don't do the unmap and leave the page alone, everything works just
fine.

What is correct way to fix this? Why does the page allocator think its a
BAD page descriptor after the unmap?

Thanks,

-Joel

WARNING: multiple messages have this Message-ID (diff)
From: joelf@ti.com (Joel Fernandes)
To: linux-arm-kernel@lists.infradead.org
Subject: dma_unmap causing issues with __get_free_pages
Date: Thu, 15 Aug 2013 02:35:59 -0500	[thread overview]
Message-ID: <520C84DF.5050707@ti.com> (raw)

Hi,

I'm having some trouble with using the dma_map/unmap API.

On unmapping a particular page using dma_unmap, it seems that the
PG_dcache_clean flag is set in the page->flags. This is set by the
following statement in __dma_page_dev_to_cpu function in
arch/arm/mm/dma-mapping.c
                set_bit(PG_dcache_clean, &page->flags);

Due to this, on any subsequent page allocations using __get_free_pages,
the following BUG gets triggered.

[   15.267913] BUG: Bad page state in process insmod  pfn:acb26
[   15.274017] page:c151e4c0 count:0 mapcount:0 mapping:  (null) index:0x0
[   15.281097] page flags: 0x200(arch_1)
[   15.285003] Modules linked in: tcrypt(+)
[   15.289062] CPU: 0 PID: 1616 Comm: insmod Tainted: G    B
3.10.0-00038-gbafd29d-dirty #89
[   15.298706] [<c001c720>] (unwind_backtrace+0x0/0xfc) from
[<c0018794>] (show_stack+0x20/0x24)
[   15.307861] [<c0018794>] (show_stack+0x20/0x24) from [<c05a7284>]
(dump_stack+0x20/0x28)
[   15.316497] [<c05a7284>] (dump_stack+0x20/0x28) from [<c00fa220>]
(bad_page+0xbc/0x11c)
[   15.325195] [<c00fa220>] (bad_page+0xbc/0x11c) from [<c00fa8c8>]
(get_page_from_freelist+0x4dc/0x620)
[   15.335083] [<c00fa8c8>] (get_page_from_freelist+0x4dc/0x620) from
[<c00fb57c>] (__alloc_pages_nodemask+0x114/0x8b4)
[   15.346343] [<c00fb57c>] (__alloc_pages_nodemask+0x114/0x8b4) from
[<c00fbd3c>] (__get_free_pages+0x20/0x3c)
[   15.356872] [<c00fbd3c>] (__get_free_pages+0x20/0x3c) from
[<c0486bd0>] (omap_aes_copy_sgs+0x48/0x1bc)


If I don't do the unmap and leave the page alone, everything works just
fine.

What is correct way to fix this? Why does the page allocator think its a
BAD page descriptor after the unmap?

Thanks,

-Joel

             reply	other threads:[~2013-08-15  7:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-15  7:35 Joel Fernandes [this message]
2013-08-15  7:35 ` dma_unmap causing issues with __get_free_pages Joel Fernandes
2013-08-15 11:55 ` Russell King - ARM Linux
2013-08-15 11:55   ` Russell King - ARM Linux
2013-08-15 15:43   ` Joel Fernandes
2013-08-15 15:43     ` Joel Fernandes

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=520C84DF.5050707@ti.com \
    --to=joelf@ti.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    /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.