linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mathias Nyman <mathias.nyman@linux.intel.com>
To: Roger Quadros <rogerq@ti.com>,
	mathias.nyman@intel.com, Alan Stern <stern@rowland.harvard.edu>
Cc: gregkh@linuxfoundation.org, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/5] usb: xhci: cleanup xhci_hcd allocation
Date: Tue, 12 May 2015 17:22:28 +0300	[thread overview]
Message-ID: <55520CA4.9040004@linux.intel.com> (raw)
In-Reply-To: <5550BA31.10901@ti.com>

On 11.05.2015 17:18, Roger Quadros wrote:
> Hi Mathias,
> 
> On 13/04/15 15:48, Mathias Nyman wrote:
>> Hi
>>
>> On 09.04.2015 12:22, Roger Quadros wrote:
>>> Hi,
>>>
>>> On 07/04/15 17:23, Mathias Nyman wrote:
>>>> Hi
>>>>
>>>> On 02.04.2015 15:23, Roger Quadros wrote:
>>>>> HCD core allocates memory for HCD private data in
>>>>> usb_create_[shared_]hcd() so make use of that
>>>>> mechanism to allocate the struct xhci_hcd.
>>>>>
>>>>> Introduce struct xhci_driver_overrides to provide
>>>>> the size of HCD private data and hc_driver operation
>>>>> overrides. As of now we only need to override the
>>>>> reset and start methods.
>>>>>
>>>>> Signed-off-by: Roger Quadros <rogerq@ti.com>
>>>>
>>>> I'm not sure I fully understand the what's going on, or what the
>>>> intention of this patch is.
>>>
>>> The main intention is to have both primary and shared HCDs allocated
>>> before calling usb_add_hcd() for the primary hcd.
>>> This is so that at the first usb_add_hcd() the OTG core knows the HCD topology
>>> (i.e. whether it uses a shared HCD or not).
>>>
>>>  From the OTG perspective we have to prevent the actual usb_add_hcd() till the
>>> OTG state machine says so.
>>> This means that xhci_gen_setup() won't be necessarily called immediately and
>>> so we need to allocate for xhci somewhere else.
>>
>> Ok, thanks for explaining. I now understand the reason behind this.
>>
>>>
>>>>
>>>> So currently xhci driver manages the allocation and freeing of
>>>> the xhci_hcd structure. We store a pointer to the xhci_hcd structure in
>>>> the content of both the primary and shared usb_hcds structures hcd_priv
>>>> field.
>>>>
>>>> With this patch xhci would be part of the usb_hcd structure,
>>>> starting at hcd_priv[0]. (Like EHCI I think) It allocates enough space to include
>>>> the xhci_hcd in both the primary and shared usb_hcd, but always only use the one
>>>> in the primary hcd.
>>>
>>> precisely.
>>>
>>>> I'm not sure what to do with the space allocated for the shared hcd's
>>>> hcd_priv field.
>>>
>>> we just ignore the space allocated for the shared hcd.
>>
>> Ok, not a big loss.
>>
>>>
>>>>
>>>> This also means that xhci goes away together with the primary hcd. It's possible
>>>> this has some impact as the xhci driver expects xhci to always exists.
>>>
>>> Can you please point out where this impact is.
>>>
>>> I've been testing add/remove HCD extensively and didn't observe any issues after applying
>>> these 5 patches. Well there is one issue that comes up but it has nothing to do with xhci
>>> not being allocated. It has more to do with command being queued after the HCD has gone away
>>> and so getting stuck forever without timing out.
>>
>> I went through the codepaths and you're right, should work fine. My concern wasn't valid.
>> This patchset doesn't even touch the order how primary and shared HCDs are created and added
>> in the PCI case, only for the platform device case.
>>
>> I'll try it out and send forward once rc1 is out.
> 
> did you get a chance to try this series?
> 

Sorry, not yet, got delayed by other internal tasks.
I'll try it out as soon as possible.

-Mathias




  reply	other threads:[~2015-05-12 14:20 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-02 12:23 [PATCH 0/5] usb: xhci: fixes for OTG/DRD use Roger Quadros
2015-04-02 12:23 ` [PATCH 1/5] usb: xhci: cleanup xhci_hcd allocation Roger Quadros
2015-04-07 14:23   ` Mathias Nyman
2015-04-09  9:22     ` Roger Quadros
2015-04-13 12:48       ` Mathias Nyman
2015-04-14  9:21         ` Roger Quadros
2015-05-11 14:18         ` Roger Quadros
2015-05-12 14:22           ` Mathias Nyman [this message]
2015-05-25 15:05             ` Mathias Nyman
2015-05-26 16:31               ` Andrew Bresticker
2015-04-02 12:23 ` [PATCH 2/5] usb: xhci: plat: Create both HCDs before adding them Roger Quadros
2015-04-20 12:35   ` Mathias Nyman
2015-04-21  9:49     ` Roger Quadros
2015-04-21  7:11       ` Roger Quadros
2015-04-21  8:08       ` Maxime Ripard
2015-04-21 10:46         ` Roger Quadros
2015-04-22 13:46           ` Maxime Ripard
2015-04-02 12:23 ` [PATCH 3/5] usb: xhci: Allow usb_add/remove_hcd() to be called repeatedly Roger Quadros
2015-04-02 12:23 ` [PATCH 4/5] usb: xhci: fix xhci locking up during hcd remove Roger Quadros
2015-04-02 12:23 ` [PATCH 5/5] usb: xhci: Fix suspend/resume when used with OTG core Roger Quadros
2015-05-26 14:15   ` [PATCH] usb: host: xhci-pci: Fix NULL pointer dereference error Roger Quadros
2015-05-29 13:19     ` Mathias Nyman
2015-05-29 13:49       ` Roger Quadros

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=55520CA4.9040004@linux.intel.com \
    --to=mathias.nyman@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mathias.nyman@intel.com \
    --cc=rogerq@ti.com \
    --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 NNTP newsgroup(s).