From: Alan Stern <stern@rowland.harvard.edu>
To: "WeitaoWang-oc@zhaoxin.com" <WeitaoWang-oc@zhaoxin.com>
Cc: gregkh@linuxfoundation.org, linux-usb@vger.kernel.org,
linux-kernel@vger.kernel.org, CobeChen@zhaoxin.com,
TimGuo@zhaoxin.com, tonywwang@zhaoxin.com,
weitaowang@zhaoxin.com
Subject: Re: [PATCH] USB:Fix ehci infinite suspend-resume loop issue in zhaoxin
Date: Wed, 6 Apr 2022 12:20:05 -0400 [thread overview]
Message-ID: <Yk29tZpy9pLDlPj2@rowland.harvard.edu> (raw)
In-Reply-To: <bbd9148d-5970-2233-6ee9-625e961cd2f5@zhaoxin.com>
On Wed, Apr 06, 2022 at 10:38:28AM +0800, WeitaoWang-oc@zhaoxin.com wrote:
> On 2022/4/6 00:02, Alan Stern wrote:
> > In fact, the resume kernel doesn't call ehci_resume at all. Here's what
> > it does:
> >
> > The resume kernel boots;
> >
> > If your patch causes STS_PCD to be set at this point, the flag
> > should get cleared shortly afterward by ehci_irq;
> >
> > ehci-hcd goes into runtime suspend;
> >
> > The kernel reads the system image that was stored earlier when
> > hibernation began;
> >
> > After the image is loaded, the system goes into the freeze
> > state (this does not call any routines in ehci-hcd);
> On this phase, pci_pm_freeze will be called for pci device. In this
> function, pm_runtime_resume will be called to resume already
> runtime-suspend devices. which will cause ehci_resume to be called.
> Thus STS_PCD flag will be set in ehci_resume function.
Aha! I was missing that piece of information, thanks.
But this still doesn't explain why check_root_hub_suspended is failing.
That routine checks the HCD_RH_RUNNING bit, which gets set in
hcd_bus_resume. hcd_bus_resume gets called as part of resuming the root
hub, and in ehci-hcd this happens when ehci_irq sees that STS_PCD is set
and calls usb_hcd_resume_root_hub. That routine queues a wakeup request
on the pm_wq work queue, which is then supposed to run hcd_resume_work
to actually restart the root hub.
But pm_wq is a freezable work queue! While the system is in the freeze
state, the work queue isn't running. This means that the root hub
should remain suspended until the end of the freeze phase, and so the
call to check_root_hub_suspended should succeed.
Can you check to see what's really happening on your system? Something
must be wrong with my analysis, but I can't tell what it is. I'm still
puzzled.
Alan Stern
next prev parent reply other threads:[~2022-04-06 17:54 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-14 7:35 WeitaoWang-oc
2022-03-14 7:45 ` Greg KH
2022-03-14 14:24 ` Alan Stern
2022-03-15 12:39 ` WeitaoWang-oc
2022-03-15 15:18 ` Alan Stern
2022-03-16 2:18 ` WeitaoWang-oc
2022-03-22 13:52 ` WeitaoWang-oc
2022-04-05 16:02 ` Alan Stern
2022-04-06 2:38 ` WeitaoWang-oc
2022-04-06 16:20 ` Alan Stern [this message]
2022-04-07 6:15 ` WeitaoWang-oc
2022-04-07 14:22 ` 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=Yk29tZpy9pLDlPj2@rowland.harvard.edu \
--to=stern@rowland.harvard.edu \
--cc=CobeChen@zhaoxin.com \
--cc=TimGuo@zhaoxin.com \
--cc=WeitaoWang-oc@zhaoxin.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=tonywwang@zhaoxin.com \
--cc=weitaowang@zhaoxin.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
all inboxes | Powered by JetHome®