From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932558AbbCaU3z (ORCPT ); Tue, 31 Mar 2015 16:29:55 -0400 Received: from arroyo.ext.ti.com ([192.94.94.40]:32932 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752918AbbCaU3e (ORCPT ); Tue, 31 Mar 2015 16:29:34 -0400 Date: Tue, 31 Mar 2015 15:28:34 -0500 From: Felipe Balbi To: "Baxter, Jim" CC: "linux-kernel@vger.kernel.org" , "linux-usb@vger.kernel.org" , "Zapolskiy, Vladimir" Subject: Re: usb: gadget: f_fs: O_NONBLOCK waits MAX_SCHEDULE_TIMEOUT Message-ID: <20150331202834.GA16918@saruman.tx.rr.com> Reply-To: References: <551AED33.2040206@mentor.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="4Ckj6UjgE2iN1+kY" Content-Disposition: inline In-Reply-To: <551AED33.2040206@mentor.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --4Ckj6UjgE2iN1+kY Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi, (it helps if you Cc the maintainer too :-) On Tue, Mar 31, 2015 at 07:53:39PM +0100, Baxter, Jim wrote: > I have been looking at an issue where a phone that is the Function FS > host sometimes locks up and causes the function: which USB controller ? which kernel ? which platform ? > static ssize_t ffs_epfile_io(struct file *file, struct ffs_io_data > *io_data) in drivers/usb/gadget/function/f_fs.c to timeout after > MAX_SCHEDULE_TIMEOUT jiffies. yeah, that's pretty much "never timeout" :-) > We are opening the ffs connection with the O_NONBLOCK option and this > timeout seems to be far too long. is this your own application ? How can I make sure it's correct ? > The code causing the wait is here (line 834): >=20 > if (unlikely(ret < 0)) { > /* nop */ > } else if (unlikely( > wait_for_completion_interruptible(&done))) { right, this is waiting for the previous usb_ep_queue() to complete. Why hasn't it completed yet ? Do you have a USB sniffer to check if data has passed over the wire ? Did the host shifted any token in the wire trying to move data around ? > ret =3D -EINTR; > usb_ep_dequeue(ep->ep, req); > } else { >=20 > The function call wait_for_completion_interruptible(&done) equates to: > wait_for_completion_interruptible_timeout(&done, MAX_SCHEDULE_TIMEOUT); >=20 >=20 > I was wondering what to change to fix this, is it reasonable to use a > very small timeout if it is O_NONBLOCK or is any blocking not allowed? >=20 > I would appreciate any thoughts on how this should work? sounds like a bug on your USB peripheral controller driver. Which one is that ? Again, which kernel ? Where are the logs ? regards --=20 balbi --4Ckj6UjgE2iN1+kY Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJVGwNyAAoJEIaOsuA1yqREpTwQAJHNUHVBVabKVHfa/CrgYNYo BfdjAN/tplPiHxxlqJ4WBNnbrU0D48ajffdxWZDbShOARrZtBpOhgCUCmVGIg4tH G5rO0325eqHgsas+OOh3Xw1hKlZmiIGerzUj3U6G79FAVMtjrMmwKeumoVrTdGxe wvw4SD+bcebwtHRzC7sQ84ngPehJeaAT9JgyBwY4uB8nhv8R3lyBb+hI4/hWV3uc bect+2WElLCzY3e5NQe6rRRcqfOKue5pOgQv4U7vWrCuxpfMecMj3if2cy1LQhcf NP9Y3hpqem/290ysXH6m3e7FY8QYNzMLb+wikjWJRxz/cGmbDUupbSmRGb0mxaVO GBsMgM2z3hTleHom3CxzIW54YRwLm7gW/TvXDdptNTlua1x9WTnGnjvx53PoV+a1 VQ9qip2f4XH5FcULAIYGHu68zPiZ4JNFzYUrCNmCtIlwkpgacEYaSQyFt7hTEdJ9 4O76u8UbqJDUZqOTS7EgwdpfGDfntZ99SqXAPfW1zBc9BQp2Crc1gJQaECKHEVk/ NnMQvACT15l3vWwh7RYPIoJqdeRLCuavgBV8uTTH++h/Le2/O3PZZ3FQ3UV42xE/ aGzuNiJBhNQVYtJIsIlKcNo4d0HEB9BmUchTnPqnTQdZwYCMto7LdyZQmmaKRrHC Ix4DBIx1neasLNHAsE68 =oAOB -----END PGP SIGNATURE----- --4Ckj6UjgE2iN1+kY--