Re: [RFC PATCH] xhci: Prevent runtime pm from autosuspending during initialization

2014-02-24 Thread Alan Stern
On Mon, 24 Feb 2014, Dan Williams wrote: > > Thanks Dan and Alan for the input, I did the following changes: > > > > - Take and release the reference in xhci_pci_probe to avoid releasing the > > reference for a moment just before usb3 roothub registration. > > - Make sure we release the reference

Re: [RFC PATCH] xhci: Prevent runtime pm from autosuspending during initialization

2014-02-24 Thread Dan Williams
On Mon, Feb 24, 2014 at 8:22 AM, Mathias Nyman wrote: > On 02/23/2014 12:51 AM, Alan Stern wrote: > > > Right, but I assume you'd want to hold the reference until after the > hub is registered, otherwise there's still a chance we suspend right > before register. So I'm saying hold

Re: [RFC PATCH] xhci: Prevent runtime pm from autosuspending during initialization

2014-02-24 Thread Mathias Nyman
On 02/23/2014 12:51 AM, Alan Stern wrote: Right, but I assume you'd want to hold the reference until after the hub is registered, otherwise there's still a chance we suspend right before register. So I'm saying hold the reference until the registration process takes its own. To be really saf

Re: [RFC PATCH] xhci: Prevent runtime pm from autosuspending during initialization

2014-02-22 Thread Alan Stern
On Sat, 22 Feb 2014, Dan Williams wrote: > On Fri, Feb 21, 2014 at 1:17 PM, Alan Stern wrote: > > On Fri, 21 Feb 2014, Dan Williams wrote: > > > >> > Round 2: add usb 3 hcd > >> > > >> > usb_add_hcd() // secondary usb3 hcd > >> > hcd->self.root_hub = usb_alloc_dev() > >> > hcd->driver->reset

Re: [RFC PATCH] xhci: Prevent runtime pm from autosuspending during initialization

2014-02-22 Thread Dan Williams
On Fri, Feb 21, 2014 at 1:17 PM, Alan Stern wrote: > On Fri, 21 Feb 2014, Dan Williams wrote: > >> > Round 2: add usb 3 hcd >> > >> > usb_add_hcd() // secondary usb3 hcd >> > hcd->self.root_hub = usb_alloc_dev() >> > hcd->driver->reset(hcd) -> xhci_gen_setup() >> > if(primary_hcd) // fals

Re: [RFC PATCH] xhci: Prevent runtime pm from autosuspending during initialization

2014-02-21 Thread Alan Stern
On Fri, 21 Feb 2014, Dan Williams wrote: > > Round 2: add usb 3 hcd > > > > usb_add_hcd() // secondary usb3 hcd > > hcd->self.root_hub = usb_alloc_dev() > > hcd->driver->reset(hcd) -> xhci_gen_setup() > > if(primary_hcd) // false > > .. > > else > > pm_runtime_put_noidle(hcd

Re: [RFC PATCH] xhci: Prevent runtime pm from autosuspending during initialization

2014-02-21 Thread Alan Stern
On Fri, 21 Feb 2014, Sarah Sharp wrote: > > Why would this trigger xhci_suspend? Isn't we still running in the > > context of the probe routine? The controller won't be suspended until > > the probe call returns. > > Maybe it helps to look at the context of the bug report Mathias is > trying to

Re: [RFC PATCH] xhci: Prevent runtime pm from autosuspending during initialization

2014-02-21 Thread Dan Williams
On Fri, Feb 21, 2014 at 10:45 AM, Mathias Nyman wrote: >>> @@ -4753,6 +4753,8 @@ int xhci_gen_setup(struct usb_hcd *hcd, >>> xhci_get_quirks_t get_quirks) >>> * companion controller. >>> */ >>> hcd->has_tt = 1; >>> + /* prevent USB

Re: [RFC PATCH] xhci: Prevent runtime pm from autosuspending during initialization

2014-02-21 Thread Dan Williams
On Fri, Feb 21, 2014 at 11:45 AM, Sarah Sharp wrote: > On Fri, Feb 21, 2014 at 01:57:25PM -0500, Alan Stern wrote: >> On Fri, 21 Feb 2014, Mathias Nyman wrote: >> > This is how I gather it works: >> > >> > Round 1: add usb2 hcd >> > >> > usb_add_hcd() // primary usb2 hcd >> >hcd->self.root_hu

Re: [RFC PATCH] xhci: Prevent runtime pm from autosuspending during initialization

2014-02-21 Thread Sarah Sharp
On Fri, Feb 21, 2014 at 01:57:25PM -0500, Alan Stern wrote: > On Fri, 21 Feb 2014, Mathias Nyman wrote: > > This is how I gather it works: > > > > Round 1: add usb2 hcd > > > > usb_add_hcd() // primary usb2 hcd > >hcd->self.root_hub = usb_alloc_dev() > >hcd->driver->reset(hcd) -> xhci_ge

Re: [RFC PATCH] xhci: Prevent runtime pm from autosuspending during initialization

2014-02-21 Thread Alan Stern
On Fri, 21 Feb 2014, Mathias Nyman wrote: > >> @@ -4753,6 +4753,8 @@ int xhci_gen_setup(struct usb_hcd *hcd, > >> xhci_get_quirks_t get_quirks) > >> * companion controller. > >> */ > >> hcd->has_tt = 1; > >> + /* prevent USB2 runt

Re: [RFC PATCH] xhci: Prevent runtime pm from autosuspending during initialization

2014-02-21 Thread Mathias Nyman
@@ -4753,6 +4753,8 @@ int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks) * companion controller. */ hcd->has_tt = 1; + /* prevent USB2 runtime pm until USB3 parts are initialized */ + pm_runtime_ge

Re: [RFC PATCH] xhci: Prevent runtime pm from autosuspending during initialization

2014-02-21 Thread Dan Williams
On Fri, Feb 21, 2014 at 5:19 AM, Mathias Nyman wrote: > If autosuspend is set to zero the usb-2 roothub will try to suspend > the controller before usb-3 parts are initialized. > > Prevent this by incrementing the usage counter before usb-2 registers > its roothub. Decrement the counter when usb-3

[RFC PATCH] xhci: Prevent runtime pm from autosuspending during initialization

2014-02-21 Thread Mathias Nyman
If autosuspend is set to zero the usb-2 roothub will try to suspend the controller before usb-3 parts are initialized. Prevent this by incrementing the usage counter before usb-2 registers its roothub. Decrement the counter when usb-3 roothub is allocated. Signed-off-by: Mathias Nyman --- drive