From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Douglas Anderson <dianders@chromium.org>
Cc: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Jiri Slaby" <jirislaby@kernel.org>,
"John Ogness" <john.ogness@linutronix.de>,
"Tony Lindgren" <tony@atomide.com>,
linux-arm-msm@vger.kernel.org,
"Johan Hovold" <johan+linaro@kernel.org>,
"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
"Yicong Yang" <yangyicong@hisilicon.com>,
"Guanbing Huang" <albanhuang@tencent.com>,
"Thomas Gleixner" <tglx@linutronix.de>,
linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org
Subject: Re: [PATCH 1/2] serial: port: Don't block system suspend even if bytes are left to xmit
Date: Mon, 27 May 2024 20:54:26 +0300 [thread overview]
Message-ID: <ZlTI0pYuv7_g6x-V@smile.fi.intel.com> (raw)
In-Reply-To: <20240523162207.1.I2395e66cf70c6e67d774c56943825c289b9c13e4@changeid>
On Thu, May 23, 2024 at 04:22:12PM -0700, Douglas Anderson wrote:
> Recently, suspend testing on sc7180-trogdor based devices has started
> to sometimes fail with messages like this:
>
> port a88000.serial:0.0: PM: calling pm_runtime_force_suspend+0x0/0xf8 @ 28934, parent: a88000.serial:0
> port a88000.serial:0.0: PM: dpm_run_callback(): pm_runtime_force_suspend+0x0/0xf8 returns -16
> port a88000.serial:0.0: PM: pm_runtime_force_suspend+0x0/0xf8 returned -16 after 33 usecs
> port a88000.serial:0.0: PM: failed to suspend: error -16
>
> I could reproduce these problem by logging in via an agetty on the
> debug serial port (which was _not_ used for kernel console) and
> running:
> cat /var/log/messages
> ...and then (via an SSH session) forcing a few suspend/resume cycles.
>
> Tracing through the code and doing some printf debugging shows that
printf()
...or...
printf()-based
> the -16 (-EBUSY) comes from the recently added
> serial_port_runtime_suspend().
>
> The idea of the serial_port_runtime_suspend() function is to prevent
> the port from being _runtime_ suspended if it still has bytes left to
> transmit. Having bytes left to transmit isn't a reason to block
> _system_ suspend, though. The DEFINE_RUNTIME_DEV_PM_OPS() used by the
> serial_port code means that the system suspend function will be
> pm_runtime_force_suspend(). In pm_runtime_force_suspend() we can see
> that before calling the runtime suspend function we'll call
> pm_runtime_disable(). This should be a reliable way to detect that
> we're called from system suspend and that we shouldn't look for
> busyness.
...
> + /*
> + * We only want to check the busyness of the port if PM Runtime is
> + * enabled. Specifically PM Runtime will be disabled by
> + * pm_runtime_force_suspend() during system suspend and we don't want
> + * to block system suspend even if there is data still left to
> + * transmit. We only want to block regulator PM Runtime transitions.
regular
> + */
> + if (!pm_runtime_enabled(dev))
> + return 0;
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2024-05-27 17:54 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-23 23:22 [PATCH 0/2] serial: Fix problems when serial transfer is happening at suspend time Douglas Anderson
2024-05-23 23:22 ` [PATCH 1/2] serial: port: Don't block system suspend even if bytes are left to xmit Douglas Anderson
2024-05-24 0:25 ` Stephen Boyd
2024-05-24 15:20 ` Doug Anderson
2024-05-27 17:54 ` Andy Shevchenko [this message]
2024-05-23 23:22 ` [PATCH 2/2] serial: qcom-geni: Fix qcom_geni_serial_stop_tx_fifo() while xfer Douglas Anderson
2024-05-24 0:38 ` Stephen Boyd
2024-05-25 0:17 ` Doug Anderson
2024-05-30 22:50 ` Doug Anderson
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=ZlTI0pYuv7_g6x-V@smile.fi.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=albanhuang@tencent.com \
--cc=dianders@chromium.org \
--cc=gregkh@linuxfoundation.org \
--cc=jirislaby@kernel.org \
--cc=johan+linaro@kernel.org \
--cc=john.ogness@linutronix.de \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=tglx@linutronix.de \
--cc=tony@atomide.com \
--cc=u.kleine-koenig@pengutronix.de \
--cc=yangyicong@hisilicon.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