All of lore.kernel.org
 help / color / mirror / Atom feed
From: John Ogness <john.ogness@linutronix.de>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	sashiko-reviews@lists.linux.dev, Petr Mladek <pmladek@suse.com>
Cc: Karl Mehltretter <kmehltretter@gmail.com>,
	linux-kernel@vger.kernel.org, linux-rt-devel@lists.linux.dev
Subject: Re: [PATCH 2/2] serial: amba-pl011: keep console clock enabled for atomic writes
Date: Mon, 20 Jul 2026 10:19:58 +0206	[thread overview]
Message-ID: <8733xeaxix.fsf@jogness.linutronix.de> (raw)
In-Reply-To: <20260720080100.Mk9zZFql@linutronix.de>

On 2026-07-20, Sebastian Andrzej Siewior <bigeasy@linutronix.de> wrote:
> On 2026-07-19 06:52:14 [+0000], sashiko-bot@kernel.org wrote:
>> > diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
>> > index 1aa43994a3cdc..4facd1b350d5d 100644
>> > --- a/drivers/tty/serial/amba-pl011.c
>> > +++ b/drivers/tty/serial/amba-pl011.c
>> > @@ -2523,7 +2523,11 @@ static int pl011_console_setup(struct console *co, char *options)
>> >  	/* Allow pins to be muxed in and configured */
>> >  	pinctrl_pm_select_default_state(uap->port.dev);
>> >  
>> > -	ret = clk_prepare(uap->clk);
>> > +	/*
>> > +	 * Keep the clock enabled while registered because write_atomic() may
>> > +	 * run in NMI context and must not acquire the clock framework lock.
>> > +	 */
>> > +	ret = clk_prepare_enable(uap->clk);
>> 
>> [Severity: High]
>> Will this keep the UART clock unconditionally enabled during system suspend?
>> 
>> Because the persistent clock reference is acquired here during console
>> registration and only dropped on console exit in pl011_console_exit(), the
>> reference remains active.
>> 
>> During system suspend, pl011_suspend() delegates to uart_suspend_port() but
>> fails to drop this console's persistent clock enable reference. This might
>> prevent the SoC from turning off the clock tree or parent PLLs, preventing
>> deep system sleep.
>
> The comment somehow makes sense. What is the general advice here? If we
> drop the clock during suspend and acquire it again during resume we need
> to keep track and ignore all prints in between. Is the printk core
> taking care of this?

This is what the suspend/resume pm callbacks are for. In this case, it
is pl011_suspend() and pl011_resume().

> There is also this no_console_suspend argument…

Yes, the callbacks need to check @console_suspend_enabled. If false, the
clocks obviously must not be disabled.

John Ogness

  reply	other threads:[~2026-07-20  8:14 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-19  6:35 [PATCH 0/2] serial: amba-pl011: fix console clock lifetime Karl Mehltretter
2026-07-19  6:35 ` [PATCH 1/2] serial: amba-pl011: unprepare console clock on unregister Karl Mehltretter
2026-07-19  7:04   ` sashiko-bot
2026-07-19 10:27     ` Karl Mehltretter
2026-07-19  6:35 ` [PATCH 2/2] serial: amba-pl011: keep console clock enabled for atomic writes Karl Mehltretter
2026-07-19  6:52   ` sashiko-bot
2026-07-20  8:01     ` Sebastian Andrzej Siewior
2026-07-20  8:13       ` John Ogness [this message]
2026-07-20  8:26         ` Sebastian Andrzej Siewior
2026-07-20 21:26           ` Karl Mehltretter
2026-07-20 11:45   ` Petr Mladek
2026-07-20 12:15     ` Sebastian Andrzej Siewior

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=8733xeaxix.fsf@jogness.linutronix.de \
    --to=john.ogness@linutronix.de \
    --cc=bigeasy@linutronix.de \
    --cc=kmehltretter@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rt-devel@lists.linux.dev \
    --cc=pmladek@suse.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.