Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp3917592imj; Tue, 12 Feb 2019 06:55:01 -0800 (PST) X-Google-Smtp-Source: AHgI3IYAticdME1CDONQL9XV5xwzuiyzhKvVyz2hACDHJEzK5hiV9ivYuNFBJECSG8ISGHbzrJKJ X-Received: by 2002:a63:f201:: with SMTP id v1mr3797449pgh.232.1549983301608; Tue, 12 Feb 2019 06:55:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549983301; cv=none; d=google.com; s=arc-20160816; b=mOgDchazLvsHJi6u/+qFdKN6rgiffMvAAdonhL2dhd1U9LErYMryHsBYwB89GcCdyp 9b1pYAGVsVHNLHFwVKdjqOSIaHGNPfTySbUwyaHSaVs0r97YCb4OQXwLhoUlhcns8NT7 9R0T522PiCQUciwwoytDEGebeEbsJ7rODeK/rHtcNF11VcW9cAEu/oxGTC5PcPusvqmG Y/PjBfdi17bH2GJnDJoTF0Npf413MhMsawIZVUBJvniXq+GAKoQfo2RHK6ZlF7qNUnEP VP5uHFpZqKwPICTRqZTvcMHdyZHyDD2AvjYsAklxYnuYai5T/FEw31ALGGJbfdacwYld 6gFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=ct9YZL9gbrZNPS0gQFi+WoI+jOoPA82WRfN/0aydnfw=; b=CLu/B2tQJuadvKWe/1iFc1x3jzlk8MBpr0Kc+f6Bq1iSnrOUD9PC1a/jKgUH+xtBzC ONPQg6ztfd9hLhdKC0OHpxt0ImUC3EuF9eDAK0a9UJRoyT4DEIX2pU6V9mXTRrOPZsUs 8JT+fHMr3eXuIEQ8V5OPZnWqsz3VPLLsX7a65DcuQ4WALxM3hmIMyL5zSkXBHQdagG+X H7242vAAKrOWXucOTrvN2W0k+SJB3QkQ4Axsgzy/9jOvrFhL+19e8R4M+HpUMX0c6x6t cPP4kOwFG/C6+jIXceZJXN0JaFqFF+yZ3JYJ2kyueC9pRgjVcemVY1Oyw3cuBjSHzGr7 0qWg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m15si10753512pgb.425.2019.02.12.06.54.43; Tue, 12 Feb 2019 06:55:01 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730522AbfBLOcZ (ORCPT + 99 others); Tue, 12 Feb 2019 09:32:25 -0500 Received: from Galois.linutronix.de ([146.0.238.70]:43774 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730270AbfBLOae (ORCPT ); Tue, 12 Feb 2019 09:30:34 -0500 Received: from [5.158.153.53] (helo=linux.lab.linutronix.de.) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1gtZ4o-0005Af-NB; Tue, 12 Feb 2019 15:30:22 +0100 From: John Ogness To: linux-kernel@vger.kernel.org Cc: Peter Zijlstra , Petr Mladek , Sergey Senozhatsky , Steven Rostedt , Daniel Wang , Andrew Morton , Linus Torvalds , Greg Kroah-Hartman , Alan Cox , Jiri Slaby , Peter Feiner , linux-serial@vger.kernel.org, Sergey Senozhatsky Subject: [RFC PATCH v1 16/25] printk: implement CON_PRINTBUFFER Date: Tue, 12 Feb 2019 15:29:54 +0100 Message-Id: <20190212143003.48446-17-john.ogness@linutronix.de> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190212143003.48446-1-john.ogness@linutronix.de> References: <20190212143003.48446-1-john.ogness@linutronix.de> X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If the CON_PRINTBUFFER flag is not set, do not replay the history for that console. Signed-off-by: John Ogness --- kernel/printk/printk.c | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index 6c875abd7b17..b97d4195b09a 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c @@ -399,10 +399,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; @@ -1596,8 +1592,12 @@ static void call_console_drivers(u64 seq, const char *ext_text, size_t ext_len, 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; @@ -1822,8 +1822,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; @@ -2224,7 +2222,6 @@ early_param("keep_bootcon", keep_bootcon_setup); void register_console(struct console *newcon) { int i; - unsigned long flags; struct console *bcon = NULL; struct console_cmdline *c; static bool has_preferred; @@ -2340,16 +2337,6 @@ void register_console(struct console *newcon) 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(); -- 2.11.0