From: Mathias Nyman <mathias.nyman@linux.intel.com>
To: Dan Williams <dan.j.williams@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
USB list <linux-usb@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Sarah Sharp <sarah.a.sharp@linux.intel.com>
Subject: Re: [PATCH 07/10] xhci: Use command structures when queuing commands on the command ring
Date: Fri, 06 Jun 2014 11:14:40 +0300 [thread overview]
Message-ID: <53917870.8050604@linux.intel.com> (raw)
In-Reply-To: <CAA9_cmfhm_OEqk_5dX=j_9mFFmXZCPQmgszYeyQkKmBUgr-pRw@mail.gmail.com>
On 06/06/2014 01:16 AM, Dan Williams wrote:
> Hi Mathias, hit a small issue playing with -next:
>
> On Thu, May 8, 2014 at 9:26 AM, Mathias Nyman
> <mathias.nyman@linux.intel.com> wrote:
>> To create a global command queue we require that each command put on the
>> command ring is submitted with a command structure.
>>
>> Functions that queue commands and wait for completion need to allocate a command
>> before submitting it, and free it once completed. The following command queuing
>> functions need to be modified.
>>
>> xhci_configure_endpoint()
>> xhci_address_device()
>> xhci_queue_slot_control()
>> xhci_queue_stop_endpoint()
>> xhci_queue_new_dequeue_state()
>> xhci_queue_reset_ep()
>> xhci_configure_endpoint()
>>
>> xhci_configure_endpoint() could already be called with a command structure,
>> and only xhci_check_maxpacket and xhci_check_bandwidth did not do so. These
>> are changed and a command structure is now required. This change also simplifies
>> the configure endpoint command completion handling and the "goto bandwidth_change"
>> handling code can be removed.
>>
>> In some cases the command queuing function is called in interrupt context.
>> These commands needs to be allocated atomically, and they can't wait for
>> completion. These commands will in this patch be freed directly after queuing,
>> but freeing will be moved to the command completion event handler in a later
>> patch once we get the global command queue up.(Just so that we won't leak
>> memory in the middle of the patch set)
>>
>> Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
>> ---
>> drivers/usb/host/xhci-hub.c | 21 +++--
>> drivers/usb/host/xhci-ring.c | 107 +++++++++++++-----------
>> drivers/usb/host/xhci.c | 194 ++++++++++++++++++++++++++++---------------
>> drivers/usb/host/xhci.h | 31 +++----
>> 4 files changed, 216 insertions(+), 137 deletions(-)
>>
>> diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c
>> index 1ad6bc1..3ce9c0a 100644
>> --- a/drivers/usb/host/xhci-hub.c
>> +++ b/drivers/usb/host/xhci-hub.c
>> @@ -20,7 +20,8 @@
>> * Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
>> */
>>
>> -#include <linux/gfp.h>
>> +
>> +#include <linux/slab.h>
>> #include <asm/unaligned.h>
>>
>> #include "xhci.h"
>> @@ -284,12 +285,22 @@ static int xhci_stop_device(struct xhci_hcd *xhci, int slot_id, int suspend)
>>
>> spin_lock_irqsave(&xhci->lock, flags);
>> for (i = LAST_EP_INDEX; i > 0; i--) {
>> - if (virt_dev->eps[i].ring && virt_dev->eps[i].ring->dequeue)
>> - xhci_queue_stop_endpoint(xhci, slot_id, i, suspend);
>> + if (virt_dev->eps[i].ring && virt_dev->eps[i].ring->dequeue) {
>> + struct xhci_command *command;
>> + command = xhci_alloc_command(xhci, false, false,
>> + GFP_NOIO);
>
> ...this needs to be GFP_NOWAIT, or move it outside the lock.
>
That's right, thanks, I'll fix it.
-Mathias
next prev parent reply other threads:[~2014-06-06 8:02 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-08 16:25 [PATCH 00/10] xhci: features for usb-next Mathias Nyman
2014-05-08 16:25 ` [PATCH 01/10] xhci: fix wrong port number reported when setting USB2.0 hardware LPM Mathias Nyman
2014-05-08 16:25 ` [PATCH 02/10] xhci: 'noxhci_port_switch' kernel parameter Mathias Nyman
2014-05-20 1:01 ` Greg KH
2014-05-20 9:47 ` Mathias Nyman
2014-05-20 9:51 ` Takashi Iwai
2014-05-20 18:25 ` Dan Williams
2014-05-20 19:04 ` Takashi Iwai
2014-05-20 20:34 ` Greg KH
2014-05-20 22:40 ` Dan Williams
2014-05-21 0:27 ` Greg KH
2014-05-21 6:21 ` Dan Williams
2014-05-21 6:31 ` Greg KH
2014-05-21 17:29 ` Dan Williams
2014-05-21 17:52 ` Alan Stern
2014-05-21 21:59 ` Greg KH
2014-05-24 6:39 ` Holger Hans Peter Freyther
2014-05-24 14:13 ` Dan Williams
2014-07-11 10:08 ` Holger Hans Peter Freyther
2014-05-08 16:25 ` [PATCH 03/10] usb: catch attempts to submit urbs with a vmalloc'd transfer buffer Mathias Nyman
2014-05-08 16:21 ` Dan Williams
2014-05-12 15:01 ` Mathias Nyman
2014-05-20 0:58 ` Greg KH
2014-05-08 16:22 ` David Laight
2014-05-08 16:32 ` Dan Williams
2014-05-08 16:47 ` Joe Perches
2014-05-08 17:05 ` Dan Williams
2014-05-08 16:25 ` [PATCH 04/10] usb: xhci: Use IS_ENABLED() macro Mathias Nyman
2014-05-08 16:25 ` [PATCH 05/10] xhci: Use pci_enable_msix_exact() instead of pci_enable_msix() Mathias Nyman
2014-05-08 16:25 ` [PATCH 06/10] xhci: Report max device limit when Enable Slot command fails Mathias Nyman
2014-05-08 16:26 ` [PATCH 07/10] xhci: Use command structures when queuing commands on the command ring Mathias Nyman
2014-06-05 22:16 ` Dan Williams
2014-06-06 8:14 ` Mathias Nyman [this message]
2014-05-08 16:26 ` [PATCH 08/10] xhci: Add a global command queue Mathias Nyman
2014-05-08 16:26 ` [PATCH 09/10] xhci: Use completion and status in " Mathias Nyman
2014-05-08 16:26 ` [PATCH 10/10] xhci: rework command timeout and cancellation, Mathias Nyman
2014-05-15 15:44 ` [PATCH 00/10] xhci: features for usb-next Mathias Nyman
2014-05-20 1:04 ` 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=53917870.8050604@linux.intel.com \
--to=mathias.nyman@linux.intel.com \
--cc=dan.j.williams@gmail.com \
--cc=gregkh@linuxfoundation.org \
--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