All of lore.kernel.org
 help / color / mirror / Atom feed
From: Felipe Balbi <felipe.balbi@linux.intel.com>
To: Alan Stern <stern@rowland.harvard.edu>, Roger Quadros <rogerq@ti.com>
Cc: Lars-Peter Clausen <lars@metafoo.de>,
	Sam Protsenko <semen.protsenko@linaro.org>,
	Vincent Pelletier <plr.vincent@gmail.com>,
	linux-usb@vger.kernel.org, Praneeth Bajjuri <praneeth@ti.com>
Subject: usb: gadget: ffs: Fix BUG when userland exits with submitted AIO transfers
Date: Fri, 29 Jun 2018 09:32:43 +0300	[thread overview]
Message-ID: <871scqf6gk.fsf@linux.intel.com> (raw)

Hi,

Alan Stern <stern@rowland.harvard.edu> writes:
> On Thu, 21 Jun 2018, Roger Quadros wrote:
>
>> >> Can we avoid the spin_lock() and the work-queue and call usb_ep_dequeue() directly from here?
>> >>> What is the purpose of the spin_lock()?
>> > 
>> > I agree that the lock doesn't seem to be necessary. But I believe the whole
>> > thing is already running in non-sleeping context, even before the spinlock
>> > is taken. So this wouldn't help much.
>> > 
>> > Even the io_cancel() syscall takes a spinlock before invoking the cancel
>> > function. So this issue is not exclusive to program termination.
>> > 
>> > Are there any documented guidelines on which context usb_ep_dequeue() should
>> > be able to be called in? The sleep in the dwc3 driver seems to be a recent
>> > addition.
>> 
>> drivers/usb/udc/gadget/core.c has the only documentation, but context is not mentioned there.
>> Felipe, what do you suggest?
>
> As far as I remember, usb_ep_dequeue() is supposed to be more or less 
> analogous to usb_ep_queue(); drivers should be allowed to call either 
> routine in an atomic context.

Hmm, that's what I remember, but we don't have that documented and dwc3
has a sleep in its dequeue, which I need to remove for other reasons
anyway.

Can we get a patch updating documentation to make it clear that both
queue and dequeue should be callable from any context?

             reply	other threads:[~2018-06-29  6:32 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-29  6:32 Felipe Balbi [this message]
  -- strict thread matches above, loose matches on Subject: below --
2019-01-17 16:29 usb: gadget: ffs: Fix BUG when userland exits with submitted AIO transfers Evan Green
2019-01-16 23:56 Evan Green
2018-10-23 14:22 Lars-Peter Clausen
2018-10-23 12:20 Lars-Peter Clausen
2018-09-27  2:31 He, Bo
2018-09-25 12:46 Vincent Pelletier
2018-08-02 14:23 Vincent Pelletier
2018-08-02  0:45 He, Bo
2018-08-01 15:03 Vincent Pelletier
2018-06-21 15:30 Alan Stern
2018-06-21 11:10 Roger Quadros
2018-06-21 10:52 Lars-Peter Clausen
2018-06-21  8:29 Roger Quadros
2018-06-19 13:20 Sam Protsenko
2018-06-14 13:23 Sam Protsenko
2018-06-13 11:05 Vincent Pelletier

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=871scqf6gk.fsf@linux.intel.com \
    --to=felipe.balbi@linux.intel.com \
    --cc=lars@metafoo.de \
    --cc=linux-usb@vger.kernel.org \
    --cc=plr.vincent@gmail.com \
    --cc=praneeth@ti.com \
    --cc=rogerq@ti.com \
    --cc=semen.protsenko@linaro.org \
    --cc=stern@rowland.harvard.edu \
    /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.