mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
To: Ray Chi <raychi@google.com>
Cc: "gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	"albertccwang@google.com" <albertccwang@google.com>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"pumahsu@google.com" <pumahsu@google.com>,
	"stable@vger.kernel.org" <stable@vger.kernel.org>
Subject: Re: [PATCH] usb: dwc3: Skip resume if pm_runtime_set_active() fails
Date: Wed, 8 Jan 2025 01:25:09 +0000	[thread overview]
Message-ID: <20250108012507.jv2wkw7qtxztfkvv@synopsys.com> (raw)
In-Reply-To: <20250108011922.lmdafz3sqbbhbj6p@synopsys.com>

On Wed, Jan 08, 2025, Thinh Nguyen wrote:
> On Mon, Jan 06, 2025, Ray Chi wrote:
> > When the system begins to enter suspend mode, dwc3_suspend() is called
> > by PM suspend. There is a problem that if someone interrupt the system
> > suspend process between dwc3_suspend() and pm_suspend() of its parent
> > device, PM suspend will be canceled and attempt to resume suspended
> > devices so that dwc3_resume() will be called. However, dwc3 and its
> > parent device (like the power domain or glue driver) may already be
> > suspended by runtime PM in fact. If this sutiation happened, the
> > pm_runtime_set_active() in dwc3_resume() will return an error since
> > parent device was suspended. This can lead to unexpected behavior if
> > DWC3 proceeds to execute dwc3_resume_common().
> > 
> > EX.
> > RPM suspend: ... -> dwc3_runtime_suspend()
> >                       -> rpm_suspend() of parent device
> > ...
> > PM suspend: ... -> dwc3_suspend() -> pm_suspend of parent device
> >                                  ^ interrupt, so resume suspended device
> >           ...  <-  dwc3_resume()  <-/
> >                       ^ pm_runtime_set_active() returns error
> > 
> > To prevent the problem, this commit will skip dwc3_resume_common() and
> > return the error if pm_runtime_set_active() fails.
> 
> 
> So, if the device is runtime suspended, we prevent any interrupt during
> system suspend? Any way we can keep the same behavior and allow PM
> interruption as when there's no runtime suspend.
> 

Actually, I misread, the interruption is still there. Just the resume is
prevented.

Looks good to me.

Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>

Thanks,
Thinh

      reply	other threads:[~2025-01-08  1:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-06  8:22 Ray Chi
2025-01-08  1:19 ` Thinh Nguyen
2025-01-08  1:25   ` Thinh Nguyen [this message]

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=20250108012507.jv2wkw7qtxztfkvv@synopsys.com \
    --to=thinh.nguyen@synopsys.com \
    --cc=albertccwang@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=pumahsu@google.com \
    --cc=raychi@google.com \
    --cc=stable@vger.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®