* [PATCH] drivers: base: dma-mapping: page align the size when unmap_kernel_range
@ 2016-07-21 8:04 Peng Fan
2016-08-08 4:29 ` Peng Fan
0 siblings, 1 reply; 3+ messages in thread
From: Peng Fan @ 2016-07-21 8:04 UTC (permalink / raw)
To: gregkh; +Cc: linux-kernel, van.freenix, stable
When dma_common_free_remap, the input parameter 'size' may not
be page aligned. And, met kernel warning when doing iommu dma
for usb on i.MX8 platform:
"
WARNING: CPU: 0 PID: 869 at mm/vmalloc.c:70 vunmap_page_range+0x1cc/0x1d0()
Modules linked in:
CPU: 0 PID: 869 Comm: kworker/u8:2 Not tainted 4.1.12-00444-gc5f9d1d-dirty #147
Hardware name: Freescale i.MX8DV Sabreauto (DT)
Workqueue: ci_otg ci_otg_work
Call trace:
[<ffffffc000089920>] dump_backtrace+0x0/0x124
[<ffffffc000089a54>] show_stack+0x10/0x1c
[<ffffffc0006d1e6c>] dump_stack+0x84/0xc8
[<ffffffc0000b4568>] warn_slowpath_common+0x98/0xd0
[<ffffffc0000b4664>] warn_slowpath_null+0x14/0x20
[<ffffffc000170348>] vunmap_page_range+0x1c8/0x1d0
[<ffffffc000170388>] unmap_kernel_range+0x20/0x88
[<ffffffc000460ad0>] dma_common_free_remap+0x74/0x84
[<ffffffc0000940d8>] __iommu_free_attrs+0x9c/0x178
[<ffffffc0005032bc>] ehci_mem_cleanup+0x140/0x194
[<ffffffc000503548>] ehci_stop+0x8c/0xdc
[<ffffffc0004e8258>] usb_remove_hcd+0xf0/0x1cc
[<ffffffc000516bc0>] host_stop+0x1c/0x58
[<ffffffc000514240>] ci_otg_work+0xdc/0x120
[<ffffffc0000c9c34>] process_one_work+0x134/0x33c
[<ffffffc0000c9f78>] worker_thread+0x13c/0x47c
[<ffffffc0000cf43c>] kthread+0xd8/0xf0
"
For dma_common_pages_remap:
dma_common_pages_remap
|->get_vm_area_caller
|->__get_vm_area_node
|->size = PAGE_ALIGN(size); Round up to page aligned
So, in dma_common_free_remap, we also need a page aligned size,
pass 'PAGE_ALIGN(size)' to unmap_kernel_range.
Signed-off-by: Peng Fan <van.freenix@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: <stable@vger.kernel.org>
---
drivers/base/dma-mapping.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/base/dma-mapping.c b/drivers/base/dma-mapping.c
index d799662..261420d 100644
--- a/drivers/base/dma-mapping.c
+++ b/drivers/base/dma-mapping.c
@@ -334,7 +334,7 @@ void dma_common_free_remap(void *cpu_addr, size_t size, unsigned long vm_flags)
return;
}
- unmap_kernel_range((unsigned long)cpu_addr, size);
+ unmap_kernel_range((unsigned long)cpu_addr, PAGE_ALIGN(size));
vunmap(cpu_addr);
}
#endif
--
2.6.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] drivers: base: dma-mapping: page align the size when unmap_kernel_range
2016-07-21 8:04 [PATCH] drivers: base: dma-mapping: page align the size when unmap_kernel_range Peng Fan
@ 2016-08-08 4:29 ` Peng Fan
2016-08-08 5:14 ` Greg KH
0 siblings, 1 reply; 3+ messages in thread
From: Peng Fan @ 2016-08-08 4:29 UTC (permalink / raw)
To: gregkh; +Cc: linux-kernel, stable
Hi,
Kindly ping.. since more than two weeks from patch sent out.
Thanks,
Peng.
On Thu, Jul 21, 2016 at 04:04:21PM +0800, Peng Fan wrote:
>When dma_common_free_remap, the input parameter 'size' may not
>be page aligned. And, met kernel warning when doing iommu dma
>for usb on i.MX8 platform:
>"
>WARNING: CPU: 0 PID: 869 at mm/vmalloc.c:70 vunmap_page_range+0x1cc/0x1d0()
>Modules linked in:
>CPU: 0 PID: 869 Comm: kworker/u8:2 Not tainted 4.1.12-00444-gc5f9d1d-dirty #147
>Hardware name: Freescale i.MX8DV Sabreauto (DT)
>Workqueue: ci_otg ci_otg_work
>Call trace:
>[<ffffffc000089920>] dump_backtrace+0x0/0x124
>[<ffffffc000089a54>] show_stack+0x10/0x1c
>[<ffffffc0006d1e6c>] dump_stack+0x84/0xc8
>[<ffffffc0000b4568>] warn_slowpath_common+0x98/0xd0
>[<ffffffc0000b4664>] warn_slowpath_null+0x14/0x20
>[<ffffffc000170348>] vunmap_page_range+0x1c8/0x1d0
>[<ffffffc000170388>] unmap_kernel_range+0x20/0x88
>[<ffffffc000460ad0>] dma_common_free_remap+0x74/0x84
>[<ffffffc0000940d8>] __iommu_free_attrs+0x9c/0x178
>[<ffffffc0005032bc>] ehci_mem_cleanup+0x140/0x194
>[<ffffffc000503548>] ehci_stop+0x8c/0xdc
>[<ffffffc0004e8258>] usb_remove_hcd+0xf0/0x1cc
>[<ffffffc000516bc0>] host_stop+0x1c/0x58
>[<ffffffc000514240>] ci_otg_work+0xdc/0x120
>[<ffffffc0000c9c34>] process_one_work+0x134/0x33c
>[<ffffffc0000c9f78>] worker_thread+0x13c/0x47c
>[<ffffffc0000cf43c>] kthread+0xd8/0xf0
>"
>
>For dma_common_pages_remap:
>dma_common_pages_remap
> |->get_vm_area_caller
> |->__get_vm_area_node
> |->size = PAGE_ALIGN(size); Round up to page aligned
>
>So, in dma_common_free_remap, we also need a page aligned size,
>pass 'PAGE_ALIGN(size)' to unmap_kernel_range.
>
>Signed-off-by: Peng Fan <van.freenix@gmail.com>
>Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
>Cc: <stable@vger.kernel.org>
>---
> drivers/base/dma-mapping.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/drivers/base/dma-mapping.c b/drivers/base/dma-mapping.c
>index d799662..261420d 100644
>--- a/drivers/base/dma-mapping.c
>+++ b/drivers/base/dma-mapping.c
>@@ -334,7 +334,7 @@ void dma_common_free_remap(void *cpu_addr, size_t size, unsigned long vm_flags)
> return;
> }
>
>- unmap_kernel_range((unsigned long)cpu_addr, size);
>+ unmap_kernel_range((unsigned long)cpu_addr, PAGE_ALIGN(size));
> vunmap(cpu_addr);
> }
> #endif
>--
>2.6.2
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] drivers: base: dma-mapping: page align the size when unmap_kernel_range
2016-08-08 4:29 ` Peng Fan
@ 2016-08-08 5:14 ` Greg KH
0 siblings, 0 replies; 3+ messages in thread
From: Greg KH @ 2016-08-08 5:14 UTC (permalink / raw)
To: Peng Fan; +Cc: linux-kernel, stable
On Mon, Aug 08, 2016 at 12:29:08PM +0800, Peng Fan wrote:
> Hi,
>
> Kindly ping.. since more than two weeks from patch sent out.
It's the merge window, we can't take new patches during then. Relax, it
will be handled when I catch up...
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-08-08 5:13 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-21 8:04 [PATCH] drivers: base: dma-mapping: page align the size when unmap_kernel_range Peng Fan
2016-08-08 4:29 ` Peng Fan
2016-08-08 5:14 ` Greg KH
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).