From: Mathias Nyman <mathias.nyman@linux.intel.com>
To: David Laight <David.Laight@ACULAB.COM>,
"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>
Cc: "sarah.a.sharp@linux.intel.com" <sarah.a.sharp@linux.intel.com>,
"dan.j.williams@intel.com" <dan.j.williams@intel.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [RFC 00/10] xhci: re-work command queue management
Date: Wed, 15 Jan 2014 17:43:56 +0200 [thread overview]
Message-ID: <52D6ACBC.2090700@linux.intel.com> (raw)
In-Reply-To: <063D6719AE5E284EB5DD2968C1650D6D45B31F@AcuExch.aculab.com>
On 01/14/2014 02:37 PM, David Laight wrote:
> From: Mathias Nyman
> ...
>>> The fact that you are having to allocate memory ion an ISR ought also to be
>>> ringing alarm bells.
>>
>> It did.
>> Other options are as you said to use a 'software command ring'. Either
>> just pre-allocate a full command ring (64 trbs * sizeof(struct
>> xhci_command)), roughly 2300 bytes when driver loads,
>> or then a smaller pool of commands just used for ISR submitted commands.
>> (We then need to either either expand pool, or start allocating in isr
>> if pool is empty)
>
> If you pre-allocate mapping 1-1 with the command ring entries
> you don't need many of the fields of xhci_command at all.
> So the allocated size will be much smaller.
True, then the struct list_head could be removed.
Even the trb pointer could be removed if the command ring stays in one
segment(just use the trb - base as an index )
...
> Looking at the number of fields in xci_command, why do you need the
> caller to pass a structure at all?
> Just make the fields parameters to the 'send a command' function
> along with a parameter that says whether it can sleep (in kmalloc()
> or if the ring is full depending on the implementation).
Command completion events only tell which trb completed and its status.
The structure is needed to map the trb to the right completion so that
the caller can continue running, check status and move on.
The xhci_command fields forISR allocated commands are really not used
that much. Only status is used if the command timeouts. But we want
these command structures on the command list to make sure eveything else
works (timeout works, commands completion events are in the same order
as commands on our command list etc)
So in a way we're allocating memory in ISR which is not really even used.
I'll try to create something to that avoid that
-Mathias
next prev parent reply other threads:[~2014-01-15 15:35 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-13 15:05 [RFC 00/10] xhci: re-work command queue management Mathias Nyman
2014-01-13 15:05 ` [RFC 01/10] xhci: Use command structures when calling xhci_configure_endpoint Mathias Nyman
2014-01-13 15:05 ` [RFC 02/10] xhci: use a command structure internally in xhci_address_device() Mathias Nyman
2014-01-13 15:05 ` [RFC 03/10] xhci: use command structures for xhci_queue_slot_control() Mathias Nyman
2014-01-13 15:05 ` [RFC 04/10] xhci: use command structures for xhci_queue_stop_endpoint() Mathias Nyman
2014-01-13 15:05 ` [RFC 05/10] xhci: use command structure for xhci_queue_new_dequeue_state() Mathias Nyman
2014-01-13 15:05 ` [RFC 06/10] xhci: use command structures for xhci_queue_reset_ep() Mathias Nyman
2014-01-13 15:05 ` [RFC 07/10] xhci: Use command structured when queuing commands Mathias Nyman
2014-01-13 15:05 ` [RFC 08/10] xhci: Add a global command queue Mathias Nyman
2014-01-13 15:05 ` [RFC 09/10] xhci: Use completion and status in " Mathias Nyman
2014-01-13 15:05 ` [RFC 10/10] xhci: rework command timeout and cancellation, Mathias Nyman
2014-01-13 16:58 ` [RFC 00/10] xhci: re-work command queue management David Laight
2014-01-14 12:05 ` Mathias Nyman
2014-01-14 12:37 ` David Laight
2014-01-15 15:43 ` Mathias Nyman [this message]
2014-01-27 23:58 ` Sarah Sharp
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=52D6ACBC.2090700@linux.intel.com \
--to=mathias.nyman@linux.intel.com \
--cc=David.Laight@ACULAB.COM \
--cc=dan.j.williams@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=sarah.a.sharp@linux.intel.com \
/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).