Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1552489 > unrolled thread
| Started by | Leo Yan <leo.yan@linaro.org> |
|---|---|
| First post | 2017-01-06 04:10 +0100 |
| Last post | 2017-01-07 10:50 +0100 |
| Articles | 3 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH] usb: dwc2: fix panic for coherent memory allocation Leo Yan <leo.yan@linaro.org> - 2017-01-06 04:10 +0100
Re: [PATCH] usb: dwc2: fix panic for coherent memory allocation John Stultz <john.stultz@linaro.org> - 2017-01-06 22:40 +0100
Re: [PATCH] usb: dwc2: fix panic for coherent memory allocation Leo Yan <leo.yan@linaro.org> - 2017-01-07 10:50 +0100
| From | Leo Yan <leo.yan@linaro.org> |
|---|---|
| Date | 2017-01-06 04:10 +0100 |
| Subject | [PATCH] usb: dwc2: fix panic for coherent memory allocation |
| Message-ID | <sWt4K-3N8-31@gated-at.bofh.it> |
When use configfs to configure USB port as as ethernet gadget, the
kernel has panic with below backtrace; it clearly indicates the
coherent memory allocation is happened in the interrupt context,
but the function __get_vm_area_node() is possible to be scheduling
out so function __get_vm_area_node() triggers panic if it's called
from interrupt context.
To fix this issue, simply to change gfp_flag from GFP_KERNEL to
GFP_NOWAIT so it can support to allocate coherent memory from
interrupt context.
[ 8.036567] ------------[ cut here ]------------
[ 8.041188] kernel BUG at mm/vmalloc.c:1344!
[ 8.045462] Internal error: Oops - BUG: 0 [#1] PREEMPT SMP
[ 8.050950] Modules linked in:
[ 8.054007] CPU: 0 PID: 0 Comm: swapper/0 Tainted: G W 4.10.0-rc2-00201-ged40875 #645
[ 8.062978] Hardware name: HiKey Development Board (DT)
[ 8.068206] task: ffff000008dc2900 task.stack: ffff000008db0000
[ 8.176374] Process swapper/0 (pid: 0, stack limit = 0xffff000008db0000)
[ 8.183080] Stack: (0xffff80003df19a80 to 0xffff000008db4000)
[ 8.188829] Call trace:
[ 8.191276] Exception stack(0xffff80003df198b0 to 0xffff80003df199e0)
[ 8.197722] 98a0: 000000000002d048 0001000000000000
[ 8.205564] 98c0: ffff80003df19a80 ffff0000081aca98 00000000000001c0 0000000000000004
[ 8.213407] 98e0: ffff7e0000b48000 0000000000000009 ffff000008e93000 ffff7e0000b41200
[ 8.221250] 9900: ffff80003df19950 ffff000008174e40 0000000000000000 ffff000008e93000
[ 8.229093] 9920: ffff000008e92b00 ffff000008e92000 ffff000008c37000 ffff000008e92b00
[ 8.236935] 9940: 00000000000001c0 0000000000000004 0000000000001000 0000000000010002
[ 8.244777] 9960: 0000000000000008 ffff000008000000 ffff7dffbfff0000 00000000024000c0
[ 8.252619] 9980: 0000000000000000 0000000000000001 ffff7e0000000000 000000000002d048
[ 8.260462] 99a0: fffffffffffffe00 0000000000000001 0000000000000068 dead000000000200
[ 8.268305] 99c0: dead000000000100 00000000000001c4 fffffffffffffffe 0000000000000000
[ 8.276148] [<ffff0000081aca98>] __get_vm_area_node.isra.37+0x180/0x184
[ 8.282769] [<ffff0000081acbc8>] get_vm_area_caller+0x34/0x3c
[ 8.288522] [<ffff000008536c4c>] dma_common_pages_remap+0x28/0x70
[ 8.294621] [<ffff000008536d60>] dma_common_contiguous_remap+0xcc/0xf0
[ 8.301154] [<ffff000008097308>] __dma_alloc+0x10c/0x228
[ 8.306471] [<ffff00000869f6e0>] dwc2_hsotg_ep_enable+0x360/0x4c8
[ 8.312571] [<ffff0000086e17a8>] usb_ep_enable+0x3c/0x5c
[ 8.317888] [<ffff0000086e33e4>] ecm_set_alt+0xac/0x164
[ 8.323117] [<ffff0000086dcbb8>] composite_setup+0xbac/0x140c
[ 8.328868] [<ffff0000086a02c4>] dwc2_hsotg_complete_setup+0xb8/0x368
[ 8.335315] [<ffff0000086e0600>] usb_gadget_giveback_request+0x10/0x18
[ 8.341849] [<ffff00000869f00c>] dwc2_hsotg_complete_request+0x7c/0x130
[ 8.348470] [<ffff00000869ffe4>] dwc2_hsotg_handle_outdone+0xfc/0x1e0
[ 8.354917] [<ffff0000086a1500>] dwc2_hsotg_epint+0x638/0x844
[ 8.360667] [<ffff0000086a1e54>] dwc2_hsotg_irq+0x374/0x6f4
[ 8.366246] [<ffff000008109424>] __handle_irq_event_percpu+0xa0/0x128
[ 8.372693] [<ffff0000081094c8>] handle_irq_event_percpu+0x1c/0x54
[ 8.378879] [<ffff000008109544>] handle_irq_event+0x44/0x74
[ 8.384456] [<ffff00000810cbf4>] handle_fasteoi_irq+0xb4/0x184
[ 8.390294] [<ffff000008108548>] generic_handle_irq+0x24/0x38
[ 8.396045] [<ffff000008108bb8>] __handle_domain_irq+0x60/0xac
[ 8.401883] [<ffff00000808161c>] gic_handle_irq+0x54/0xa0
Signed-off-by: Leo Yan <leo.yan@linaro.org>
---
drivers/usb/dwc2/gadget.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index b95930f..302b60c 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -3753,7 +3753,7 @@ static int dwc2_hsotg_ep_enable(struct usb_ep *ep,
hs_ep->desc_list = dma_alloc_coherent(hsotg->dev,
MAX_DMA_DESC_NUM_GENERIC *
sizeof(struct dwc2_dma_desc),
- &hs_ep->desc_list_dma, GFP_KERNEL);
+ &hs_ep->desc_list_dma, GFP_NOWAIT);
if (!hs_ep->desc_list) {
ret = -ENOMEM;
goto error2;
--
2.7.4
[toc] | [next] | [standalone]
| From | John Stultz <john.stultz@linaro.org> |
|---|---|
| Date | 2017-01-06 22:40 +0100 |
| Message-ID | <sWKoV-7NO-5@gated-at.bofh.it> |
| In reply to | #1552489 |
On Thu, Jan 5, 2017 at 6:50 PM, Leo Yan <leo.yan@linaro.org> wrote:
> When use configfs to configure USB port as as ethernet gadget, the
> kernel has panic with below backtrace; it clearly indicates the
> coherent memory allocation is happened in the interrupt context,
> but the function __get_vm_area_node() is possible to be scheduling
> out so function __get_vm_area_node() triggers panic if it's called
> from interrupt context.
>
> To fix this issue, simply to change gfp_flag from GFP_KERNEL to
> GFP_NOWAIT so it can support to allocate coherent memory from
> interrupt context.
This looks like it duplicates the similar patch I'm told should be
queued for 4.10-rc3:
https://lkml.org/lkml/2016/12/1/120
thanks
-john
[toc] | [prev] | [next] | [standalone]
| From | Leo Yan <leo.yan@linaro.org> |
|---|---|
| Date | 2017-01-07 10:50 +0100 |
| Message-ID | <sWVNn-6Te-17@gated-at.bofh.it> |
| In reply to | #1553147 |
On Fri, Jan 06, 2017 at 01:36:11PM -0800, John Stultz wrote: > On Thu, Jan 5, 2017 at 6:50 PM, Leo Yan <leo.yan@linaro.org> wrote: > > When use configfs to configure USB port as as ethernet gadget, the > > kernel has panic with below backtrace; it clearly indicates the > > coherent memory allocation is happened in the interrupt context, > > but the function __get_vm_area_node() is possible to be scheduling > > out so function __get_vm_area_node() triggers panic if it's called > > from interrupt context. > > > > To fix this issue, simply to change gfp_flag from GFP_KERNEL to > > GFP_NOWAIT so it can support to allocate coherent memory from > > interrupt context. > > This looks like it duplicates the similar patch I'm told should be > queued for 4.10-rc3: > https://lkml.org/lkml/2016/12/1/120 Yeah, this patch is duplicate. Please ignore this one. Thanks, Leo Yan
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web