All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Lu, Baolu" <baolu.lu@linux.intel.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Mathias Nyman <mathias.nyman@intel.com>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC][PATCH 1/3] usb: add a hcd notify entry in hc_driver
Date: Wed, 06 May 2015 09:07:25 +0800	[thread overview]
Message-ID: <5549694D.6000505@linux.intel.com> (raw)
In-Reply-To: <Pine.LNX.4.44L0.1505051041210.1639-100000@iolanthe.rowland.org>



On 05/05/2015 10:50 PM, Alan Stern wrote:
> On Tue, 5 May 2015, Lu, Baolu wrote:
>
>> The order that software should do during device suspend/resume is
>> defined in 4.15.1.1 of xHCI spec 1.1.
>>
>> Spec 4.15.1.1:
>>
>> Software shall stop all endpoints of a device using the Stop Endpoint
>> Command and setting the Suspend
>> (SP) flag to 1 prior to selectively suspending a device.
> But _after_ all the URBs sent to the device have completed, right?
Yes, that's right.

>
>>   After the
>> device is resumed software shall ring an
>> endpoint's doorbell to restart it.
> The driver would ring the endpoint's doorbell anyway when a new URB is
> submitted, wouldn't it?  Which means the resume callback doesn't
> actually have to do anything.
The value of ringing door bell after resume is that hcd can fetch
endpoint state from memory to cache and get ready for transfer
as early as possible.

>
>> --end--
>>
>> So the order looks like:
>>
>> tell hcd device suspend
>> usb_port_suspend()
> You have forgotten that usb_port_suspend() can send URBs to the device
> (to enable remote wakeup, for example).  Therefore you shouldn't notify
> the HCD until usb_port_suspend() is partly or totally finished.
Yes, I agree with you. I will move the notification into usb_port_suspend(),
just before sending suspend request to parent hub.

>
>> usb_port_resume()
>> tell hcd device resume
> You have also forgotten that usb_port_resume() calls various functions
> that send URBs to ep0 on the device.  Therefore if the HCD's
> device_resume callback needs to do something (like ringing ep0's
> doorbell), you had better invoke the callback _before_ calling
> usb_port_resume().  Or maybe you had better do this _within_
> usb_port_resume().
Agree. I will do this within usb_port_resume() just after completing
sending clear port feature.

>
> Alan Stern
Thank you for the comments. I will send the v2 patch series with all
your comments addressed.

Thanks,
Baolu

>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-usb" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>


  reply	other threads:[~2015-05-06  1:07 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-04  3:15 [RFC][PATCH 0/3] usb: add a hcd notify entry in hc_driver Lu Baolu
2015-05-04  3:15 ` [RFC][PATCH 1/3] " Lu Baolu
2015-05-04  8:14   ` Greg Kroah-Hartman
2015-05-05 22:36     ` Lu, Baolu
2015-05-04 14:28   ` Alan Stern
2015-05-05  1:05     ` Lu, Baolu
2015-05-05 14:50       ` Alan Stern
2015-05-06  1:07         ` Lu, Baolu [this message]
2015-05-04  3:15 ` [RFC][PATCH 2/3] usb: xhci: implement hc_driver notify entry Lu Baolu
2015-05-04  3:15 ` [RFC][PATCH 3/3] usb: xhci: cleanup unnecessary stop device and ring doorbell operations Lu Baolu

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=5549694D.6000505@linux.intel.com \
    --to=baolu.lu@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=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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.