Re: [PATCH v3] tools: usb: aio example applications

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Feb 06 2014, David Laight wrote:
> From: Michal Nazarewicz
>> On Tue, Feb 04 2014, Robert Baldyga wrote:
>> > This code is an example. Don't you think it would be better to keep it
>> > simple?
>>
>> PS. Of course another approach is to use two threads one for ep0 and the
>> other for transfers.  Yet another, is to add AIO to ep0 in the kernel.
>
> I didn't look closely enough into the internals to see what this is
> actually doing. but when you refer to AIO are you referring to some
> feature of the usb stack that queues up requests and then indicates
> that they have finished, or the more general aio_read() functions?

I'm referring to the latter.  Robert has added AIO support for the other
end point files and this example application shows how to deal with
them.  However, reading ffs' ep0 file from user space still requires
select/poll which apparently does not play well with io_getevents.  So
the way I see it, user space daemon using functionfs interface needs:
* at least two threads, one for handling ep0 data and
  the other for the other ep# files,
* a single thread and a clever use of signals sent by the AIO API (this
  will require use of ppoll or pselect), or
* busy waiting.

NB: I did not look at AIO user-space interface that closely to say
whether there's a better way of doing things.

> IIRC the latter use a thread to do a synchronous read since normal
> unix kernels are not designed to async io. The threads might be a
> limited kernel resource.

I don't think that's accurate.  Or at least not accurate for functionfs.
If you take a look at Robert's patch adding AIO support to
functionfs[1], you'll see that aio_read/aio_write simply queues a bunch
of USB transfers and returns.  Dose transfers are then handled like any
other USB transfers would.

[1] http://www.spinics.net/lists/linux-usb/msg101611.html

-- 
Best regards,                                         _     _
.o. | Liege of Serenely Enlightened Majesty of      o' \,=./ `o
..o | Computer Science,  Michał “mina86” Nazarewicz    (o o)
ooo +--<mpn@xxxxxxxxxx>--<xmpp:mina86@xxxxxxxxxx>--ooO--(_)--Ooo--

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux