From: Felipe Balbi <balbi@ti.com>
To: Andreas Larsson <andreas@gaisler.com>
Cc: balbi@ti.com, linux-usb@vger.kernel.org,
Alan Stern <stern@rowland.harvard.edu>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
software@gaisler.com,
Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Subject: Re: [PATCH] usb: gadget: Add UDC driver for Aeroflex Gaisler GRUSBDC
Date: Tue, 26 Nov 2013 11:43:42 -0600 [thread overview]
Message-ID: <20131126174342.GT24310@saruman.home> (raw)
In-Reply-To: <526E5F96.9090904@gaisler.com>
[-- Attachment #1: Type: text/plain, Size: 3720 bytes --]
On Mon, Oct 28, 2013 at 01:59:02PM +0100, Andreas Larsson wrote:
> On 2013-10-01 16:19, Felipe Balbi wrote:
> >>>>+static void gr_finish_request(struct gr_ep *ep, struct gr_request *req,
> >>>>+ int status)
> >>>>+{
> >>>>+ struct gr_udc *dev;
> >>>>+
> >>>>+ list_del_init(&req->queue);
> >>>>+
> >>>>+ if (likely(req->req.status == -EINPROGRESS))
> >>>>+ req->req.status = status;
> >>>>+ else
> >>>>+ status = req->req.status;
> >>>>+
> >>>>+ dev = ep->dev;
> >>>>+ usb_gadget_unmap_request(&dev->gadget, &req->req, ep->is_in);
> >>>>+ gr_free_dma_desc_chain(dev, req);
> >>>>+
> >>>>+ if (ep->is_in) /* For OUT, actual gets updated by the work handler */
> >>>>+ req->req.actual = req->req.length;
> >>>>+
> >>>>+ if (!status) {
> >>>>+ if (ep->is_in)
> >>>>+ gr_dbgprint_request("SENT", ep, req);
> >>>>+ else
> >>>>+ gr_dbgprint_request("RECV", ep, req);
> >>>>+ }
> >>>>+
> >>>>+ /* Prevent changes to ep->queue during callback */
> >>>>+ ep->callback = 1;
> >>>>+ if (req == dev->ep0reqo && !status) {
> >>>>+ if (req->setup)
> >>>>+ gr_ep0_setup(dev, req);
> >>>>+ else
> >>>>+ dev_err(dev->dev,
> >>>>+ "Unexpected non setup packet on ep0in\n");
> >>>>+ } else if (req->req.complete) {
> >>>>+ unsigned long flags;
> >>>>+
> >>>>+ /* Complete should be called with irqs disabled */
> >>>>+ local_irq_save(flags);
> >>>
> >>>I guess it'd be better if you called this with spin_lock_irqsave()
> >>>called before, then you can remove local_irq_save from here.
> >>
> >>That would increase the amount of time interrupts are disabled quite a
> >>lot, so I would prefer not to.
> >
> >that's what every other UDC driver is doing. I don't think you need to
> >worry about that. Can you run some benchmarks with both constructs just
> >so I can have peace of mind ?
>
> Hi!
>
> My benchmark shows 20%+ performance loss both for mass storage running
> on this driver and for concurrent ethernet traffic and cpu bound tasks
> running with this change. In addition the code becomes messier as some
> spin locks disables interrupts and some do not depending on wich paths
> might lead to a call to complete. So I'll stick to not disabling
> interrupts until disabled interrupts are actually needed.
>
> >>>>+static irqreturn_t gr_irq(int irq, void *_dev)
> >>>>+{
> >>>>+ struct gr_udc *dev = _dev;
> >>>>+
> >>>>+ if (!dev->irq_enabled)
> >>>>+ return IRQ_NONE;
> >>>>+
> >>>>+ schedule_work(&dev->work);
> >>>
> >>>why do you need this ? We have threaded IRQ handlers. Why a workqueue ?
> >>
> >>As mentioned above, to to be able to schedule work after pausing
> >>endpoint handling during a completion callback call or during an
> >>endpoint halt.
> >
> >doesn't look like you need that work_struct at all. Handle your IRQ
> >directly and for the pieces you need to do after ClearHalt, re-factor
> >that to a separate function which you call conditionally on
> >->set_halt().
>
> For some reason, the performance suffers massively when switching to
> using threaded interrupts instead of the current solution using the work
> queue. The times to complete large file transfers to the mass_storage
> gadget running on top of the udc are regularly around seven times longer
> using threaded interrupts complared to using the work queue
> solution. Unless you have any ideas here, I hope you can let the driver
> keep the work queue solution.
sorry for the long delay. That would point to a bug in threaded IRQ
handling and I believe Sebastian has looked over that in past,
Sebastian ? To answer your question, sorry, we don't want unnecessary
workqueues to be added :-s
cheers
--
balbi
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
prev parent reply other threads:[~2013-11-26 17:43 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-12 14:05 [PATCH] usb: gadget: Add UDC driver for Aeroflex Gaisler GRUSBDC Andreas Larsson
2013-08-28 9:02 ` Andreas Larsson
[not found] ` <521DBC9E.9080001-FkzTOoA/JUlBDgjK7y7TUQ@public.gmane.org>
2013-09-09 5:33 ` Andreas Larsson
2013-09-09 15:24 ` Greg Kroah-Hartman
[not found] ` <20130909152424.GA26404-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2013-09-18 1:46 ` Felipe Balbi
2013-09-18 17:15 ` Felipe Balbi
2013-10-01 8:34 ` Andreas Larsson
2013-10-01 14:19 ` Felipe Balbi
2013-10-02 8:52 ` Andreas Larsson
2013-10-10 15:38 ` Felipe Balbi
2013-10-28 12:59 ` Andreas Larsson
2013-11-26 17:43 ` Felipe Balbi [this message]
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=20131126174342.GT24310@saruman.home \
--to=balbi@ti.com \
--cc=andreas@gaisler.com \
--cc=bigeasy@linutronix.de \
--cc=devicetree@vger.kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=software@gaisler.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).