From: Tony Lindgren <tony@atomide.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Jiri Slaby" <jirislaby@kernel.org>,
linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] serial: 8250: Fix PM usage_count for console handover
Date: Wed, 29 Jun 2022 12:21:21 +0300 [thread overview]
Message-ID: <YrwZkTcU9IyY2DhN@atomide.com> (raw)
In-Reply-To: <YrtvOSrrSLGX/coS@smile.fi.intel.com>
* Andy Shevchenko <andriy.shevchenko@linux.intel.com> [220628 21:09]:
> On Tue, Jun 28, 2022 at 07:58:34PM +0300, Ilpo Järvinen wrote:
> > When console is enabled, univ8250_console_setup() calls
> > serial8250_console_setup() before .dev is set to uart_port. Therefore,
> > it will not call pm_runtime_get_sync(). Later, when the actual driver
> > is going to take over univ8250_console_exit() is called. As .dev is
> > already set, serial8250_console_exit() makes pm_runtime_put_sync() call
> > with usage count being zero triggering PM usage count warning
> > (extra debug for univ8250_console_setup(), univ8250_console_exit(), and
> > serial8250_register_ports()):
Hmm so serial8250_console_setup() calls pm_runtime_get_sync() if dev
exists..
> > diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c
> > index 57e86133af4f..2e83e7367441 100644
> > --- a/drivers/tty/serial/8250/8250_core.c
> > +++ b/drivers/tty/serial/8250/8250_core.c
> > @@ -23,6 +23,7 @@
> > #include <linux/sysrq.h>
> > #include <linux/delay.h>
> > #include <linux/platform_device.h>
> > +#include <linux/pm_runtime.h>
> > #include <linux/tty.h>
> > #include <linux/ratelimit.h>
> > #include <linux/tty_flip.h>
> > @@ -558,6 +559,9 @@ serial8250_register_ports(struct uart_driver *drv, struct device *dev)
> >
> > up->port.dev = dev;
> >
> > + if (uart_console_enabled(&up->port))
> > + pm_runtime_get_sync(up->port.dev);
> > +
> > serial8250_apply_quirks(up);
> > uart_add_one_port(drv, &up->port);
> > }
..and now we also call it here. Are there now cases where pm_runtime_get_sync()
gets called twice potentially or does uart_console_enabled() ensure that is
not the case already?
Regards,
Tony
next prev parent reply other threads:[~2022-06-29 9:21 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-28 16:58 [PATCH] serial: 8250: Fix PM usage_count for console handover Ilpo Järvinen
2022-06-28 21:14 ` Andy Shevchenko
2022-06-29 9:21 ` Tony Lindgren [this message]
2022-06-29 9:31 ` Ilpo Järvinen
2022-06-29 9:41 ` Tony Lindgren
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=YrwZkTcU9IyY2DhN@atomide.com \
--to=tony@atomide.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=jirislaby@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@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