mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alan Stern <stern@rowland.harvard.edu>
To: duanchenghao <duanchenghao@kylinos.cn>
Cc: gregkh@linuxfoundation.org, pavel@ucw.cz,
	linux-pm@vger.kernel.org, niko.mauno@vaisala.com,
	stanley_chang@realtek.com, tj@kernel.org,
	linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org
Subject: Re: [PATCH] USB: Fix the issue of task recovery failure caused by USB status when S4 wakes up
Date: Thu, 12 Sep 2024 11:00:27 -0400	[thread overview]
Message-ID: <b8dc326b-8aee-4903-bbb6-64083cf66b4d@rowland.harvard.edu> (raw)
In-Reply-To: <8068130ce4ece6078b2893c4c6333c06c792b6c0.camel@kylinos.cn>

On Thu, Sep 12, 2024 at 11:21:26AM +0800, duanchenghao wrote:
> 在 2024-09-11星期三的 10:40 -0400,Alan Stern写道:
> > On Tue, Sep 10, 2024 at 05:36:56PM +0800, duanchenghao wrote:
> > > S4 wakeup restores the image that was saved before the system
> > > entered
> > > the S4 sleep state.
> > > 
> > >     S4 waking up from hibernation
> > >     =============================
> > >     kernel initialization
> > >     |   
> > >     v   
> > >     freeze user task and kernel thread
> > >     |   
> > >     v   
> > >     load saved image
> > >     |    
> > >     v   
> > >     freeze the peripheral device and controller
> > >     (Check the HCD_FLAG_WAKEUP_ PENDING flag of the USB. If it is
> > > set,
> > >      return to EBUSY and do not perform the following restore
> > > image.)
> > 
> > Why is the flag set at this point?  It should not be; the device and 
> > controller should have been frozen with wakeup disabled.
> > 
> This is check point, not set point.

Yes, I know that.  But when the flag was checked, why did the code find 
that it was set?  The flag should have been clear.

> > Is your problem related to the one discussed in this email thread?
> > 
> > https://lore.kernel.org/linux-usb/d8600868-6e4b-45ab-b328-852b6ac8ecb5@rowland.harvard.edu/
> > 
> > Would the suggestion I made there -- i.e., have the xhci-hcd 
> > interrupt handler skip calling usb_hcd_resume_root_hub() if the root
> > hub 
> > was suspended with wakeup = 0 -- fix your problem?
> 
> Skipping usb_hcd_resume_root_hub() should generally be possible, but
> it's important to ensure that normal remote wakeup functionality is not
> compromised. Is it HUB_SUSPEND that the hub you are referring to is in
> a suspended state?

I don't understand this question.  hub_quiesce() gets called with 
HUB_SUSPEND when the hub enters a suspended state.

You are correct about the need for normal remote wakeup to work 
properly.  The interrupt handler should skip calling 
usb_hcd_resume_root_hub() for port connect or disconnect changes and for 
port overcurrent changes (when the root hub is suspended with wakeup = 
0).  But it should _not_ skip calling usb_hcd_resume_root_hub() for port 
resume events.

Alan Stern

  parent reply	other threads:[~2024-09-12 15:00 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-06  3:05 Duan Chenghao
2024-09-06 14:05 ` Alan Stern
     [not found] ` <1725931490447646.3.seg@mailgw.kylinos.cn>
2024-09-10  9:34   ` duanchenghao
2024-09-10  9:36   ` duanchenghao
2024-09-11 14:40     ` Alan Stern
2024-09-12  3:21       ` duanchenghao
2024-09-12  6:26         ` [PATCH v2] " Duan Chenghao
2024-09-12 15:00         ` Alan Stern [this message]
2024-09-13  1:51           ` [PATCH] " duanchenghao
2024-09-13  9:38             ` duanchenghao
2024-09-14  2:43           ` Hongyu Xie
2024-09-23  8:00             ` duanchenghao
2024-09-24 13:38               ` Alan Stern
2024-09-29  3:14                 ` duanchenghao
2024-10-09  1:19                   ` duanchenghao
2024-10-09  1:54                     ` Alan Stern
2024-10-09  2:35                 ` duanchenghao
2024-10-09  6:29                   ` Gopal, Saranya
2024-10-09 15:50                   ` Alan Stern
2024-10-10  5:53                     ` duanchenghao
2024-10-10  5:59                     ` duanchenghao
2024-10-10 14:21                       ` Alan Stern
2024-10-11  1:42                         ` duanchenghao
2024-10-11 13:53                           ` Alan Stern
2024-10-12  9:46                             ` [PATCH v3] " Duan Chenghao
2024-10-12 12:39                               ` Greg KH
2024-10-12 12:40                               ` Greg KH
2024-10-12 15:06                                 ` Alan Stern
2024-10-12  9:51                             ` [PATCH] " duanchenghao
2024-10-12 15:01                               ` Alan Stern
2024-10-14  1:32                                 ` duanchenghao
2024-10-14  1:41                                 ` duanchenghao
2024-10-14  4:10                                   ` Gopal, Saranya
2024-10-16  8:57                                   ` Gopal, Saranya
2024-10-16  9:06                                     ` duanchenghao
2024-10-24  2:40                                       ` [PATCH v4] " Duan Chenghao
2024-10-24  2:53                                         ` duanchenghao
2024-10-24  7:05                                         ` Greg KH
2024-10-24  8:46                                           ` duanchenghao
2024-10-29  3:27                                             ` Greg KH
2024-10-29  8:01                                               ` duanchenghao
2024-11-06  1:29                                                 ` duanchenghao
2024-11-21 19:09                                                   ` Greg KH
2024-11-20  2:14                                               ` 回复:[PATCH " Duan Chenghao

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=b8dc326b-8aee-4903-bbb6-64083cf66b4d@rowland.harvard.edu \
    --to=stern@rowland.harvard.edu \
    --cc=duanchenghao@kylinos.cn \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=niko.mauno@vaisala.com \
    --cc=pavel@ucw.cz \
    --cc=stanley_chang@realtek.com \
    --cc=tj@kernel.org \
    /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®