Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1444448

[PATCH POC 3/4] printk: Flush the cont buffer after the other lines

From Petr Mladek <pmladek@suse.com>
Newsgroups linux.kernel
Subject [PATCH POC 3/4] printk: Flush the cont buffer after the other lines
Date 2016-07-15 19:00 +0200
Message-ID <rVeCZ-QX-7@gated-at.bofh.it> (permalink)
References <rVeCZ-QX-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH POC 0/4] printk: Several fixes of cont buffer and console handling Petr Mladek <pmladek@suse.com> - 2016-07-15 19:00 +0200
  [PATCH POC 3/4] printk: Flush the cont buffer after the other lines Petr Mladek <pmladek@suse.com> - 2016-07-15 19:00 +0200
  [PATCH POC 1/4] printk: Prepeparation for fake cont buffers Petr Mladek <pmladek@suse.com> - 2016-07-15 19:00 +0200
    Re: [PATCH POC 1/4] printk: Prepeparation for fake cont buffers kbuild test robot <lkp@intel.com> - 2016-07-15 20:30 +0200
  [PATCH POC 4/4] printk: Correctly replay buffer log for a new console Petr Mladek <pmladek@suse.com> - 2016-07-15 19:00 +0200
    Re: [PATCH POC 4/4] printk: Correctly replay buffer log for a new  console kbuild test robot <lkp@intel.com> - 2016-07-15 20:30 +0200
  [PATCH POC 2/4] printk: Do not block cont buffer by partially flushed lines Petr Mladek <pmladek@suse.com> - 2016-07-15 19:10 +0200
    Re: [PATCH POC 2/4] printk: Do not block cont buffer by partially  flushed lines kbuild test robot <lkp@intel.com> - 2016-07-15 20:30 +0200
    Re: [PATCH POC 2/4] printk: Do not block cont buffer by partially  flushed lines kbuild test robot <lkp@intel.com> - 2016-07-16 00:10 +0200

csiph-web