Hello all,
I’m hitting a kernel backtrace which claims the USB stack is trying to resume the OTG port in an invalid context. The backtrace is below.
Assuming the message is correct, I’m hoping I can sidestep the issue by disabling power management on the OTG port. However, setting all the power/control options to “on” doesn’t make a difference.
$ grep . /sys/bus/usb/devices/*/power/control
/sys/bus/usb/devices/1-3/power/control:on
/sys/bus/usb/devices/2-1/power/control:on
/sys/bus/usb/devices/usb1/power/control:on
/sys/bus/usb/devices/usb2/power/control:on
Backtraces:
[ 92.781606] g_webcam gadget: uvc_function_bind
[ 92.786372] g_webcam gadget: Webcam Video Gadget
[ 92.791154] g_webcam gadget: g_webcam ready
[ 92.795490] tegra-xudc-new 700d0000.xudc: exiting ELPG
[ 92.801534] tegra-xudc-new 700d0000.xudc: exiting ELPG done
[ 92.807275] tegra-xudc-new 700d0000.xudc: ep 0 (type: 0, dir: out) enabled
[ 92.814270] tegra-xudc-new 700d0000.xudc: entering ELPG
[ 92.819899] tegra-xudc-new 700d0000.xudc: entering ELPG done
[ 134.765290] BUG: sleeping function called from invalid context at drivers/base/power/runtime.c:956
[ 134.774276] in_atomic(): 1, irqs_disabled(): 128, pid: 3857, name: uvc-gadget
[ 134.781418] CPU: 3 PID: 3857 Comm: uvc-gadget Not tainted 4.4.38 #13
[ 134.787775] Hardware name: jetson_tx1 (DT)
[ 134.791879] Call trace:
[ 134.794368] [<ffffffc000089238>] dump_backtrace+0x0/0xe8
[ 134.799762] [<ffffffc000089334>] show_stack+0x14/0x20
[ 134.804916] [<ffffffc000389c9c>] dump_stack+0xb4/0xe8
[ 134.810068] [<ffffffc0000c948c>] ___might_sleep+0x13c/0x148
[ 134.815736] [<ffffffc0000c9508>] __might_sleep+0x70/0x98
[ 134.821146] [<ffffffc000619828>] __pm_runtime_resume+0x40/0xa0
[ 134.827078] [<ffffffc0007463a0>] tegra_xudc_gadget_pullup+0x30/0xf8
[ 134.833523] [<ffffffbffcf41b2c>] usb_function_activate+0x8c/0xd0 [libcomposite]
[ 134.841002] [<ffffffbffcf5a310>] uvc_function_connect+0x20/0x50 [usb_f_uvc]
[ 134.848129] [<ffffffbffcf5ae8c>] uvc_v4l2_open+0x64/0x90 [usb_f_uvc]
[ 134.854585] [<ffffffc000787588>] v4l2_open+0x88/0x108
[ 134.859743] [<ffffffc0001d99fc>] chrdev_open+0x104/0x198
[ 134.865159] [<ffffffc0001d32ac>] do_dentry_open+0x1fc/0x310
[ 134.870833] [<ffffffc0001d4520>] vfs_open+0x68/0x78
[ 134.875807] [<ffffffc0001e3514>] do_last+0x91c/0xcc8
[ 134.880863] [<ffffffc0001e3ad8>] path_openat+0x218/0x2b0
[ 134.886266] [<ffffffc0001e4c78>] do_filp_open+0x68/0xc0
[ 134.891590] [<ffffffc0001d48c8>] do_sys_open+0x160/0x200
[ 134.897002] [<ffffffc0001d49a0>] SyS_openat+0x10/0x18
[ 134.902151] [<ffffffc0000847f0>] el0_svc_naked+0x24/0x28
[ 134.907942] tegra-xudc-new 700d0000.xudc: exiting ELPG
[ 134.914241] BUG: scheduling while atomic: uvc-gadget/3857/0x00000002
[ 134.920755] Modules linked in: g_webcam usb_f_uvc libcomposite xt_addrtype br_netfilter bcmdhd bluedroid_pm
[ 134.930923] CPU: 3 PID: 3857 Comm: uvc-gadget Not tainted 4.4.38 #13
[ 134.937281] Hardware name: jetson_tx1 (DT)
[ 134.941381] Call trace:
[ 134.943843] [<ffffffc000089238>] dump_backtrace+0x0/0xe8
[ 134.949160] [<ffffffc000089334>] show_stack+0x14/0x20
[ 134.954219] [<ffffffc000389c9c>] dump_stack+0xb4/0xe8
[ 134.959277] [<ffffffc0000c9584>] __schedule_bug+0x54/0x78
[ 134.964683] [<ffffffc000b4513c>] __schedule+0x94/0x728
[ 134.969827] [<ffffffc000b45858>] schedule+0x88/0xa8
[ 134.974711] [<ffffffc000b48cb8>] schedule_hrtimeout_range_clock+0xd0/0x128
[ 134.981587] [<ffffffc000b48d20>] schedule_hrtimeout_range+0x10/0x18
[ 134.987858] [<ffffffc000b486d4>] usleep_range+0x64/0x70
[ 134.993088] [<ffffffc0007479c0>] tegra_xudc_fpci_ipfs_init+0xc8/0x128
[ 134.999531] [<ffffffc000749988>] tegra_xudc_unpowergate+0x148/0x1e8
[ 135.005800] [<ffffffc000749a38>] tegra_xudc_runtime_resume+0x10/0x18
[ 135.012160] [<ffffffc000615fc0>] pm_generic_runtime_resume+0x28/0x40
[ 135.018519] [<ffffffc0006210d4>] pm_genpd_default_restore_state+0x94/0xb0
[ 135.025309] [<ffffffc000622c8c>] genpd_restore_dev.isra.3+0x1c/0x50
[ 135.031579] [<ffffffc000622f84>] pm_genpd_runtime_resume+0xec/0x1c8
[ 135.037848] [<ffffffc000617d70>] __rpm_callback+0x40/0x78
[ 135.043251] [<ffffffc000617e0c>] rpm_callback+0x64/0x88
[ 135.048479] [<ffffffc00061844c>] rpm_resume+0x37c/0x658
[ 135.053708] [<ffffffc000619860>] __pm_runtime_resume+0x78/0xa0
[ 135.059543] [<ffffffc0007463a0>] tegra_xudc_gadget_pullup+0x30/0xf8
[ 135.065829] [<ffffffbffcf41b2c>] usb_function_activate+0x8c/0xd0 [libcomposite]
[ 135.073153] [<ffffffbffcf5a310>] uvc_function_connect+0x20/0x50 [usb_f_uvc]
[ 135.080128] [<ffffffbffcf5ae8c>] uvc_v4l2_open+0x64/0x90 [usb_f_uvc]
[ 135.086486] [<ffffffc000787588>] v4l2_open+0x88/0x108
[ 135.091543] [<ffffffc0001d99fc>] chrdev_open+0x104/0x198
[ 135.096861] [<ffffffc0001d32ac>] do_dentry_open+0x1fc/0x310
[ 135.102439] [<ffffffc0001d4520>] vfs_open+0x68/0x78
[ 135.107323] [<ffffffc0001e3514>] do_last+0x91c/0xcc8
[ 135.112293] [<ffffffc0001e3ad8>] path_openat+0x218/0x2b0
[ 135.117609] [<ffffffc0001e4c78>] do_filp_open+0x68/0xc0
[ 135.122840] [<ffffffc0001d48c8>] do_sys_open+0x160/0x200
[ 135.128157] [<ffffffc0001d49a0>] SyS_openat+0x10/0x18
[ 135.133214] [<ffffffc0000847f0>] el0_svc_naked+0x24/0x28
[ 135.138648] tegra-xudc-new 700d0000.xudc: exiting ELPG done
[ 135.144247] BUG: scheduling while atomic: uvc-gadget/3857/0x00000000
[ 135.150605] Modules linked in: g_webcam usb_f_uvc libcomposite xt_addrtype br_netfilter bcmdhd bluedroid_pm
[ 135.160450] CPU: 3 PID: 3857 Comm: uvc-gadget Tainted: G W 4.4.38 #13
[ 135.168014] Hardware name: jetson_tx1 (DT)
[ 135.172110] Call trace:
[ 135.174563] [<ffffffc000089238>] dump_backtrace+0x0/0xe8
[ 135.179874] [<ffffffc000089334>] show_stack+0x14/0x20
[ 135.184925] [<ffffffc000389c9c>] dump_stack+0xb4/0xe8
[ 135.189977] [<ffffffc0000c9584>] __schedule_bug+0x54/0x78
[ 135.195376] [<ffffffc000b4513c>] __schedule+0x94/0x728
[ 135.200513] [<ffffffc000b45858>] schedule+0x88/0xa8
[ 135.205391] [<ffffffc000084700>] ret_to_user+0x0/0x24
[ 135.222143] tegra-xudc-new 700d0000.xudc: entering ELPG
[ 135.227609] tegra-xudc-new 700d0000.xudc: entering ELPG done
[ 204.155025] BUG: sleeping function called from invalid context at drivers/base/power/runtime.c:956
[ 204.163997] in_atomic(): 1, irqs_disabled(): 128, pid: 3857, name: uvc-gadget
[ 204.171120] CPU: 0 PID: 3857 Comm: uvc-gadget Tainted: G W 4.4.38 #13
[ 204.178673] Hardware name: jetson_tx1 (DT)
[ 204.182758] Call trace:
[ 204.185202] [<ffffffc000089238>] dump_backtrace+0x0/0xe8
[ 204.190503] [<ffffffc000089334>] show_stack+0x14/0x20
[ 204.195544] [<ffffffc000389c9c>] dump_stack+0xb4/0xe8
[ 204.200586] [<ffffffc0000c948c>] ___might_sleep+0x13c/0x148
[ 204.206144] [<ffffffc0000c9508>] __might_sleep+0x70/0x98
[ 204.211445] [<ffffffc000619828>] __pm_runtime_resume+0x40/0xa0
[ 204.217266] [<ffffffc0007463a0>] tegra_xudc_gadget_pullup+0x30/0xf8
[ 204.223531] [<ffffffbffcf41790>] usb_function_deactivate+0x60/0xc0 [libcomposite]
[ 204.231007] [<ffffffbffcf5a360>] uvc_function_disconnect+0x20/0x50 [usb_f_uvc]
[ 204.238222] [<ffffffbffcf5add0>] uvc_v4l2_release+0x28/0x80 [usb_f_uvc]
[ 204.244823] [<ffffffc0007874ac>] v4l2_release+0x3c/0x90
[ 204.250038] [<ffffffc0001d6c9c>] __fput+0xf4/0x1c0
[ 204.254817] [<ffffffc0001d6dcc>] ____fput+0xc/0x18
[ 204.259598] [<ffffffc0000bfcb4>] task_work_run+0xac/0xe0
[ 204.264898] [<ffffffc0000a6840>] do_exit+0x448/0x9b8
[ 204.269850] [<ffffffc0000a6e58>] do_group_exit+0x78/0xc0
[ 204.275150] [<ffffffc0000b21d0>] get_signal+0x4d8/0x5d0
[ 204.280363] [<ffffffc000088a4c>] do_signal+0x9c/0x380
[ 204.285403] [<ffffffc000088ef0>] do_notify_resume+0x18/0x60
[ 204.290963] [<ffffffc0000846f8>] work_pending+0x1c/0x20
[ 204.296345] tegra-xudc-new 700d0000.xudc: exiting ELPG
[ 204.301799] BUG: scheduling while atomic: uvc-gadget/3857/0x00000002
[ 204.308162] Modules linked in: g_webcam usb_f_uvc libcomposite xt_addrtype br_netfilter bcmdhd bluedroid_pm
[ 204.317983] CPU: 0 PID: 3857 Comm: uvc-gadget Tainted: G W 4.4.38 #13
[ 204.325534] Hardware name: jetson_tx1 (DT)
[ 204.329619] Call trace:
[ 204.332062] [<ffffffc000089238>] dump_backtrace+0x0/0xe8
[ 204.337362] [<ffffffc000089334>] show_stack+0x14/0x20
[ 204.342402] [<ffffffc000389c9c>] dump_stack+0xb4/0xe8
[ 204.347443] [<ffffffc0000c9584>] __schedule_bug+0x54/0x78
[ 204.352830] [<ffffffc000b4513c>] __schedule+0x94/0x728
[ 204.357956] [<ffffffc000b45858>] schedule+0x88/0xa8
[ 204.362824] [<ffffffc000b48cb8>] schedule_hrtimeout_range_clock+0xd0/0x128
[ 204.369684] [<ffffffc000b48d20>] schedule_hrtimeout_range+0x10/0x18
[ 204.375936] [<ffffffc000b486d4>] usleep_range+0x64/0x70
[ 204.381150] [<ffffffc0007479c0>] tegra_xudc_fpci_ipfs_init+0xc8/0x128
[ 204.387576] [<ffffffc000749988>] tegra_xudc_unpowergate+0x148/0x1e8
[ 204.393828] [<ffffffc000749a38>] tegra_xudc_runtime_resume+0x10/0x18
[ 204.400170] [<ffffffc000615fc0>] pm_generic_runtime_resume+0x28/0x40
[ 204.406511] [<ffffffc0006210d4>] pm_genpd_default_restore_state+0x94/0xb0
[ 204.413285] [<ffffffc000622c8c>] genpd_restore_dev.isra.3+0x1c/0x50
[ 204.419537] [<ffffffc000622f84>] pm_genpd_runtime_resume+0xec/0x1c8
[ 204.425788] [<ffffffc000617d70>] __rpm_callback+0x40/0x78
[ 204.431174] [<ffffffc000617e0c>] rpm_callback+0x64/0x88
[ 204.436386] [<ffffffc00061844c>] rpm_resume+0x37c/0x658
[ 204.441598] [<ffffffc000619860>] __pm_runtime_resume+0x78/0xa0
[ 204.447418] [<ffffffc0007463a0>] tegra_xudc_gadget_pullup+0x30/0xf8
[ 204.453682] [<ffffffbffcf41790>] usb_function_deactivate+0x60/0xc0 [libcomposite]
[ 204.461157] [<ffffffbffcf5a360>] uvc_function_disconnect+0x20/0x50 [usb_f_uvc]
[ 204.468372] [<ffffffbffcf5add0>] uvc_v4l2_release+0x28/0x80 [usb_f_uvc]
[ 204.474972] [<ffffffc0007874ac>] v4l2_release+0x3c/0x90
[ 204.480184] [<ffffffc0001d6c9c>] __fput+0xf4/0x1c0
[ 204.484964] [<ffffffc0001d6dcc>] ____fput+0xc/0x18
[ 204.489744] [<ffffffc0000bfcb4>] task_work_run+0xac/0xe0
[ 204.495043] [<ffffffc0000a6840>] do_exit+0x448/0x9b8
[ 204.499995] [<ffffffc0000a6e58>] do_group_exit+0x78/0xc0
[ 204.505294] [<ffffffc0000b21d0>] get_signal+0x4d8/0x5d0
[ 204.510507] [<ffffffc000088a4c>] do_signal+0x9c/0x380
[ 204.515547] [<ffffffc000088ef0>] do_notify_resume+0x18/0x60
[ 204.521106] [<ffffffc0000846f8>] work_pending+0x1c/0x20
[ 204.526512] tegra-xudc-new 700d0000.xudc: exiting ELPG done
[ 204.532141] tegra-xudc-new 700d0000.xudc: entering ELPG
[ 204.533135] ------------[ cut here ]------------
[ 204.533138] WARNING: at kernel/softirq.c:99
[ 204.533146] Modules linked in: g_webcam usb_f_uvc libcomposite xt_addrtype br_netfilter bcmdhd bluedroid_pm
[ 204.533147]
[ 204.533152] CPU: 0 PID: 3857 Comm: uvc-gadget Tainted: G W 4.4.38 #13
[ 204.533153] Hardware name: jetson_tx1 (DT)
[ 204.533154] task: ffffffc05d553e80 ti: ffffffc0d08f8000 task.ti: ffffffc0d08f8000
[ 204.533160] PC is at __local_bh_disable_ip+0x2c/0x78
[ 204.533165] LR is at _raw_spin_lock_bh+0x1c/0x58
[ 204.533167] pc : [<ffffffc0000a788c>] lr : [<ffffffc000b4933c>] pstate: 00000145
[ 204.533168] sp : ffffffc0d08fbc10
[ 204.533170] x29: ffffffc0d08fbc10 x28: 0000000000000009
[ 204.533173] x27: ffffffc000b50000 x26: ffffffc076f0ede8
[ 204.533175] x25: 0000000000000000 x24: ffffffc076f0ed80
[ 204.533177] x23: 0000007f905079dc x22: ffffffc0012b2000
[ 204.533179] x21: ffffffc0f192be00 x20: ffffffc05d553e80
[ 204.533181] x19: ffffffc0014f6858 x18: 000000000000002f
[ 204.533183] x17: 0000007fb1e7e1b0 x16: ffffffc0001dcbb8
[ 204.533185] x15: 0000000000000010 x14: 0000000000000001
[ 204.533187] x13: 0000000000000000 x12: 000000000011b995
[ 204.533189] x11: 0000000000165500 x10: 0000000000000890
[ 204.533191] x9 : ffffffc0d08fbb00 x8 : ffffffc05d554770
[ 204.533193] x7 : 0000000040040000 x6 : ffffffc05d554678
[ 204.533195] x5 : ffffffc0012b2000 x4 : 0000000000000000
[ 204.533197] x3 : 0000000000000000 x2 : ffffffc001474000
[ 204.533199] x1 : 0000000000000201 x0 : ffffffc00012e040