All of lore.kernel.org
 help / color / mirror / Atom feed
From: Felipe Balbi <balbi@ti.com>
To: "Baxter, Jim" <jim_baxter@mentor.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	"Zapolskiy, Vladimir" <Vladimir_Zapolskiy@mentor.com>
Subject: Re: usb: gadget: f_fs: O_NONBLOCK waits MAX_SCHEDULE_TIMEOUT
Date: Tue, 31 Mar 2015 15:28:34 -0500	[thread overview]
Message-ID: <20150331202834.GA16918@saruman.tx.rr.com> (raw)
In-Reply-To: <551AED33.2040206@mentor.com>

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

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):
> 
> 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 = -EINTR;
>     usb_ep_dequeue(ep->ep, req);
> } else {
> 
> The function call wait_for_completion_interruptible(&done) equates to:
> wait_for_completion_interruptible_timeout(&done, MAX_SCHEDULE_TIMEOUT);
> 
> 
> 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?
> 
> 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

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  reply	other threads:[~2015-03-31 20:29 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-31 18:53 usb: gadget: f_fs: O_NONBLOCK waits MAX_SCHEDULE_TIMEOUT Baxter, Jim
2015-03-31 20:28 ` Felipe Balbi [this message]
2015-04-01  8:06 ` Robert Baldyga
2015-04-01 17:29   ` Baxter, Jim
2015-04-02  0:23     ` Peter Chen
2015-05-22 11:12       ` Baxter, Jim
2015-05-25  1:55         ` Peter Chen
2015-06-01 16:25           ` Baxter, Jim
2015-06-02  3:01             ` Peter Chen

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=20150331202834.GA16918@saruman.tx.rr.com \
    --to=balbi@ti.com \
    --cc=Vladimir_Zapolskiy@mentor.com \
    --cc=jim_baxter@mentor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    /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.