From: Greg KH <gregkh@suse.de>
To: linux-fbdev@vger.kernel.org
Subject: Re: [PATCH 3/10] udlfb: pre-allocated urb list helpers
Date: Fri, 19 Feb 2010 00:36:14 +0000 [thread overview]
Message-ID: <20100219003614.GB29873@suse.de> (raw)
In-Reply-To: <1266245155.4353.3298.camel@bernie-aspireone>
On Thu, Feb 18, 2010 at 02:32:35PM -0800, Bernie Thompson wrote:
> Hi Greg,
>
> On Thu, Feb 18, 2010 at 7:54 AM, Greg KH <greg@kroah.com> wrote:
> > I'm not going to reject this patch, but are you sure about this being
> > needed? The code path for creating a new urb is very tiny, just a
> > memory allocation. Is that really noticable in any benchmarks or cpu
> > usage that you have found?
>
> You're definitely right, from a performance standpoint, allocating a
> fresh urb/buffer each
> transfer itself wouldn't be a problem. The big perf win here, over the
> older udlfb code, is
> the asynchronous dispatch and being able to have several urbs in flight
> at once, not the pre-allocation itself.
>
> I actually implemented it first with alloc/free for each transfer
> (http://git.plugable.com/gitphp/index.php?p=udlfb&a=commit&h
4fa3b22580fd1532d06292e9061b9b2057f6a6),
> but freeing the associated buffer during completion generated WARN_ONs
> during each transfer.
>
> Google background on the problem I hit (lots of others hitting, too):
> http://www.google.com/search?q=Linux+WARN_ON+dma_free_coherent
Ick, that's not good.
> I thought about working around by queuing up a deferred op to free
> buffers outside of interrupt context, but that raised overhead
> concerns and leak concerns.
You can just have the urb framework purge the memory when it is finished
automatically, right? What's wrong with that, it should work for what
you need.
> So that led to the current udlfb implementation, which is a pretty
> common and efficient pattern, in the drivers I've known. And it's
> well tested at this point.
Yeah, because it's a common pattern, it either:
- needs to be in the usb core so people don't keep duplicating
it everywhere
- removed because there is a better and simpler way.
Right now I'm thinking the latter, as the urb can be dynamically handled
including the buffer attached to it. We also have urb "anchors" to
handle disconnecting devices for dynamic urbs, so this should all be
handled.
But we can discuss this on the linux-usb list, not here :)
thanks,
greg k-h
next prev parent reply other threads:[~2010-02-19 0:36 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-15 14:45 [PATCH 3/10] udlfb: pre-allocated urb list helpers Bernie Thompson
2010-02-18 15:54 ` Greg KH
2010-02-18 22:32 ` Bernie Thompson
2010-02-19 0:36 ` Greg KH [this message]
2010-02-19 2:22 ` Bernie Thompson
2010-03-09 20:58 ` Greg KH
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=20100219003614.GB29873@suse.de \
--to=gregkh@suse.de \
--cc=linux-fbdev@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 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).