All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
To: Petr Mladek <pmladek@suse.com>
Cc: Feng Tang <feng.tang@intel.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>,
	linux-kernel@vger.kernel.org, Kees Cook <keescook@chromium.org>,
	Borislav Petkov <bp@suse.de>,
	ying.huang@intel.com
Subject: Re: [PATCH v2] panic: add an option to replay all the printk message in buffer
Date: Wed, 17 Apr 2019 18:46:14 +0900	[thread overview]
Message-ID: <20190417094614.GB4260@jagdpanzerIV> (raw)
In-Reply-To: <20190417091832.z252cvcf4ktxeamv@pathway.suse.cz>

On (04/17/19 11:18), Petr Mladek wrote:
> > My instant thought would be put the console_unlcok() and similar funcs
> > under CONFIG_PRINTK protection, while adding nop functions in the "else"
> > segment.
> > 
> > But complexer question will be when CONFIG_PRINTK=n, how those console_xxx
> > functions should consider these to make compiled binary smaller (though it
> > rarely happens). would wait for Petr/Sergey/Steven's insights.
> 
> I guess that it is because console_sem is historically used to
> synchronize some unrelated things, espcially in tty code.
> Unfortunately, it is not easy to clean this up.
> 
> For this patch, the best solution seems to be using scnprintf()
> instead of sprintf().

OK, since we have another chance to re-iterate this. Do we really
want to complicate console_unlock() printing loop any further?
Asking off chance, can we return back to the idea of adding enum
FLUSH_PENDING/FLUSH_ALL to console_flush_on_panic()?

Does not look too complex/ugly.

---
-void console_flush_on_panic(void)
+void console_flush_on_panic(enum console_flush_mode flush_mode)
 {
 	/*
 	 * If someone else is holding the console lock, trylock will fail
@@ -2549,6 +2549,10 @@ void console_flush_on_panic(void)
 	 */
 	console_trylock();
 	console_may_schedule = 0;
+	if (flush_mode == FLUSH_ALL) {
+		console_seq = log_first_seq;
+		console_idx = log_first_idx;
+	}
 	console_unlock();
 }
---

	-ss

  reply	other threads:[~2019-04-17  9:46 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-10 15:37 [PATCH v2] panic: add an option to replay all the printk message in buffer Feng Tang
2019-04-17  4:19 ` Andrew Morton
2019-04-17  6:48   ` Feng Tang
2019-04-17  9:18     ` Petr Mladek
2019-04-17  9:46       ` Sergey Senozhatsky [this message]
2019-04-17 10:50         ` Sergey Senozhatsky
2019-04-17 12:24           ` Petr Mladek
2019-04-17 15:18             ` Feng Tang
2019-04-18  0:00               ` Sergey Senozhatsky
2019-04-18  7:45                 ` Petr Mladek
2019-04-18  9:00                   ` Feng Tang
2019-04-18 11:01                     ` Petr Mladek
2019-04-19  2:08                       ` Feng Tang
2019-04-18 10:50                   ` Sergey Senozhatsky

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=20190417094614.GB4260@jagdpanzerIV \
    --to=sergey.senozhatsky.work@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=bp@suse.de \
    --cc=feng.tang@intel.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pmladek@suse.com \
    --cc=rostedt@goodmis.org \
    --cc=ying.huang@intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.