From: Petr Mladek <pmladek@suse.com>
To: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>,
Steven Rostedt <rostedt@goodmis.org>
Cc: Peter Zijlstra <peterz@infradead.org>,
Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>,
Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>,
linux-kernel@vger.kernel.org, stable@vger.kernel.org,
Petr Mladek <pmladek@suse.com>
Subject: [PATCH v2 1/3] printk: Split the code for storing a message into the log buffer
Date: Wed, 27 Jun 2018 16:08:15 +0200 [thread overview]
Message-ID: <20180627140817.27764-2-pmladek@suse.com> (raw)
In-Reply-To: <20180627140817.27764-1-pmladek@suse.com>
It is just a preparation step. The patch does not change
the existing behavior.
Signed-off-by: Petr Mladek <pmladek@suse.com>
---
kernel/printk/printk.c | 43 ++++++++++++++++++++++++++-----------------
1 file changed, 26 insertions(+), 17 deletions(-)
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index 247808333ba4..a844c611b17c 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -1824,28 +1824,16 @@ static size_t log_output(int facility, int level, enum log_flags lflags, const c
return log_store(facility, level, lflags, 0, dict, dictlen, text, text_len);
}
-asmlinkage int vprintk_emit(int facility, int level,
- const char *dict, size_t dictlen,
- const char *fmt, va_list args)
+/* Must be called under logbuf_lock. */
+int vprintk_store(int facility, int level,
+ const char *dict, size_t dictlen,
+ const char *fmt, va_list args)
{
static char textbuf[LOG_LINE_MAX];
char *text = textbuf;
size_t text_len;
enum log_flags lflags = 0;
- unsigned long flags;
- int printed_len;
- bool in_sched = false;
-
- if (level == LOGLEVEL_SCHED) {
- level = LOGLEVEL_DEFAULT;
- in_sched = true;
- }
-
- boot_delay_msec(level);
- printk_delay();
- /* This stops the holder of console_sem just where we want him */
- logbuf_lock_irqsave(flags);
/*
* The printf needs to come first; we need the syslog
* prefix which might be passed-in as a parameter.
@@ -1886,8 +1874,29 @@ asmlinkage int vprintk_emit(int facility, int level,
if (dict)
lflags |= LOG_PREFIX|LOG_NEWLINE;
- printed_len = log_output(facility, level, lflags, dict, dictlen, text, text_len);
+ return log_output(facility, level, lflags,
+ dict, dictlen, text, text_len);
+}
+asmlinkage int vprintk_emit(int facility, int level,
+ const char *dict, size_t dictlen,
+ const char *fmt, va_list args)
+{
+ int printed_len;
+ bool in_sched = false;
+ unsigned long flags;
+
+ if (level == LOGLEVEL_SCHED) {
+ level = LOGLEVEL_DEFAULT;
+ in_sched = true;
+ }
+
+ boot_delay_msec(level);
+ printk_delay();
+
+ /* This stops the holder of console_sem just where we want him */
+ logbuf_lock_irqsave(flags);
+ printed_len = vprintk_store(facility, level, dict, dictlen, fmt, args);
logbuf_unlock_irqrestore(flags);
/* If called from the scheduler, we can not call up(). */
--
2.13.7
next prev parent reply other threads:[~2018-06-27 14:08 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-27 14:08 [PATCH v2 0/3] printk: Deadlock in NMI regression Petr Mladek
2018-06-27 14:08 ` Petr Mladek [this message]
2018-06-28 2:10 ` [PATCH v2 1/3] printk: Split the code for storing a message into the log buffer Sergey Senozhatsky
2018-06-27 14:08 ` [PATCH v2 2/3] printk: Create helper function to queue deferred console handling Petr Mladek
2018-06-28 2:16 ` Sergey Senozhatsky
2018-06-28 2:19 ` Sergey Senozhatsky
2018-06-27 14:16 ` [PATCH v2 0/3] printk: Deadlock in NMI regression Sergey Senozhatsky
2018-06-27 14:23 ` Sergey Senozhatsky
2018-06-27 14:34 ` Petr Mladek
2018-06-28 9:08 ` Sergey Senozhatsky
2018-06-27 14:20 ` [PATCH v2 3/3] printk/nmi: Prevent deadlock when accessing the main log buffer in NMI Petr Mladek
2018-06-28 2:25 ` Sergey Senozhatsky
2018-06-28 9:41 ` Petr Mladek
2018-06-29 1:47 ` Sergey Senozhatsky
2018-06-29 7:25 ` Petr Mladek
2018-06-29 10:01 ` Sergey Senozhatsky
2018-06-28 2:39 ` [PATCH v2 0/3] printk: Deadlock in NMI regression Sergey Senozhatsky
2018-06-28 10:54 ` Petr Mladek
2018-06-29 1:52 ` Sergey Senozhatsky
2018-07-09 13:27 ` Petr Mladek
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=20180627140817.27764-2-pmladek@suse.com \
--to=pmladek@suse.com \
--cc=linux-kernel@vger.kernel.org \
--cc=penguin-kernel@I-love.SAKURA.ne.jp \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=sergey.senozhatsky.work@gmail.com \
--cc=sergey.senozhatsky@gmail.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;
as well as URLs for NNTP newsgroup(s).