From: Sergey Senozhatsky <senozhatsky@chromium.org>
To: Petr Mladek <pmladek@suse.com>
Cc: Luo Jiaxing <luojiaxing@huawei.com>,
sergey.senozhatsky@gmail.com, rostedt@goodmis.org,
john.ogness@linutronix.de, linux-kernel@vger.kernel.org,
Sergey Senozhatsky <senozhatsky@chromium.org>,
linuxarm@huawei.com, bobo.shaobowang@huawei.com
Subject: Re: [PATCH] printk: stop spining waiter when console resume to flush prb
Date: Thu, 6 May 2021 23:07:19 +0900 [thread overview]
Message-ID: <YJP4F1UIt/eRZ96s@google.com> (raw)
In-Reply-To: <YJPxj83F1sBjHHAE@alley>
Thanks for Cc-ing Petr
On (21/05/06 15:39), Petr Mladek wrote:
>
> Many printk messages might get accumulated when consoles were suspended.
> They are proceed when console_unlock() is called in resume_console().
>
> The possibility to pass the console lock owner was added to reduce the risk
> of softlockup when too many messages were handled in an atomic context.
>
> Now, resume_console() is always in a preemptible context that is safe
> to handle all accumulated messages. The possibility to pass the console
> lock owner actually makes things worse. The new owner might be in an atomic
> context and might cause softlockup when processing all messages accumulated
> when the console was suspended.
>
> Create new console_unlock_preemptible() that will not allow to pass
> the console lock owner. As a result, all accumulated messages will
> be proceed in the safe preemptible process.
If we have a lot of pending messages in the logbuf, then there is
something chatty - some context (task, irq) or maybe several contexts.
And those contexts can continue adding messages, while we print them
_exclusively_ from preemptible context only. without ever throttling down
printk() callers - something that console_owner spinning and handover
does for us. And those printk() callers can even preempt
console_unlock_preemptible() and cause delays and lost messages.
In this regard, I'm afraid, console_unlock_preemptible() is somewhat
similar, IMHO, to the solution which we reverted - removal of
preempt_disable() before console_unlock() in vprintk_emit().
How about this.
Can we count the number of lines that we print from the `current` context
in console_unlock() and if after N messages there is no console_lock waiter
waiting for the `current` to handover console lock ownership, then create
one: schedule IRQ work that will become a console lock owner, spin on
console lock and call console_unlock() once it acquired the ownership.
That 'artificial' console lock owner will do the same - print N
messages, if nothing wants to become a console lock owner then it'll
queue another IRQ work.
next prev parent reply other threads:[~2021-05-06 14:07 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-06 8:00 [PATCH] printk: stop spining waiter when console resume to flush prb Luo Jiaxing
2021-05-06 13:13 ` Steven Rostedt
2021-05-07 8:35 ` luojiaxing
2021-05-06 13:39 ` Petr Mladek
2021-05-06 14:07 ` Sergey Senozhatsky [this message]
2021-05-06 14:12 ` Sergey Senozhatsky
2021-05-06 15:14 ` John Ogness
2021-05-07 7:58 ` luojiaxing
2021-05-07 7:33 ` luojiaxing
2021-05-07 7:49 ` Sergey Senozhatsky
2021-05-07 16:36 ` Petr Mladek
2021-05-10 8:26 ` Sergey Senozhatsky
2021-05-10 10:17 ` Petr Mladek
2021-05-10 10:32 ` John Ogness
2021-05-10 11:16 ` Sergey Senozhatsky
2021-05-10 11:43 ` Sergey Senozhatsky
2021-05-07 16:13 ` Petr Mladek
2021-05-10 8:29 ` luojiaxing
2021-05-10 9:50 ` Petr Mladek
2021-05-10 12:06 ` Sergey Senozhatsky
2021-05-10 7:41 ` luojiaxing
2021-05-10 9:30 ` Petr Mladek
2021-05-11 7:32 ` luojiaxing
2021-05-11 9:08 ` Petr Mladek
2021-05-13 7:55 ` luojiaxing
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=YJP4F1UIt/eRZ96s@google.com \
--to=senozhatsky@chromium.org \
--cc=bobo.shaobowang@huawei.com \
--cc=john.ogness@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxarm@huawei.com \
--cc=luojiaxing@huawei.com \
--cc=pmladek@suse.com \
--cc=rostedt@goodmis.org \
--cc=sergey.senozhatsky@gmail.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 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.