[alsa-devel] g_audio kernel oops on pulling calbe

Angelo Compagnucci angelo.compagnucci at gmail.com
Tue Jul 7 09:46:27 CEST 2015


Hi Michael,

2015-07-07 9:19 GMT+02:00 Michael Trimarchi <michael at amarulasolutions.com>:
> Hi
>
> On Jul 7, 2015 9:13 AM, "Angelo Compagnucci" <angelo.compagnucci at gmail.com>
> wrote:
>>
>> Hi Michael
>>
>> 2015-07-06 19:20 GMT+02:00 Michael Trimarchi
>> <michael at amarulasolutions.com>:
>> > Hi
>> >
>> > On Jul 6, 2015 4:10 PM, "Angelo Compagnucci"
>> > <angelo.compagnucci at gmail.com>
>> > wrote:
>> >>
>> >> Hi Michael,
>> >>
>> >> 2015-07-06 15:38 GMT+02:00 Michael Trimarchi
>> >> <michael at amarulasolutions.com>:
>> >> > Hi
>> >> >
>> >> > On Mon, Jul 6, 2015 at 3:20 PM, Angelo Compagnucci
>> >> > <angelo.compagnucci at gmail.com> wrote:
>> >> >> Dear Developers,
>> >> >>
>> >> >> I'm having hard times with g_audio module on a Atmel SAMA5D3. I
>> >> >> always
>> >> >> obtain a kernel oops in a memcpy inside f_audio_complete function.
>> >> >> Honeslty I cannot understand wht's going wrong, cause that memcpy
>> >> >> should work.
>> >> >>
>> >> >> I have a simple ssc sound card whih works as expected when used with
>> >> >> aplay or any other audio player software, but when i pull the usb
>> >> >> cable this is what I obtain:
>> >> >>
>> >> >
>> >> > Please check if req->length is 4 byte too ;).
>> >>
>> >> Unfortunately it's not 4 bytes long ... Sometimes is 2 sometimes is
>> >> one, I added a dirty printk before the memcpy:
>> >
>> > Code is wrong, if the dst is 4 byte, you can't copy more then this, so
>> > some
>> > check should be done.
>>
>> Honestly, the buffer len never exceeded 2 bytes in my tests, at least
>> stating to the printk I added.
>>
>> [   11.750000] len=2 buf=0x560018
>> [   11.750000] data=0x18
>> [   11.750000] len=2 buf=0x56000C
>> [   11.750000] data=0x0C
>> [   11.760000] len=2 buf=0x560006
>> [   11.760000] data=0x06
>> [   11.760000] len=2 buf=0x560003
>> [   11.760000] data=0x03
>> [   11.770000] len=2 buf=0x560001
>> [   11.770000] data=0x01
>> [   11.770000] len=2 buf=0x56FFC1
>> [   11.770000] data=0xFFC1
>> [   11.780000] len=2 buf=0x56FFC0
>> [   11.780000] data=0xFFC0
>> [   12.420000] len=1 buf=0x410300
>> [   12.420000] data=0x00
>> [   12.440000] len=2 buf=0x41FFC0
>> [   12.440000] data=0xFFC0
>> [   12.450000] len=2 buf=0x41FFC0
>> [   12.450000] data=0xFFC0
>> [   12.650000] Unable to handle kernel paging request at virtual
>> address 0a080604
>> [   12.650000] pgd = c0004000
>> [   12.650000] [0a080604] *pgd=00000000
>> [   12.650000] Internal error: Oops: 805 [#1] ARM
>>
>
> Sorry I don't have code in front. I have asked to check length for this,

You can view from the pritk that length is max 2, it never exceeds 4
bytes. I added a check for length in the code, but it changes
anything. The only way to kill the error is to check the buffer
pointer before memcpy from it.

> anyway urb should contain a status on completion.

I will look into this.

Thank you!

>
> Michael
>
>> I think there is more of a problem with an invalid pointer. Indeed a
>> quick fix like this works:
>>
>> if (req->buf) memcpy(&data, req->buf, req->length);
>>
>> Unfortunately, it's fails miserably somewhere else with this error and
>> the audio from USB is jerky:
>>
>> [   11.680000] len=2 buf=0x560018
>> [   11.680000] data=0x18
>> [   11.680000] len=2 buf=0x56000C
>> [   11.680000] data=0x0C
>> [   11.690000] len=2 buf=0x560006
>> [   11.690000] data=0x06
>> [   11.690000] len=2 buf=0x560003
>> [   11.690000] data=0x03
>> [   11.700000] len=2 buf=0x560001
>> [   11.700000] data=0x01
>> [   11.700000] len=2 buf=0x56FFC1
>> [   11.700000] data=0xFFC1
>> [   11.710000] len=2 buf=0x56FFC0
>> [   11.710000] data=0xFFC0
>> [   12.340000] g_audio gadget: Playback error: -14
>> [   12.340000] g_audio gadget: Playback error: -14
>> [   12.350000] g_audio gadget: Playback error: -14
>> [   12.350000] g_audio gadget: Playback error: -14
>> [   12.350000] g_audio gadget: Playback error: -14
>> [   12.360000] len=1 buf=0x410300
>> [   12.360000] data=0x00
>> [   12.360000] g_audio gadget: Playback error: -14
>> [   12.370000] g_audio gadget: Playback error: -14
>> [   12.370000] g_audio gadget: Playback error: -14
>> [   12.380000] len=2 buf=0x41FFC0
>> [   12.380000] data=0xFFC0
>> [   12.380000] g_audio gadget: Playback error: -14
>> [   12.390000] g_audio gadget: Playback error: -14
>> [   12.390000] g_audio gadget: Playback error: -14
>> [   12.400000] g_audio gadget: Playback error: -14
>> [   12.400000] g_audio gadget: Playback error: -14
>> [   12.410000] len=2 buf=0x41FFC0
>> [   12.410000] data=0xFFC0
>> [   12.410000] g_audio gadget: Playback error: -14
>>
>> The error is obviously at that "data=0x00" probably cause the address
>> of buffer is invalid. Honestly I don't know where to look further to
>> understand the root cause of the problem. I initially thought that
>> having a working alsa driver should be a sufficient condition to have
>> a working usb bridge!
>>
>> Sincerely, Angelo
>>
>> >
>> > Michael
>> >
>> >>
>> >> [   23.320000] len=2 buf=
>> >
>> >
>> >> [   23.320000] len=2 buf=
>> >>
>> >> [   23.320000] len=2 buf=
>> >> [   23.330000] len=2 buf=
>> >> [   23.330000] len=2 buf=
>> >> [   23.330000] len=2 buf=��V
>> >> [   23.330000] len=2 buf=��V
>> >> [   23.970000] len=1 buf=
>> >> [   23.990000] len=2 buf=��A
>> >> [   24.000000] len=2 buf=��A
>> >> [   24.190000] Unable to handle kernel paging request at virtual
>> >> address 0a080604
>> >>
>> >> Any idea on what is causing this wired behaviour?
>> >>
>> >> Sincerely, Angelo
>> >>
>> >>
>> >> > Michael
>> >> >
>> >> >> [   23.860000] Unable to handle kernel paging request at virtual
>> >> >> address 0a080604
>> >> >> [   23.860000] pgd = c0004000
>> >> >> [   23.860000] [0a080604] *pgd=00000000
>> >> >> [   23.860000] Internal error: Oops: 805 [#1] ARM
>> >> >> [   23.860000] Modules linked in: usb_f_uac1 g_audio libcomposite
>> >> >> snd_soc_atmel_ssc_dai snd_soc_atmel_pcm_dma
>> >> >> [   23.860000] CPU: 0 PID: 0 Comm: swapper Not tainted 3.19.8+ #81
>> >> >> [   23.860000] Hardware name: Atmel SAMA5 (Device Tree)
>> >> >> [   23.860000] task: c05327b8 ti: c0528000 task.ti: c0528000
>> >> >> [   23.860000] PC is at memcpy+0x50/0x330
>> >> >> [   23.860000] LR is at 0x0
>> >> >> [   23.860000] pc : [<c01a0430>]    lr : [<00000000>]    psr:
>> >> >> 20090193
>> >> >> [   23.860000] sp : c0529e5c  ip : 00000000  fp : cfb33200
>> >> >> [   23.860000] r10: 00000001  r9 : 0000bb80  r8 : 00000000
>> >> >> [   23.860000] r7 : 00000000  r6 : 00000000  r5 : 00000000  r4 :
>> >> >> 00000000
>> >> >> [   23.860000] r3 : 00000000  r2 : 00000020  r1 : cf9f5220  r0 :
>> >> >> 0a080604
>> >> >> [   23.860000] Flags: nzCv  IRQs off  FIQs on  Mode SVC_32  ISA ARM
>> >> >> Segment kernel
>> >> >> [   23.860000] Control: 10c53c7d  Table: 2fb24059  DAC: 00000015
>> >> >> [   23.860000] Process swapper (pid: 0, stack limit = 0xc0528230)
>> >> >> [   23.860000] Stack: (0xc0529e5c to 0xc052a000)
>> >> >> [   23.860000] 9e40:
>> >> >>              cf9f5100
>> >> >> [   23.860000] 9e60: cfa25868 cf9e7dc0 cfb33080 0a080604 cfb33200
>> >> >> bf0287e0 cfa25858 00000000
>> >> >> [   23.860000] 9e80: cfa20a10 cfb33200 cfa25858 cfa20a10 cfa20a10
>> >> >> 000000c0 00000002 c0284f50
>> >> >> [   23.860000] 9ea0: c0529ea0 c0529ea0 00000002 00000090 cfa25858
>> >> >> c0286408 0000001c ffffffff
>> >> >> [   23.860000] 9ec0: 7fffffff c054e040 00000000 02000029 cf88cac0
>> >> >> c05544fe c0529ed8 c0529ed8
>> >> >> [   23.860000] 9ee0: 00000000 cfa23c40 cf802540 00000000 00000000
>> >> >> 0000002d cf901dc0 c05544fe
>> >> >> [   23.860000] 9f00: 00000000 c0040b28 c05544fe c0554dc0 cf901dc0
>> >> >> cf802540 00000000 00000000
>> >> >> [   23.860000] 9f20: cf802200 c051fe18 cfffc480 c0040c18 cf901dc0
>> >> >> c0042e38 0000002d 0000002d
>> >> >> [   23.860000] 9f40: 00000000 c004034c c053aca0 c0040570 c000eec4
>> >> >> 60090013 ffffffff c0529f9c
>> >> >> [   23.860000] 9f60: c0554600 c0011b00 00000000 c0536918 00000000
>> >> >> c0017880 c0528000 c05300c4
>> >> >> [   23.860000] 9f80: c05544fc c05544fc c0554600 c051fe18 cfffc480
>> >> >> 00000000 01000000 c0529fb0
>> >> >> [   23.860000] 9fa0: c000eec0 c000eec4 60090013 ffffffff c0528000
>> >> >> c0039b90 ffffffff c04fac30
>> >> >> [   23.860000] 9fc0: ffffffff ffffffff c04fa678 00000000 00000000
>> >> >> c051fe18 c05547d4 c0530070
>> >> >> [   23.860000] 9fe0: c051fe14 c0533860 20004059 410fc051 00000000
>> >> >> 20008070 00000000 00000000
>> >> >> [   23.860000] [<c01a0430>] (memcpy) from [<bf0287e0>]
>> >> >> (f_audio_complete+0x11c/0x170 [usb_f_uac1])
>> >> >> [   23.860000] [<bf0287e0>] (f_audio_complete [usb_f_uac1]) from
>> >> >> [<c0284f50>] (request_complete+0x5c/0x80)
>> >> >> [   23.860000] [<c0284f50>] (request_complete) from [<c0286408>]
>> >> >> (usba_udc_irq+0x12c/0xc50)
>> >> >> [   23.860000] [<c0286408>] (usba_udc_irq) from [<c0040b28>]
>> >> >> (handle_irq_event_percpu+0x78/0x140)
>> >> >> [   23.860000] [<c0040b28>] (handle_irq_event_percpu) from
>> >> >> [<c0040c18>] (handle_irq_event+0x28/0x38)
>> >> >> [   23.860000] [<c0040c18>] (handle_irq_event) from [<c0042e38>]
>> >> >> (handle_fasteoi_irq+0x9c/0x164)
>> >> >> [   23.860000] [<c0042e38>] (handle_fasteoi_irq) from [<c004034c>]
>> >> >> (generic_handle_irq+0x2c/0x3c)
>> >> >> [   23.860000] [<c004034c>] (generic_handle_irq) from [<c0040570>]
>> >> >> (__handle_domain_irq+0x54/0xa8)
>> >> >> [   23.860000] [<c0040570>] (__handle_domain_irq) from [<c0011b00>]
>> >> >> (__irq_svc+0x40/0x54)
>> >> >> [   23.860000] [<c0011b00>] (__irq_svc) from [<c000eec4>]
>> >> >> (arch_cpu_idle+0x38/0x3c)
>> >> >> [   23.860000] [<c000eec4>] (arch_cpu_idle) from [<c0039b90>]
>> >> >> (cpu_startup_entry+0xa8/0xf4)
>> >> >> [   23.860000] [<c0039b90>] (cpu_startup_entry) from [<c04fac30>]
>> >> >> (start_kernel+0x374/0x380)
>> >> >> [   23.860000] Code: f5d1f05c f5d1f07c e8b151f8 e2522020 (e8a051f8)
>> >> >> [   23.860000] ---[ end trace 6affc0dac289a4ab ]---
>> >> >> [   23.860000] Kernel panic - not syncing: Fatal exception in
>> >> >> interrupt
>> >> >> [   23.860000] ---[ end Kernel panic - not syncing: Fatal exception
>> >> >> in
>> >> >> interrupt
>> >> >>
>> >> >> Anyone has a clue about that?
>> >> >>
>> >> >> --
>> >> >> Profile: http://it.linkedin.com/in/compagnucciangelo
>> >> >> _______________________________________________
>> >> >> Alsa-devel mailing list
>> >> >> Alsa-devel at alsa-project.org
>> >> >> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
>> >> >
>> >> >
>> >> >
>> >> > --
>> >> > | Michael Nazzareno Trimarchi                     Amarula Solutions
>> >> > BV |
>> >> > | COO  -  Founder                                      Cruquiuskade
>> >> > 47 |
>> >> > | +31(0)851119172                                 Amsterdam 1018 AM
>> >> > NL |
>> >> > |                  [`as] http://www.amarulasolutions.com
>> >> > |
>> >>
>> >>
>> >>
>> >> --
>> >> Profile: http://it.linkedin.com/in/compagnucciangelo
>>
>>
>>
>> --
>> Profile: http://it.linkedin.com/in/compagnucciangelo



-- 
Profile: http://it.linkedin.com/in/compagnucciangelo


More information about the Alsa-devel mailing list