From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751535AbdAPKiQ (ORCPT ); Mon, 16 Jan 2017 05:38:16 -0500 Received: from mga09.intel.com ([134.134.136.24]:37932 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751078AbdAPKiN (ORCPT ); Mon, 16 Jan 2017 05:38:13 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,238,1477983600"; d="asc'?scan'208";a="809399275" From: Felipe Balbi To: John Stultz , lkml Cc: John Stultz , Wei Xu , Guodong Xu , Amit Pundir , Rob Herring , John Youn , Douglas Anderson , Chen Yu , Vardan Mikayelyan , Kishon Vijay Abraham I , Greg Kroah-Hartman , linux-usb@vger.kernel.org Subject: Re: [PATCH 1/4 v3] usb: dwc2: Avoid sleeping while holding hsotg->lock In-Reply-To: <1484180524-4087-2-git-send-email-john.stultz@linaro.org> References: <1484180524-4087-1-git-send-email-john.stultz@linaro.org> <1484180524-4087-2-git-send-email-john.stultz@linaro.org> Date: Mon, 16 Jan 2017 12:36:11 +0200 Message-ID: <87shojmgv8.fsf@linux.intel.com> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Hi, John Stultz 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] > [] 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] [] dump_backtrace+0x0/0x1a0 > [ 86.265210] [] show_stack+0x14/0x20 > [ 86.270308] [] dump_stack+0x90/0xb0 > [ 86.275401] [] __schedule_bug+0x6c/0xb8 > [ 86.280841] [] __schedule+0x4f8/0x5b0 > [ 86.286099] [] schedule+0x38/0xa0 > [ 86.291017] [] schedule_hrtimeout_range_clock+0x8c/0= xf0 > [ 86.297846] [] schedule_hrtimeout_range+0x10/0x18 > [ 86.304150] [] usleep_range+0x50/0x58 > [ 86.309418] [] dwc2_wait_for_mode.isra.4+0x54/0xd0 > [ 86.315815] [] dwc2_core_reset+0xe0/0x168 > [ 86.321431] [] dwc2_hsotg_core_init_disconnected+0x2= c/0x310 > [ 86.328602] [] dwc2_conn_id_status_change+0x130/0x250 > [ 86.335254] [] process_one_work+0x118/0x370 > [ 86.341035] [] worker_thread+0x48/0x498 > [ 86.346473] [] kthread+0xd0/0xe8 > [ 86.351299] [] 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 > Cc: Guodong Xu > Cc: Amit Pundir > Cc: Rob Herring > Cc: John Youn > Cc: Douglas Anderson > Cc: Chen Yu > Cc: Vardan Mikayelyan > Cc: Kishon Vijay Abraham I > Cc: Felipe Balbi > Cc: Greg Kroah-Hartman > Cc: linux-usb@vger.kernel.org > Signed-off-by: John Stultz > --- doesn't apply to my testing/next. Please rebase =2D-=20 balbi --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEElLzh7wn96CXwjh2IzL64meEamQYFAlh8ohsACgkQzL64meEa mQb5yhAAxRA8rfuc/00FkGnazA3Yi33MxKkgmAlSQf4Y05tnEqrtYducwWMbzqkl Ul06Dyc22diXzzsH/zA1dEXYjZCC77kNtZLX8ejuidYpl5OtpF7r5mkFDDTyf7dO TiXnqaItz8cOr0n+dLiY+Qea+A+ZOraUGLQaLtQK/HWocSl/2nScCagWRJbcg08S T9v1IkVlJJ6TUz1eMRDabkJaFbzoat68l7qYdI0wYn/C8pSWntjgpj7hNDP4hEKW OIOptqocGj1OUpWHkjq4m7doQE5ZreRDFKuKeEJ1tYh0AR2h2pHZAN6rBTSEvl2d qK1GLeDXnN+pxeq17BZIhOVOeyO9o6NzZA3e6RiQaTThEyE1mnnrHmEExEQyJZE0 MJd1lgUxgFtH9XhVLuskGpgPRY8RSq6poRNdmuV9iwJf1ykhdOaQ3HLdIW/MZc7R emSSe1RaK2oUYxWtfGRTHEqnTvqpue1JBFkD6JheUsbjoSTZebb0dLqSpRkPtrzp ERZWrXY/i15VffV2G0/RxgkLO6lwYT5Zs8K5XOerYvZwR8LnMBPu2RWjcH67ZTZ9 Rl1rBjLWSONUgUqVXqWKtDGINlV8iA+Z9DqHjmmFSBqCBCLpIcCRNiUxr/36MiLT xjaFe+msZ2DeXV7BoJeRM7vuU1NUshYa9+ZJciArw01BuKgZk4E= =Us8M -----END PGP SIGNATURE----- --=-=-=--