summaryrefslogtreecommitdiffstats
path: root/debian/patches-rt/0016-printk-implement-CON_PRINTBUFFER.patch
blob: 726d6cd66f329f29fa99ae85094b2c267e1b09b2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
From: John Ogness <john.ogness@linutronix.de>
Date: Tue, 12 Feb 2019 15:29:54 +0100
Subject: [PATCH 16/25] printk: implement CON_PRINTBUFFER
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/5.4/older/patches-5.4.17-rt8.tar.xz

If the CON_PRINTBUFFER flag is not set, do not replay the history
for that console.

Signed-off-by: John Ogness <john.ogness@linutronix.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 kernel/printk/printk.c |   34 ++++++----------------------------
 1 file changed, 6 insertions(+), 28 deletions(-)

--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -419,10 +419,6 @@ static u32 log_first_idx;
 static u64 log_next_seq;
 static u32 log_next_idx;
 
-/* the next printk record to write to the console */
-static u64 console_seq;
-static u32 console_idx;
-
 /* the next printk record to read after the last 'clear' command */
 static u64 clear_seq;
 static u32 clear_idx;
@@ -1650,8 +1646,12 @@ static void call_console_drivers(u64 seq
 		if (!(con->flags & CON_ENABLED))
 			continue;
 		if (!con->wrote_history) {
-			printk_write_history(con, seq);
-			continue;
+			if (con->flags & CON_PRINTBUFFER) {
+				printk_write_history(con, seq);
+				continue;
+			}
+			con->wrote_history = 1;
+			con->printk_seq = seq - 1;
 		}
 		if (!con->write)
 			continue;
@@ -1881,8 +1881,6 @@ EXPORT_SYMBOL(printk);
 
 static u64 syslog_seq;
 static u32 syslog_idx;
-static u64 console_seq;
-static u32 console_idx;
 static u64 log_first_seq;
 static u32 log_first_idx;
 static u64 log_next_seq;
@@ -2206,15 +2204,6 @@ void console_flush_on_panic(enum con_flu
 	 */
 	console_trylock();
 	console_may_schedule = 0;
-
-	if (mode == CONSOLE_REPLAY_ALL) {
-		unsigned long flags;
-
-		logbuf_lock_irqsave(flags);
-		console_seq = log_first_seq;
-		console_idx = log_first_idx;
-		logbuf_unlock_irqrestore(flags);
-	}
 	console_unlock();
 }
 
@@ -2293,7 +2282,6 @@ early_param("keep_bootcon", keep_bootcon
 void register_console(struct console *newcon)
 {
 	int i;
-	unsigned long flags;
 	struct console *bcon = NULL;
 	struct console_cmdline *c;
 	static bool has_preferred;
@@ -2409,16 +2397,6 @@ void register_console(struct console *ne
 	if (newcon->flags & CON_EXTENDED)
 		nr_ext_console_drivers++;
 
-	if (newcon->flags & CON_PRINTBUFFER) {
-		/*
-		 * console_unlock(); will print out the buffered messages
-		 * for us.
-		 */
-		logbuf_lock_irqsave(flags);
-		console_seq = syslog_seq;
-		console_idx = syslog_idx;
-		logbuf_unlock_irqrestore(flags);
-	}
 	console_unlock();
 	console_sysfs_notify();