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: Tue, 14 Jan 2014 14:05:51 +0200 [thread overview]
Message-ID: <52D5281F.4080108@linux.intel.com> (raw)
In-Reply-To: <063D6719AE5E284EB5DD2968C1650D6D45938C@AcuExch.aculab.com>
>
> IMHO the xhci driver is already far too complicated, and this probably just makes
> it even worse.
This is an attempt to make it cleaner and less complicated.
In the end this series removes far more more code than it adds:
5 files changed, 373 insertions(+), 530 deletions(-)
The timers are also simplified, so now we only have one timeout timer
instead of each command running its own timer.
>
> 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)
These solutions require some ring management and possibly expansion
code, and increases the complexity again. I selected this simpler
approach as I understood that the frequency of commands allocated in ISR
is quite low.
This also feels like trying to optimize before we get the main
changes working.
>
> Have you considered adding a 'software command ring' (indexed with the
> same value as the hardware one) and using it to hold additional parameters?
>
> It might even be worth only putting a single command into the hardware ring!
> That might simplify the timer code.
This is something I haven't thought about. Could be one possibility, but
feels like artificially restricting something the HW is designed to care
of. The timer code isn't that complex anyway. In addition to init/exit
parts we basically got:
queue_command(...)
{
if (command list is empty)
/* start timer for new command added to empty list*/
mod_timer(cmd_timer, timeout);
}
handle_cmd_completion(...) /* in ISR */
{
/* A commandcompleted, remove timeout timer */
del_timer(cmd_timer)
do_other_stuff
if(more commands in list)
mod_timer(cmd_timer, timeout); /* start timer for next command */
}
>
> This still has a fixed constraint on the number of queued commands, but
> I suspect that is bounded anyway (a few per device?).
64 commands fit on the command ring segment, I'm not aware of any
per-device limits?
Thanks for the comments and ideas
-Mathias
next prev parent reply other threads:[~2014-01-14 11:57 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 [this message]
2014-01-14 12:37 ` David Laight
2014-01-15 15:43 ` Mathias Nyman
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=52D5281F.4080108@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).