public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* usb: gadget: f_fs: O_NONBLOCK waits MAX_SCHEDULE_TIMEOUT
@ 2015-03-31 18:53 Baxter, Jim
  2015-03-31 20:28 ` Felipe Balbi
  2015-04-01  8:06 ` Robert Baldyga
  0 siblings, 2 replies; 9+ messages in thread
From: Baxter, Jim @ 2015-03-31 18:53 UTC (permalink / raw)
  To: linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org
  Cc: Zapolskiy, Vladimir

Hi,

I have been looking at an issue where a phone that is the Function FS
host sometimes locks up and causes the function:
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.

We are opening the ffs connection with the O_NONBLOCK option and this
timeout seems to be far too long.

The code causing the wait is here (line 834):

if (unlikely(ret < 0)) {
    /* nop */
} else if (unlikely(
        wait_for_completion_interruptible(&done))) {
    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?

Thank you,
Jim

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2015-06-02  3:01 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-31 18:53 usb: gadget: f_fs: O_NONBLOCK waits MAX_SCHEDULE_TIMEOUT Baxter, Jim
2015-03-31 20:28 ` Felipe Balbi
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox