mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Petr Mladek <pmladek@suse.com>
To: Andrew Morton <akpm@linux-foundation.org>,
	Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
Cc: Jiri Kosina <jkosina@suse.com>, Jan Kara <jack@suse.com>,
	Tejun Heo <tj@kernel.org>,
	Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>,
	Byungchul Park <byungchul.park@lge.com>,
	linux-kernel@vger.kernel.org, Petr Mladek <pmladek@suse.com>
Subject: [PATCH POC 3/4] printk: Flush the cont buffer after the other lines
Date: Fri, 15 Jul 2016 18:59:01 +0200	[thread overview]
Message-ID: <1468601942-18482-4-git-send-email-pmladek@suse.com> (raw)
In-Reply-To: <1468601942-18482-1-git-send-email-pmladek@suse.com>

The cont buffer is not longer blocked until the rest of
the line is stored. Instead, the remaining part of the line
is printed from the ring buffer in the normal cycle.

Therefore console_cont_flush() always prints only
the very last line and it makes sense to call it
after the main cycle.

Note that it is safe to modify exclusive_console
and console_locked variables without the logbuf_lock.
They both are primary synchronized by the console_sem.
---
 kernel/printk/printk.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index 7d93ac263006..a920cc36c24e 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -2258,9 +2258,6 @@ again:
 		return;
 	}
 
-	/* flush buffered message fragment immediately to console */
-	console_cont_flush(text, sizeof(text));
-
 	for (;;) {
 		struct printk_log *msg;
 		size_t ext_len = 0;
@@ -2334,14 +2331,17 @@ again:
 		if (do_cond_resched)
 			cond_resched();
 	}
-	console_locked = 0;
+
+	raw_spin_unlock(&logbuf_lock);
+
+	/* flush buffered message fragment immediately to console */
+	console_cont_flush(text, sizeof(text));
 
 	/* Release the exclusive_console once it is used */
 	if (unlikely(exclusive_console))
 		exclusive_console = NULL;
 
-	raw_spin_unlock(&logbuf_lock);
-
+	console_locked = 0;
 	up_console_sem();
 
 	/*
-- 
1.8.5.6

  parent reply	other threads:[~2016-07-15 16:59 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-15 16:58 [PATCH POC 0/4] printk: Several fixes of cont buffer and console handling Petr Mladek
2016-07-15 16:58 ` [PATCH POC 1/4] printk: Prepeparation for fake cont buffers Petr Mladek
2016-07-15 18:26   ` kbuild test robot
2016-07-15 16:59 ` [PATCH POC 2/4] printk: Do not block cont buffer by partially flushed lines Petr Mladek
2016-07-15 18:31   ` kbuild test robot
2016-07-15 22:08   ` kbuild test robot
2016-07-15 16:59 ` Petr Mladek [this message]
2016-07-15 16:59 ` [PATCH POC 4/4] printk: Correctly replay buffer log for a new console Petr Mladek
2016-07-15 18:27   ` kbuild test robot

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=1468601942-18482-4-git-send-email-pmladek@suse.com \
    --to=pmladek@suse.com \
    --cc=akpm@linux-foundation.org \
    --cc=byungchul.park@lge.com \
    --cc=jack@suse.com \
    --cc=jkosina@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=penguin-kernel@I-love.SAKURA.ne.jp \
    --cc=sergey.senozhatsky.work@gmail.com \
    --cc=tj@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

all inboxes | Powered by JetHome®