Hi,
I have the following setup:
DSP (read sensors and read/send MIDI) <- UART -> SOC (imx6) <- USB
MIDI GADGET -> HOST
When the throughput from the DSP is high, thus causing the throughput
on the USB to be high as well, I get a Kernel Panic saying to increase
the coherent_pool. I've used some crazy sizes like 1M, 4M and even 8M.
Obviously when I increase, it takes longer to crash but it still
crashes.
I am using linux-fsl 3.14.28.
The BT as follows:
[ 193.619701] ERROR: 1024 KiB atomic DMA coherent pool is too small!
[ 193.619701] Please increase it with coherent_pool= kernel parameter!
[ 193.632261] Unable to handle kernel NULL pointer dereference at
virtual address 00000000
[ 193.640358] pgd = 80004000
[ 193.643070] [00000000] *pgd=00000000
[ 193.646670] Internal error: Oops: 817 [#1] PREEMPT SMP ARM
[ 193.652162] Modules linked in:0d 0 :s0n2d:_5s2e.q2_2m1i
snd_seq_midi_event snd_seq_dummy snd_seq snd_soc_cs4272
snd_soc_fsl_ssi imx_pcm_dma imx_pcm_fiq snd_soc_imx_cs4272
snd_soc_core snd_compress snd_pcm_dmaengine snd_pcm snd_te
[ 193.689447] CPU: 2 PID: 16 Comm: ksoftirqd/2 Not tainted
3.14.28-1.0.0_ga+g91cf351 #1
[ 193.697285] task: ea0a5100 ti: ea0d8000 task.ti: ea0d8000
[ 193.702708] PC is at _ep_queue.isra.24+0x178/0x480
[ 193.707508] LR is at 0xc43cee80
[ 193.710657] pc : [<8039ea38>] lr : [<c43cee80>] psr: 600f0093
[ 193.710657] sp : ea0d9de0 ip : 6e0ea000 fp : ea0d9e1c
[ 193.722139] r10: 00005000 r9 : ea03c010 r8 : c43d05b4
[ 193.727369] r7 : 00000000 r6 : 00000004 r5 : ea03c6f4 r4 : c43d0580
[ 193.733899] r3 : c43d05bc r2 : 00000000 r1 : 00000001 r0 : fffffff4
[ 193.740433] Flags: nZCv IRQs off FIQs on Mode SVC_32 ISA ARM
Segment kernel
[ 193.747834] Control: 10c5387d Table: 7aca804a DAC: 00000015
[ 193.753585] Process ksoftirqd/2 (pid: 16, stack limit = 0xea0d8238)
[ 193.759857] Stack: (0xea0d9de0 to 0xea0da000)
[ 193.764225] 9de0: 00000001 eaa72480 a00f0013 c43d05bc ea0d9e24
00000003 ea03c6f4 a00f0013
[ 193.772413] 9e00: c43d0580 ea51a200 ea51a328 ea51a328 ea0d9e3c
ea0d9e20 8039fc30 8039e8cc
[ 193.780598] 9e20: 00000000 00000000 c4467000 c43d0580 ea0d9e7c
ea0d9e40 7f078754 8039fbe8
[ 193.788784] 9e40: ea03c6f4 ea51a2ec 80009990 6f000000 ea0d9e84
ea51a330 ea51a334 00000000
[ 193.796968] 9e60: 80718f40 00000000 ea0d8000 806d82bc ea0d9e8c
ea0d9e80 7f0787a0 7f07832c
[ 193.805153] 9e80: ea0d9ebc ea0d9e90 80031fe4 7f078798 80031f60
00000000 00000000 806dc080
[ 193.826207] 9ec0: ffffffff ea0d9f0c 04208040 806dc0c0 ffffd672
80507358 0000000a 80718f40
[ 193.834392] 9ee0: ea0d8000 806d8458 806dc080 00000002 80053c8c
ea0d8000 ea0870c0 806e9cc8
[ 193.842576] 9f00: 00000001 00000000 00000000 00000000 ea0d9f34
ea0d9f20 80032490 800321f0
[ 193.868396] 9f40: ea087140 ea0870c0 800512e0 00000000 ea0d9fac
ea0d9f60 8004a458 800512ec
[ 193.876582] 9f60: 30b80088 00000001 00000002 ea0870c0 00000000
00030003 ea0d9f78 ea0d9f78
[ 193.884766] 9f80: 00000000 00000000 ea0d9f88 ea0d9f88 ea087140
8004a384 00000000 00000000
[ 193.892952] 9fa0: 00000000 ea0d9fb0 8000ea58 8004a390 00000000
00000000 00000000 00000000
[ 193.901137] 9fc0: 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000
[ 193.909322] 9fe0: 00000000 00000000 00000000 00000000 00000013
00000000 2001a1a0 61391094
[ 193.917501] Backtrace:
[ 193.919982] [<8039e8c0>] (_ep_queue.isra.24) from [<8039fc30>]
(ep_queue+0x54/0x88)
[ 193.927643] r10:ea51a328 r9:ea51a328 r8:ea51a200 r7:c43d0580
r6:a00f0013 r5:ea03c6f4
[ 193.935554] r4:00000003
[ 193.938120] [<8039fbdc>] (ep_queue) from [<7f078754>]
(f_midi_transmit+0x434/0x46c [g_midi])
[ 193.946562] r7:c43d0580 r6:c4467000 r5:00000000 r4:00000000
[ 193.952299] [<7f078320>] (f_midi_transmit [g_midi]) from
[<7f0787a0>] (f_midi_in_tasklet+0x14/0x18 [g_midi])
[ 193.962129] r10:806d82bc r9:ea0d8000 r8:00000000 r7:80718f40
r6:00000000 r5:ea51a334
[ 193.970039] r4:ea51a330
[ 193.972609] [<7f07878c>] (f_midi_in_tasklet [g_midi]) from
[<80031fe4>] (tasklet_hi_action+0x84/0x114)
[ 193.981928] [<80031f60>] (tasklet_hi_action) from [<8003232c>]
(__do_softirq+0x148/0x260)
[ 193.990107] r10:40000000 r9:806dc080 r8:00000100 r7:ea0d8000
r6:806dc080 r5:00000000
[ 193.998018] r4:00000000 r3:80031f60
[ 194.001635] [<800321e4>] (__do_softirq) from [<80032490>]
(run_ksoftirqd+0x4c/0x64)
[ 194.009294] r10:00000000 r9:00000000 r8:00000000 r7:00000001
r6:806e9cc8 r5:ea0870c0
[ 194.017203] r4:ea0d8000
[ 194.019773] [<80032444>] (run_ksoftirqd) from [<80051468>]
(smpboot_thread_fn+0x188/
0x278)
[ 194.028059] [<800512e0>] (smpboot_thread_fn) from [<8004a458>]
(kthread+0xd4/0xec)
[ 194.035632] r8:00000000 r7:800512e0 r6:ea0870c0 r5:ea087140
r4:00000000 r3:ea0a5100
[ 194.043468] [<8004a384>] (kthread) from [<8000ea58>]
(ret_from_fork+0x14/0x3c)
[ 194.050695] r7:00000000 r6:00000000 r5:8004a384 r4:ea087140
[ 194.056426] Code: e3a01001 e594203c e50b2030 e593200c (e5821000)
[ 194.062529] ---[ end trace d9e83b0561ba691e ]---
[ 194.067153] Kernel panic - not syncing: Fatal exception in interrupt
When I debug, I can see those symbols:
(gdb) list *(ep_queue)
0x803a3b00 is in ep_queue
(/home/felipe/freescale/linux-2.6-imx/drivers/usb/chipidea/udc.c:1339).
1334 *
1335 * Check usb_ep_queue()* at usb_gadget.h" for details
1336 */
1337 static int ep_queue(struct usb_ep *ep, struct usb_request *req,
1338 gfp_t __maybe_unused gfp_flags)
1339 {
1340 struct ci_hw_ep *hwep = container_of(ep, struct
ci_hw_ep, ep);
1341 int retval = 0;
1342 unsigned long flags;
1343
(gdb) list *(ep_queue+0x54)
0x803a3b54 is in ep_queue
(/home/felipe/freescale/linux-2.6-imx/include/linux/spinlock.h:358).
353 raw_spin_unlock_irq(&lock->rlock);
354 }
355
356 static inline void spin_unlock_irqrestore(spinlock_t *lock,
unsigned long flags)
357 {
358 raw_spin_unlock_irqrestore(&lock->rlock, flags);
359 }
360
361 static inline int spin_trylock_bh(spinlock_t *lock)
362 {
Any help will be very useful.
Thanks,
Felipe
Based on the conversation on linux-usb. The IRQ is not been fired after a usb_ep_queue() from f_midi_transmit(). Thus causing the completion function callback on the gadget never to be called (which it would free the allocated dma memory for the usb request).
The IRQ number is 279. And it is been requested successfully. Also it is triggered on other occasions, such as when I connect the USB cable to a host or using other gadgets, such as mass_storage and ether.
Any idea?
Thanks
Felipe,
Could you post in the linux-usb list the exact steps to reproduce the issue when using g_ether or mass storage?
That would help the debug of this issue. I don't have a midi device here to reproduce the original issue, but using g_ether or mass storage would be very helpful.
Regards,
Fabio Estevam
Hi Estevam,
Can you take a look at this email 'Re: MIDI gadget allocating too much from coherent pool' - MARC ?
I describe how to reproduce the bug. You don't actually need a MIDI controller for that. Just `amidi' tool.
I really appreciate if you can test as well.
Thanks,
Felipe
Hi Felipe,
Is this step correct? "* load g_ether module (this will create an ALSA card and device)"
g_ether will create a USB over ethernet device, not ALSA, right?
Yes. That was incorrect. The proper module is g_midi. But that is fixed already. Thanks!
Felipe,
Are you able to test this use case using a 4.2 kernel?
If you see this issue on a 4.2 then please report it to the linux-usb mailing list.
Regards,
Fabio Estevam
Hi Estevam,
Yes, the bug persists on 4.2. I have posted to linux-usb as you have seen.
Here is the thread for reference of others: 'MIDI gadget allocating too much from coherent pool' thread - MARC
Ok, great. People have made some suggestions in the thread, so hopefully we will be able to fix it soon.