From: Ingo Rohloff <ingo.rohloff@lauterbach.com>
To: Greg KH <gregkh@linuxfoundation.org>
Cc: balbi@kernel.org, linux-usb@vger.kernel.org
Subject: Re: [PATCH 0/2] usb: gadget: User space URBs for FunctionFS
Date: Fri, 13 Nov 2020 16:20:45 +0100 [thread overview]
Message-ID: <20201113161753.55588bcf@ingxiaomi.fritz.box> (raw)
In-Reply-To: <X66WIqMoGWLUyraz@kroah.com>
Hi Greg,
> The gadget code has always used AIO since the very beginning, this is
> nothing new (decades old). While it might feel "odd", I recommend
> working with it first before trying to create new kernel apis that
> duplicate existing functionality for the only reason being that AIO is
> "different".
Forget my patch: You are right: I am now convinced, that using the AIO
of the kernel should really provide the same.
For me it was the other way round: I wrote code talking to "devio.c" on
the USB Host and using "ioctl"; so that sounded natural to me.
I think "devio.c" does not support async I/O ?
So when starting, I was not aware at all that the gadget side supports
AIO; and then I got misled by the POSIX aio interface (which did hide
the native Linux aio system calls from me.)
The "bug" I found is a bug in the example code (not in the kernel)
as far as I can tell.
The other thing I want in the future:
> > > The final goal here is to be able to directly let user space
> > > provide data buffers (via mmap I guess), which are then
> > > transferred via USB; but this is the next step.
>
> > Isn't that kind of what the AIO inteface provides today? :)
>
> I think my explanation was not clear at all:
> What I want to have is a "zero copy" transfer.
I now think this can be implemented within the already existing
AIO framework in f_fs.c by implementing a suitable mmap call.
But before doing any of that I need test code.
So my plan right now:
- Write a working (fast) echo example using libaio
- Write a working (fast) echo example using liburing
(https://github.com/axboe/liburing)
because this should result in even faster AIO.
Another big reason for not doing extra ioctls;
using the existing AIO framework in the kernel
should allow to use liburing :)
- Once I have done that I will look into extending
f_fs.c with a mmap call so that complete zero copy
transfers to/from USB bulk endpoints should become possible.
Then I should be able to do some performance tests via USB 3.0
to see how much this helps.
I will post again once I have some working code.
Thank you for your time and comments;
that really helps me to find a better solution :-)
so long
Ingo
PS: Not important:
> > https://pagure.io/libaio
> > version 0.3.111
>
> I do not know if this is the latest one or not, sorry. Ask your Linux
> distro about this, or use the "raw" kernel aio syscalls.
Thanks to gentoo, I found out there is
https://releases.pagure.org/libaio/
and this one has the 0.3.112 release; and of course there is always the
git repository (which unfortunately does not include tags for anything
more recent than 0.3.110).
prev parent reply other threads:[~2020-11-13 15:20 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-11 17:07 [PATCH 0/2] usb: gadget: User space URBs for FunctionFS Ingo Rohloff
2020-11-11 17:07 ` [PATCH 1/2] usb: gadget: ffs: Implement user URBs for USB bulk endpoints Ingo Rohloff
2020-11-15 10:59 ` kernel test robot
2020-11-15 10:59 ` [RFC PATCH] usb: gadget: ffs: async_bulkurb_active_lock can be static kernel test robot
2020-11-11 17:07 ` [PATCH 2/2] usb: gadget: ffs: tools: test applications for user URBs Ingo Rohloff
2020-11-11 18:40 ` [PATCH 0/2] usb: gadget: User space URBs for FunctionFS Greg KH
2020-11-12 17:05 ` Ingo Rohloff
2020-11-13 14:20 ` Greg KH
2020-11-13 15:20 ` Ingo Rohloff [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=20201113161753.55588bcf@ingxiaomi.fritz.box \
--to=ingo.rohloff@lauterbach.com \
--cc=balbi@kernel.org \
--cc=gregkh@linuxfoundation.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 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).