All of lore.kernel.org
 help / color / mirror / Atom feed
From: Felipe Balbi <felipe.balbi@linux.intel.com>
To: John Stultz <john.stultz@linaro.org>,
	lkml <linux-kernel@vger.kernel.org>
Cc: John Stultz <john.stultz@linaro.org>,
	Wei Xu <xuwei5@hisilicon.com>, Guodong Xu <guodong.xu@linaro.org>,
	Amit Pundir <amit.pundir@linaro.org>,
	Rob Herring <robh+dt@kernel.org>,
	John Youn <johnyoun@synopsys.com>,
	Douglas Anderson <dianders@chromium.org>,
	Chen Yu <chenyu56@huawei.com>,
	Vardan Mikayelyan <mvardan@synopsys.com>,
	Kishon Vijay Abraham I <kishon@ti.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-usb@vger.kernel.org
Subject: Re: [PATCH 1/4 v3] usb: dwc2: Avoid sleeping while holding hsotg->lock
Date: Mon, 16 Jan 2017 12:36:11 +0200	[thread overview]
Message-ID: <87shojmgv8.fsf@linux.intel.com> (raw)
In-Reply-To: <1484180524-4087-2-git-send-email-john.stultz@linaro.org>

[-- Attachment #1: Type: text/plain, Size: 2930 bytes --]


Hi,

John Stultz <john.stultz@linaro.org> writes:
> Basically when plugging in various cables in different orders, I'm
> occasionally seeing the following BUG splat:
>
> [   86.215403] BUG: scheduling while atomic: kworker/u16:2/53/0x00000002
> [   86.219164] usb 1-1: USB disconnect, device number 9
> [   86.226845] Preemption disabled at:[   86.230218]
> [<ffffff8008673558>] dwc2_conn_id_status_change+0x120/0x250
> [   86.236894] CPU: 0 PID: 53 Comm: kworker/u16:2 Tainted: G        W
>      4.9.0-rc8-00051-gd5a7979-dirty #1702
> [   86.246836] Hardware name: HiKey Development Board (DT)
> [   86.252100] Workqueue: dwc2 dwc2_conn_id_status_change
> [   86.257279] Call trace:
> [   86.259771] [<ffffff8008087c28>] dump_backtrace+0x0/0x1a0
> [   86.265210] [<ffffff8008087ddc>] show_stack+0x14/0x20
> [   86.270308] [<ffffff80084343f0>] dump_stack+0x90/0xb0
> [   86.275401] [<ffffff80080d8d94>] __schedule_bug+0x6c/0xb8
> [   86.280841] [<ffffff8008a07220>] __schedule+0x4f8/0x5b0
> [   86.286099] [<ffffff8008a073e8>] schedule+0x38/0xa0
> [   86.291017] [<ffffff8008a0a6cc>] schedule_hrtimeout_range_clock+0x8c/0xf0
> [   86.297846] [<ffffff8008a0a740>] schedule_hrtimeout_range+0x10/0x18
> [   86.304150] [<ffffff8008a0a4a0>] usleep_range+0x50/0x58
> [   86.309418] [<ffffff800866d8dc>] dwc2_wait_for_mode.isra.4+0x54/0xd0
> [   86.315815] [<ffffff800866f058>] dwc2_core_reset+0xe0/0x168
> [   86.321431] [<ffffff800867e364>] dwc2_hsotg_core_init_disconnected+0x2c/0x310
> [   86.328602] [<ffffff8008673568>] dwc2_conn_id_status_change+0x130/0x250
> [   86.335254] [<ffffff80080ccd48>] process_one_work+0x118/0x370
> [   86.341035] [<ffffff80080ccfe8>] worker_thread+0x48/0x498
> [   86.346473] [<ffffff80080d2eb0>] kthread+0xd0/0xe8
> [   86.351299] [<ffffff8008082e80>] ret_from_fork+0x10/0x50
>
> This seems to be caused by the dwc2_wait_for_mode() calling
> usleep_range() while the hstog->lock spinlock is held, since
> we take that before calling dwc2_hsotg_core_init_disconnected().
>
> This patch avoids the issue by adding an extra argument to
> dwc2_core_reset(), as suggested by John Youn, which allows us to
> skip the waiting, which should be unnecessary when calling from
> dwc2_hsotg_core_init_disconnected().
>
> Cc: Wei Xu <xuwei5@hisilicon.com>
> Cc: Guodong Xu <guodong.xu@linaro.org>
> Cc: Amit Pundir <amit.pundir@linaro.org>
> Cc: Rob Herring <robh+dt@kernel.org>
> Cc: John Youn <johnyoun@synopsys.com>
> Cc: Douglas Anderson <dianders@chromium.org>
> Cc: Chen Yu <chenyu56@huawei.com>
> Cc: Vardan Mikayelyan <mvardan@synopsys.com>
> Cc: Kishon Vijay Abraham I <kishon@ti.com>
> Cc: Felipe Balbi <felipe.balbi@linux.intel.com>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: linux-usb@vger.kernel.org
> Signed-off-by: John Stultz <john.stultz@linaro.org>
> ---

doesn't apply to my testing/next. Please rebase

-- 
balbi

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

  reply	other threads:[~2017-01-16 10:38 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-12  0:22 [PATCH 0/4 v3] Fixes and workarounds for dwc2 on HiKey board (rebased to synopsys-usb/next) John Stultz
2017-01-12  0:22 ` [PATCH 1/4 v3] usb: dwc2: Avoid sleeping while holding hsotg->lock John Stultz
2017-01-16 10:36   ` Felipe Balbi [this message]
2017-01-16 20:37     ` John Stultz
2017-01-16 20:57       ` John Youn
2017-01-16 23:28         ` John Stultz
2017-01-12  0:22 ` [PATCH 2/4 v3] usb: dwc2: Workaround case where GOTGCTL state is wrong John Stultz
2017-01-12  0:22 ` [PATCH 3/4 v3] usb: dwc2: Force port resume on switching to device mode John Stultz
2017-01-12  0:22 ` [PATCH 4/4 v3] usb: dwc2: Add a quirk to allow speed negotiation for Hisilicon Hi6220 John Stultz
2017-01-12  2:04 ` [PATCH 0/4 v3] Fixes and workarounds for dwc2 on HiKey board (rebased to synopsys-usb/next) John Youn
2017-01-12  8:05   ` Felipe Balbi
2017-01-12 19:23     ` John Youn
2017-01-12 19:30     ` John Stultz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87shojmgv8.fsf@linux.intel.com \
    --to=felipe.balbi@linux.intel.com \
    --cc=amit.pundir@linaro.org \
    --cc=chenyu56@huawei.com \
    --cc=dianders@chromium.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=guodong.xu@linaro.org \
    --cc=john.stultz@linaro.org \
    --cc=johnyoun@synopsys.com \
    --cc=kishon@ti.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mvardan@synopsys.com \
    --cc=robh+dt@kernel.org \
    --cc=xuwei5@hisilicon.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.