CHROMIUM: usb: dwc3: rockchip: fix hung task timeout when rm xhci-hcd
We will remove the xhci controller from usb bus when Type-C USB
is disconnected. This patch set xhci state to XHCI_STATE_REMOVING
when remove xhci-hcd to indicate that the host is being removed
and avoid queueing configure_endpoint commands for the dropped
endpoints.
This fix the following problem, observed with a USB-C HUB.
[11760.112650] INFO: task kworker/0:2:1636 blocked for more than 120 seconds.
[11760.119588] Tainted: G W 4.4.21 #2
[11760.124779] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[11760.134551] kworker/0:2 D
ffffffc000204fd8 0 1636 2 0x00000000
[11760.143947] Workqueue: usb_hub_wq hub_event
[11760.148173] Call trace:
[11760.152660] [<
ffffffc000204fd8>] __switch_to+0x9c/0xa8
[11760.157820] [<
ffffffc00090f754>] __schedule+0x440/0x6d8
[11760.166718] [<
ffffffc00090fa80>] schedule+0x94/0xb4
[11760.171643] [<
ffffffc000912bfc>] schedule_timeout+0x44/0x27c
[11760.181127] [<
ffffffc0009106d8>] wait_for_common+0xf8/0x198
[11760.186746] [<
ffffffc0009107a0>] wait_for_completion+0x28/0x34
[11760.195950] [<
ffffffc000674e40>] xhci_configure_endpoint+0x20c/0x4b0
[11760.202569] [<
ffffffc000675730>] xhci_check_bandwidth+0x1a4/0x324
[11760.212137] [<
ffffffc00064798c>] usb_hcd_alloc_bandwidth+0xb4/0x2c8
[11760.218446] [<
ffffffc00064a690>] usb_disable_device+0x17c/0x1c8
[11760.227668] [<
ffffffc000642088>] usb_disconnect+0x9c/0x1d0
[11760.233188] [<
ffffffc00064389c>] hub_event+0x58c/0xde0
[11760.238483] [<
ffffffc000239260>] process_one_work+0x240/0x424
[11760.244659] [<
ffffffc000239cfc>] worker_thread+0x2fc/0x424
[11760.250569] [<
ffffffc00023f06c>] kthread+0x10c/0x114
[11760.255755] [<
ffffffc000203dd0>] ret_from_fork+0x10/0x40
[11760.261513] task PC stack pid father
[11760.268100] kworker/0:2 D
ffffffc000204fd8 0 1636 2 0x00000000
[11760.275603] Workqueue: usb_hub_wq hub_event
[11760.279915] Call trace:
[11760.282437] [<
ffffffc000204fd8>] __switch_to+0x9c/0xa8
[11760.287595] [<
ffffffc00090f754>] __schedule+0x440/0x6d8
[11760.292929] [<
ffffffc00090fa80>] schedule+0x94/0xb4
[11760.297893] [<
ffffffc000912bfc>] schedule_timeout+0x44/0x27c
[11760.303598] [<
ffffffc0009106d8>] wait_for_common+0xf8/0x198
[11760.309264] [<
ffffffc0009107a0>] wait_for_completion+0x28/0x34
[11760.315171] [<
ffffffc000674e40>] xhci_configure_endpoint+0x20c/0x4b0
[11760.321573] [<
ffffffc000675730>] xhci_check_bandwidth+0x1a4/0x324
[11760.327757] [<
ffffffc00064798c>] usb_hcd_alloc_bandwidth+0xb4/0x2c8
[11760.334094] [<
ffffffc00064a690>] usb_disable_device+0x17c/0x1c8
[11760.340119] [<
ffffffc000642088>] usb_disconnect+0x9c/0x1d0
[11760.345663] [<
ffffffc00064389c>] hub_event+0x58c/0xde0
[11760.350809] [<
ffffffc000239260>] process_one_work+0x240/0x424
[11760.356549] [<
ffffffc000239cfc>] worker_thread+0x2fc/0x424
[11760.362090] [<
ffffffc00023f06c>] kthread+0x10c/0x114
[11760.367055] [<
ffffffc000203dd0>] ret_from_fork+0x10/0x40
[11760.372374] kworker/1:1 D
ffffffc000204fd8 0 5743 2 0x00000000
[11760.379456] Workqueue: events dwc3_rockchip_otg_extcon_evt_work
[11760.385443] Call trace:
[11760.387893] [<
ffffffc000204fd8>] __switch_to+0x9c/0xa8
[11760.393035] [<
ffffffc00090f754>] __schedule+0x440/0x6d8
[11760.398256] [<
ffffffc00090fa80>] schedule+0x94/0xb4
[11760.403134] [<
ffffffc00090fe04>] schedule_preempt_disabled+0x28/0x44
[11760.409487] [<
ffffffc0009118c0>] __mutex_lock_slowpath+0x120/0x1ac
[11760.415664] [<
ffffffc000911998>] mutex_lock+0x4c/0x68
[11760.420714] [<
ffffffc000642048>] usb_disconnect+0x5c/0x1d0
[11760.426200] [<
ffffffc0006465f8>] usb_remove_hcd+0xc8/0x1e0
[11760.431691] [<
ffffffc00065d048>] dwc3_rockchip_otg_extcon_evt_work+0x134/0x178
[11760.438911] [<
ffffffc000239260>] process_one_work+0x240/0x424
[11760.444739] [<
ffffffc000239cfc>] worker_thread+0x2fc/0x424
[11760.450230] [<
ffffffc00023f06c>] kthread+0x10c/0x114
[11760.455196] [<
ffffffc000203dd0>] ret_from_fork+0x10/0x40
TEST=do plug/unplug USB-C HUB with a USB3 flash drive,
check if kernel blocked for more than 120 seconds.
Change-Id: Ib37009c185a2cad6f4671c6a858a737c2ccef1e8
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>