mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alan Stern <stern@rowland.harvard.edu>
To: Guan-Yu Lin <guanyulin@google.com>
Cc: Thinh.Nguyen@synopsys.com, gregkh@linuxfoundation.org,
	mathias.nyman@intel.com, yajun.deng@linux.dev,
	sumit.garg@linaro.org, kekrby@gmail.com, oneukum@suse.com,
	dianders@chromium.org, perex@perex.cz, tiwai@suse.com,
	niko.mauno@vaisala.com, andreyknvl@gmail.com,
	christophe.jaillet@wanadoo.fr, tj@kernel.org,
	stanley_chang@realtek.com, quic_jjohnson@quicinc.com,
	ricardo@marliere.net, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-sound@vger.kernel.org,
	badhri@google.com, albertccwang@google.com,
	quic_wcheng@quicinc.com, pumahsu@google.com
Subject: Re: [PATCH v5 5/5] usb: host: enable sideband transfer during system sleep
Date: Wed, 16 Oct 2024 10:45:11 -0400	[thread overview]
Message-ID: <003263c8-c901-496b-ae04-7cccd7f3cfa2@rowland.harvard.edu> (raw)
In-Reply-To: <CAOuDEK3mmR9052FWEJAVBkUanVJ1MLLebZoANiasUpD9TDBjfg@mail.gmail.com>

On Wed, Oct 16, 2024 at 03:40:00PM +0800, Guan-Yu Lin wrote:
> On Tue, Oct 15, 2024 at 10:43 PM Alan Stern <stern@rowland.harvard.edu> wrote:
> >
> > On Tue, Oct 15, 2024 at 11:56:00AM +0800, Guan-Yu Lin wrote:
> > > On Mon, Oct 14, 2024 at 11:56 PM Alan Stern <stern@rowland.harvard.edu> wrote:
> > > > I'm not so sure about this.  By returning early, you prevent the drivers
> > > > bound to this device from suspending.  But they can't operate properly
> > > > when the system is in a low-power mode.  Won't that cause problems?
> > > >
> > > > Maybe this really belongs in usb_suspend_device(), and its counterpart
> > > > belongs in usb_resume_device().
> > > >
> > >
> > > To my understanding, after the system is suspended, the USB driver
> > > will do nothing as the main processor has been suspended. May I check
> > > what forms of low power mode and operation we are discussing here?
> >
> > S3 suspend.  You are right that the driver will do nothing while the
> > CPU is suspended.  But what about the times before and after that,
> > while the suspend and resume procedures are underway?  The driver
> > needs to be told to cancel any ongoing transfers while the system
> > suspends and then restart them while the system resumes.
> >
> 
> Regarding the cancellation of ongoing transfers during suspend, I
> believe usb_hcd_flush_endpoint() handles this as discussed below.

There's more to it than that.  If you cancel ongoing transfers by 
calling usb_hcd_flush_endpoint() without informing the driver first, the 
driver will get very confused and think the device has failed.

> Besides calling usb_hcd_flush_endpoint(), are there any other
> necessary changes before suspending the driver in our scenario? Maybe
> we could discuss setting usb_device_state to USB_STATE_SUSPENDED.
> However, my understanding is that this variable reflects the actual
> device state. Since the device remains active via the sideband in our
> case,  changing usb_device_state seems unnecessary.

That's right.

I don't think anything else is needed.  Just call 
usb_suspend_interface() like the normal pathway in usb_suspend_both() 
does, but skip calling usb_suspend_device().

Alan Stern

  reply	other threads:[~2024-10-16 14:45 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-14  8:50 [PATCH v5 0/5] Support system sleep with offloaded usb transfers Guan-Yu Lin
2024-10-14  8:50 ` [PATCH v5 1/5] usb: dwc3: separate dev_pm_ops for each pm_event Guan-Yu Lin
2024-10-14  8:50 ` [PATCH v5 2/5] usb: xhci-plat: " Guan-Yu Lin
2024-10-14  8:50 ` [PATCH v5 3/5] usb: add apis for sideband usage tracking Guan-Yu Lin
2024-10-14  8:50 ` [PATCH v5 4/5] xhci: sideband: add api to trace sideband usage Guan-Yu Lin
2024-10-14  8:50 ` [PATCH v5 5/5] usb: host: enable sideband transfer during system sleep Guan-Yu Lin
2024-10-14  9:21   ` Greg KH
2024-10-14 16:06     ` Guan-Yu Lin
2024-10-14 13:08   ` Mathias Nyman
2024-10-14 16:19     ` Guan-Yu Lin
2024-10-14 15:56   ` Alan Stern
2024-10-14 15:59     ` Alan Stern
2024-10-15  3:56     ` Guan-Yu Lin
2024-10-15 14:43       ` Alan Stern
2024-10-16  7:40         ` Guan-Yu Lin
2024-10-16 14:45           ` Alan Stern [this message]
2024-10-18 11:59             ` Guan-Yu Lin
2024-10-18 14:41               ` Alan Stern

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=003263c8-c901-496b-ae04-7cccd7f3cfa2@rowland.harvard.edu \
    --to=stern@rowland.harvard.edu \
    --cc=Thinh.Nguyen@synopsys.com \
    --cc=albertccwang@google.com \
    --cc=andreyknvl@gmail.com \
    --cc=badhri@google.com \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=dianders@chromium.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=guanyulin@google.com \
    --cc=kekrby@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mathias.nyman@intel.com \
    --cc=niko.mauno@vaisala.com \
    --cc=oneukum@suse.com \
    --cc=perex@perex.cz \
    --cc=pumahsu@google.com \
    --cc=quic_jjohnson@quicinc.com \
    --cc=quic_wcheng@quicinc.com \
    --cc=ricardo@marliere.net \
    --cc=stanley_chang@realtek.com \
    --cc=sumit.garg@linaro.org \
    --cc=tiwai@suse.com \
    --cc=tj@kernel.org \
    --cc=yajun.deng@linux.dev \
    /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

all inboxes | Powered by JetHome®