LKML Archive mirror
 help / color / mirror / Atom feed
From: Mathias Nyman <mathias.nyman@linux.intel.com>
To: Chris Bainbridge <chris.bainbridge@gmail.com>,
	Alan Stern <stern@rowland.harvard.edu>
Cc: johan@kernel.org, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] usb: host: xhci: Replace bus lock with host controller lock
Date: Wed, 10 Feb 2016 18:50:06 +0200	[thread overview]
Message-ID: <56BB6A3E.4020006@linux.intel.com> (raw)
In-Reply-To: <20160205151407.GA5257@localhost>

On 05.02.2016 17:14, Chris Bainbridge wrote:
> Running task list at fail point:

...

> Some of the functions appear to be inlined, the exact call chain is:
>
> hub_port_init
>      usb_get_device_descriptor
>          usb_get_descriptor
>              usb_control_msg
>                  usb_internal_control_msg
>                      usb_start_wait_urb
>                          usb_submit_urb / wait_for_completion_timeout / usb_kill_urb
>
> hub_port_init
>      hub_set_address
>          xhci_address_device
>              xhci_setup_device
>

hub_port_reset() will end up moving the corresponding xhci device slot to default state.

As hub_port_reset() is called several times in hub_port_init() It sounds reasonable
that we could end up with two threads having their xhci device slots in default state at
the same time,  which according to xhci 4.5.3 specs still is a big no no.

So both threads fail at their next task after this.
One fails to read the descriptor, and the other fails addressing the device.

Nice catch btw.

> So xhci_setup_device is entered while there is an outstanding URB on the
> other bus. Unless anyone can think of a better way to fix this I'll make
> the requested changes and resend my patch.
>

For what it's wort I think that this suggested controller mutex sounds like a good idea.
Should work for xhci at least.

-Mathias

      reply	other threads:[~2016-02-10 16:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-04 19:46 [PATCH] usb: host: xhci: Replace bus lock with host controller lock Chris Bainbridge
2016-02-04 21:00 ` Alan Stern
2016-02-04 22:06   ` Chris Bainbridge
2016-02-05  2:45     ` Alan Stern
2016-02-05 15:14       ` Chris Bainbridge
2016-02-10 16:50         ` Mathias Nyman [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=56BB6A3E.4020006@linux.intel.com \
    --to=mathias.nyman@linux.intel.com \
    --cc=chris.bainbridge@gmail.com \
    --cc=johan@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=stern@rowland.harvard.edu \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).