This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM3358: 5.4 Kernel crashes randomly with usb gadget events

Part Number: AM3358
Other Parts Discussed in Thread: TPS65910

Hello,

I have a custom board based on AM3358 and using 5.4-rt kernel. Custom board has usb-to-ether gadget port which is used in two configurations 1. RNDIS 2. ECM and this is achieved through 'modprobe g_ether' at boot time.

Though interface(usb0) comes up on boot and works fine but kernel crash is observed RANDOMLY upon these two events:

  • Plug-out and plug-in USB cable to Host side
  • Changing configuration (RNDIS <-> ECM) by changing host Windows 

Here is the crash logs:

[ 1254.489698] 000: 8<--- cut here ---
[ 1254.493280] 000: Unable to handle kernel NULL pointer dereference at virtual address 00000004
[ 1254.501859] 000: pgd = 06f840b2
[ 1254.505020] 000: [00000004] *pgd=00000000
[ 1254.509042] 000:
[ 1254.510984] 000: Internal error: Oops: 5 [#1] PREEMPT_RT ARM
[ 1254.516668] 000: Modules linked in:
[ 1254.520167] 000:  iptable_filter
[ 1254.523403] 000:  iptable_mangle
[ 1254.526638] 000:  iptable_nat
[ 1254.529611] 000:  ip_tables
[ 1254.532409] 000:  ip6table_filter
[ 1254.535731] 000:  ip6table_mangle
[ 1254.539053] 000:  ip6table_nat
[ 1254.542113] 000:  nf_nat
[ 1254.544650] 000:  nf_conntrack
[ 1254.547710] 000:  libcrc32c
[ 1254.550509] 000:  nf_defrag_ipv4
[ 1254.553744] 000:  nf_defrag_ipv6
[ 1254.556979] 000:  ip6_tables
[ 1254.559865] 000:  x_tables
[ 1254.562576] 000:  usb_f_ecm
[ 1254.565375] 000:  g_ether
[ 1254.567999] 000:  usb_f_rndis
[ 1254.570972] 000:  u_ether
[ 1254.573596] 000:  libcomposite
[ 1254.576657] 000:  cdc_ether
[ 1254.579456] 000:  usbnet
[ 1254.581993] 000:  ti_am335x_tsc
[ 1254.585140] 000:  musb_dsps
[ 1254.587938] 000:  musb_hdrc
[ 1254.590737] 000:  udc_core
[ 1254.593448] 000:  usbcore
[ 1254.596072] 000:  phy_am335x
[ 1254.598957] 000:  phy_generic
[ 1254.601930] 000:  usb_common
[ 1254.604815] 000:  phy_am335x_control
[ 1254.608398] 000:  cbc
[ 1254.610673] 000:  ecb
[ 1254.612947] 000:  sha256_generic
[ 1254.616181] 000:  libsha256
[ 1254.618979] 000:  aes_arm
[ 1254.621603] 000:  aes_generic
[ 1254.624575] 000:  hmac
[ 1254.626937] 000:  aes_arm_bs
[ 1254.629822] 000:  crypto_simd
[ 1254.632794] 000:  cryptd
[ 1254.635331] 000:  md5
[ 1254.637606] 000:  omap_aes_driver
[ 1254.640926] 000:  crypto_engine
[ 1254.644075] 000:  pvrsrvkm(O)
[ 1254.647048] 000:  omap_crypto
[ 1254.650021] 000:  pm33xx
[ 1254.652557] 000:  omap_sham
[ 1254.655355] 000:  libaes
[ 1254.657891] 000:  ti_emif_sram
[ 1254.660950] 000:  rtc_tps65910
[ 1254.664010] 000:  rtc_omap
[ 1254.666722] 000:  omap_wdt
[ 1254.669433] 000:  wkup_m3_ipc
[ 1254.672406] 000:  ti_am335x_tscadc
[ 1254.675814] 000:  wkup_m3_rproc
[ 1254.678961] 000:  musb_am335x
[ 1254.681934] 000:  mstp_cmnet(O)
[ 1254.685081] 000:
[ 1254.687015] 000: CPU: 0 PID: 569 Comm: irq/63-musb-hdr Tainted: G           O      5.4.161-rt66-g9bb0d70eea #1
[ 1254.697058] 000: Hardware name: Generic AM33XX (Flattened Device Tree)
[ 1254.703608] 000: PC is at txstate+0xd8/0x60c [musb_hdrc]
[ 1254.709035] 000: LR is at txstate+0xbc/0x60c [musb_hdrc]
[ 1254.714391] 000: pc : [<bf26f5a8>]    lr : [<bf26f58c>]    psr: 20000113
[ 1254.721117] 000: sp : c99ede80  ip : 00000002  fp : 0000025a
[ 1254.726795] 000: r10: 00000200  r9 : bf2784cc  r8 : d2363410
[ 1254.732472] 000: r7 : cf722040  r6 : cf722490  r5 : 00002400  r4 : c66f7f80
[ 1254.739459] 000: r3 : c0c71888  r2 : 00000000  r1 : bf276b58  r0 : 00000000
[ 1254.746447] 000: Flags: nzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment user
[ 1254.754048] 000: Control: 10c5387d  Table: 86460019  DAC: 00000055
[ 1254.760248] 000: Process irq/63-musb-hdr (pid: 569, stack limit = 0x87d8f6a0)
[ 1254.767413] 000: Stack: (0xc99ede80 to 0xc99ee000)
[ 1254.772226] 000: de80: 0000005a 00002400 0000025a 00000200 00000000 bf2709f4 c0c7aecc 0000005a
[ 1254.780873] 000: dea0: 0000005a d2363400 cf7224e0 00000010 c0c7aecc cf722040 cf723040 00000000
[ 1254.789519] 000: dec0: 00000001 00000099 cf722354 bf2784c0 cf722350 bf267ed0 c99ec000 00000001
[ 1254.798166] 000: dee0: c0070a3c c0894528 c99edee8 00000000 00000002 c0c71888 00000000 cf722040
[ 1254.806814] 000: df00: bf2b56e4 00000000 d2365000 cf722354 ce7461c0 c0cbbabb 00000449 bf2b35d0
[ 1254.815460] 000: df20: ce5800c0 ce102c00 c99ec000 00000001 c0070a3c ffffe000 c0cbbabb c0070a64
[ 1254.824107] 000: df40: ce5800c0 ce102c00 c99ec000 c0070d48 00000000 00000000 c0070b80 c0c71888
[ 1254.832754] 000: df60: c99edf74 ce5802c0 ce580100 c99ec000 00000000 ce5800c0 c0070c5c ce4719f0
[ 1254.841401] 000: df80: ce5802d8 c004e280 00000000 ce580100 c004e154 00000000 00000000 00000000
[ 1254.850048] 000: dfa0: 00000000 00000000 00000000 c00090e0 00000000 00000000 00000000 00000000
[ 1254.858694] 000: dfc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 1254.867341] 000: dfe0: 00000000 00000000 00000000 00000000 00000013 00000000 00000000 00000000
[ 1254.876025] 000: [<bf26f5a8>] (txstate [musb_hdrc]) from [<bf267ed0>] (musb_interrupt+0xd0/0xd9c [musb_hdrc])
[ 1254.886038] 000: [<bf267ed0>] (musb_interrupt [musb_hdrc]) from [<bf2b35d0>] (dsps_interrupt+0x1c4/0x278 [musb_dsps])
[ 1254.896731] 000: [<bf2b35d0>] (dsps_interrupt [musb_dsps]) from [<c0070a64>] (irq_forced_thread_fn+0x28/0x98)
[ 1254.906712] 000: [<c0070a64>] (irq_forced_thread_fn) from [<c0070d48>] (irq_thread+0xec/0x210)
[ 1254.915362] 000: [<c0070d48>] (irq_thread) from [<c004e280>] (kthread+0x12c/0x18c)
[ 1254.922970] 000: [<c004e280>] (kthread) from [<c00090e0>] (ret_from_fork+0x14/0x34)
[ 1254.930662] 000: Exception stack(0xc99edfb0 to 0xc99edff8)
[ 1254.936168] 000: dfa0:                                     00000000 00000000 00000000 00000000
[ 1254.944814] 000: dfc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 1254.953459] 000: dfe0: 00000000 00000000 00000000 00000000 00000013 00000000
[ 1254.960539] 000: Code: 0a00009d e596004c e594b004 e594a034 (e5902004)
[ 1254.967133] 000: ---[ end trace 0000000000000002 ]---
[ 1254.972248] 000: genirq: exiting task "irq/63-musb-hdr" (569) is an active IRQ thread (irq 63)
[ 1255.185113] 000: irq 63: nobody cared (try booting with the "irqpoll" option)
[ 1255.192276] 000: CPU: 0 PID: 569 Comm: irq/63-musb-hdr Tainted: G      D    O      5.4.161-rt66-g9bb0d70eea #1
[ 1255.202319] 000: Hardware name: Generic AM33XX (Flattened Device Tree)
[ 1255.208872] 000: [<c001607c>] (unwind_backtrace) from [<c0012f24>] (show_stack+0x10/0x14)
[ 1255.217096] 000: [<c0012f24>] (show_stack) from [<c0884b54>] (__report_bad_irq+0x30/0x104)
[ 1255.225406] 000: [<c0884b54>] (__report_bad_irq) from [<c0072eb0>] (note_interrupt+0x22c/0x284)
[ 1255.234147] 000: [<c0072eb0>] (note_interrupt) from [<c006fb94>] (handle_irq_event_percpu+0x90/0xa4)
[ 1255.243321] 000: [<c006fb94>] (handle_irq_event_percpu) from [<c006fbf4>] (handle_irq_event+0x4c/0x9c)
[ 1255.252667] 000: [<c006fbf4>] (handle_irq_event) from [<c0073d50>] (handle_level_irq+0xc4/0x174)
[ 1255.261491] 000: [<c0073d50>] (handle_level_irq) from [<c006eb98>] (generic_handle_irq+0x20/0x34)
[ 1255.270402] 000: [<c006eb98>] (generic_handle_irq) from [<c006f370>] (__handle_domain_irq+0x48/0xa4)
[ 1255.279573] 000: [<c006f370>] (__handle_domain_irq) from [<c0009a78>] (__irq_svc+0x58/0xa0)
[ 1255.287960] 000: Exception stack(0xc99edce0 to 0xc99edd28)
[ 1255.293470] 000: dce0: ce102c10 fa200088 ce102c00 c99edd30 ce102c00 c99ec000 ce5800c0 c0cbd244
[ 1255.302116] 000: dd00: c99edf54 c9a85fac c9a85b00 ffffe000 ce800240 c99edd30 c0075cb8 c0070930
[ 1255.310760] 000: dd20: 60000113 ffffffff
[ 1255.314694] 000: [<c0009a78>] (__irq_svc) from [<c0070930>] (irq_finalize_oneshot.part.0+0x74/0x180)
[ 1255.323867] 000: [<c0070930>] (irq_finalize_oneshot.part.0) from [<c004c7f4>] (task_work_run+0x94/0xe8)
[ 1255.333313] 000: [<c004c7f4>] (task_work_run) from [<c0033c88>] (do_exit+0x340/0xa44)
[ 1255.341193] 000: [<c0033c88>] (do_exit) from [<c0013180>] (die+0x258/0x294)
[ 1255.348184] 000: [<c0013180>] (die) from [<c001a534>] (__do_kernel_fault.part.0+0x60/0x88)
[ 1255.356491] 000: [<c001a534>] (__do_kernel_fault.part.0) from [<c001a8d8>] (do_page_fault+0x37c/0x38c)
[ 1255.365838] 000: [<c001a8d8>] (do_page_fault) from [<c001aa5c>] (do_DataAbort+0x38/0xbc)
[ 1255.373963] 000: [<c001aa5c>] (do_DataAbort) from [<c00099f8>] (__dabt_svc+0x58/0x80)
[ 1255.381825] 000: Exception stack(0xc99ede30 to 0xc99ede78)
[ 1255.387331] 000: de20:                                     00000000 bf276b58 00000000 c0c71888
[ 1255.395978] 000: de40: c66f7f80 00002400 cf722490 cf722040 d2363410 bf2784cc 00000200 0000025a
[ 1255.404624] 000: de60: 00000002 c99ede80 bf26f58c bf26f5a8 20000113 ffffffff
[ 1255.411697] 000: [<c00099f8>] (__dabt_svc) from [<bf26f5a8>] (txstate+0xd8/0x60c [musb_hdrc])
[ 1255.420303] 000: [<bf26f5a8>] (txstate [musb_hdrc]) from [<bf267ed0>] (musb_interrupt+0xd0/0xd9c [musb_hdrc])
[ 1255.430309] 000: [<bf267ed0>] (musb_interrupt [musb_hdrc]) from [<bf2b35d0>] (dsps_interrupt+0x1c4/0x278 [musb_dsps])
[ 1255.440991] 000: [<bf2b35d0>] (dsps_interrupt [musb_dsps]) from [<c0070a64>] (irq_forced_thread_fn+0x28/0x98)
[ 1255.450953] 000: [<c0070a64>] (irq_forced_thread_fn) from [<c0070d48>] (irq_thread+0xec/0x210)
[ 1255.459601] 000: [<c0070d48>] (irq_thread) from [<c004e280>] (kthread+0x12c/0x18c)
[ 1255.467206] 000: [<c004e280>] (kthread) from [<c00090e0>] (ret_from_fork+0x14/0x34)
[ 1255.474893] 000: Exception stack(0xc99edfb0 to 0xc99edff8)
[ 1255.480398] 000: dfa0:                                     00000000 00000000 00000000 00000000
[ 1255.489044] 000: dfc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 1255.497688] 000: dfe0: 00000000 00000000 00000000 00000000 00000013 00000000
[ 1255.504762] 000: handlers:
[ 1255.507474] 000: [<0726db47>] irq_default_primary_handler
[ 1255.512893] 000:  threaded [<bcf61d6b>] dsps_interrupt [musb_dsps]
[ 1255.519099] 000:
[ 1255.521026] 000: Disabling IRQ #63

Regards,

Raxesh