From: Alan Stern <stern@rowland.harvard.edu>
To: Mathias Nyman <mathias.nyman@linux.intel.com>
Cc: Evan Green <evgreen@chromium.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Mathias Nyman <mathias.nyman@intel.com>,
Rajat Jain <rajatja@chromium.org>,
Thomas Gleixner <tglx@linutronix.de>,
Bjorn Helgaas <bhelgaas@google.com>,
"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
Youngjin Jang <yj84.jang@samsung.com>,
LKML <linux-kernel@vger.kernel.org>,
linux-usb@vger.kernel.org
Subject: Re: [PATCH] USB: hcd-pci: Fully suspend across freeze/thaw cycle
Date: Tue, 12 Apr 2022 11:40:45 -0400 [thread overview]
Message-ID: <YlWdfWRXYjkfHLIP@rowland.harvard.edu> (raw)
In-Reply-To: <4353a956-9855-9c14-7dbf-bf16580abe32@linux.intel.com>
On Tue, Apr 12, 2022 at 05:56:42PM +0300, Mathias Nyman wrote:
> On 11.4.2022 17.50, Alan Stern wrote:
> > For example, what would happen if the user unplugs a device right in the
> > middle of the freeze transition, after the root hub has been frozen but
> > before the controller is frozen? We don't want such an unplug event to
> > prevent the system from going into hibernation -- especially if the root
> > hub was not enabled for wakeup.
>
> We should be able to let system go to hibernate even if we get a disconnect
> interrupt between roothub and host controller freeze.
> Host is not yet suspended so no PME# wake is generated, only an interrupt.
>
> From Linux PM point of view it should be ok as well as the actual xhci
> device that is generating the interrupt is hasnt completer freeze()
>
> The xhci interrupt handler just needs to make sure that the disconnect
> isn't propagated if roothub is suspended and wake on disconnect
> is not set. And definitely make sure xhci doesn't start roothub polling.
>
> When freeze() is called for the host we should prevent the host from
> generating interrupts.
I guess that means adding a new callback. Or we could just suspend the
controller, like Evan proposed originally.
> > (If the root hub _is_ enabled for wakeup then it's questionable.
> > Unplugging a device would be a wakeup event, so you could easily argue
> > that it _should_ prevent the system from going into hibernation. After
> > all, if the unplug happened a few milliseconds later, after the system
> > had fully gone into hibernation, then it would cause the system to wake
> > up.)
> >
> >> Would it make sense prevent xHCI interrupt generation in the host
> >> freeze() stage, clearing the xHCI EINT bit in addition to calling
> >> check_roothub_suspend()?
> >> Then enable it back in thaw()
> >
> > That won't fully eliminate the problem mentioned in the preceding
> > paragraphs, although I guess it would help somewhat.
>
> Would the following steps solve this?
>
> 1. Disable device initiated resume for connected usb devices in freeze()
>
> 2. Don't propagate connect or OC changes if roothub is suspended and port wake
> flags are disabled. I.E don't kick roothub polling in xhci interrupt
> handler here.
I guess you can't just halt the entire host controller when only one of
the root hubs is suspended with wakeup disabled. That does complicate
things. But you could halt it as soon as both of the root hubs are
frozen. Wouldn't that prevent interrupt generation?
> 3 Disable host interrupt generation in host freeze(), and re-enable in thaw()
And then this step wouldn't be necessary, right?
Alan Stern
next prev parent reply other threads:[~2022-04-12 15:40 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-07 18:59 [PATCH] USB: hcd-pci: Fully suspend across freeze/thaw cycle Evan Green
2022-04-08 14:29 ` Alan Stern
2022-04-08 21:52 ` Evan Green
2022-04-09 1:58 ` Alan Stern
2022-04-11 10:43 ` Mathias Nyman
2022-04-11 14:50 ` Alan Stern
2022-04-12 14:56 ` Mathias Nyman
2022-04-12 15:40 ` Alan Stern [this message]
2022-04-14 14:00 ` Mathias Nyman
2022-04-14 14:21 ` Alan Stern
2022-04-14 16:30 ` Evan Green
2022-04-14 17:06 ` Mathias Nyman
2022-04-14 20:16 ` 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=YlWdfWRXYjkfHLIP@rowland.harvard.edu \
--to=stern@rowland.harvard.edu \
--cc=bhelgaas@google.com \
--cc=evgreen@chromium.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mathias.nyman@intel.com \
--cc=mathias.nyman@linux.intel.com \
--cc=rafael.j.wysocki@intel.com \
--cc=rajatja@chromium.org \
--cc=tglx@linutronix.de \
--cc=yj84.jang@samsung.com \
/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).