mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
To: Petr Mladek <pmladek@suse.com>
Cc: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	"Rafael J . Wysocki" <rjw@rjwysocki.net>,
	linux-kernel@vger.kernel.org,
	Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Subject: Re: [RFC][PATCH 0/4] printk: introduce printing kernel thread
Date: Sat, 25 Mar 2017 09:18:44 +0900	[thread overview]
Message-ID: <20170325001844.GE6356@tigerII.localdomain> (raw)
In-Reply-To: <20170324144308.GA12055@pathway.suse.cz>

On (03/24/17 15:43), Petr Mladek wrote:
[..]
> > we have that thing which we call "old printk" mode, which is not
> > really informative. and my proposal is rename "old" mode and use
> > "printk rescue" mode instead. because we switch to that mode when
> > we are trying to "rescue" kernel logs. so the API can be something
> > like
> > 		printk_rescue_on()
> > 		printk_rescue_off()
> 
> Sounds good to me. Slight problem is that off() does not cause
> stopping the mode if we are nested.
> 
> Just one more attempt inspired by this:
> 
> 		printk_emergency_begin()
> 		printk_emergency_end()
> 
> Note that we actually start this mode automatically also
> with pr_emerg() message.

good. printk_emergency sounds OK to me.

[..]
> > and we've got everything we need to have such a feedback in
> > vprintk_emit():
> > 
> > 	a) console is not suspended so console_unlock() can call console drivers
> > 	b) printk_kthread != NULL
> > 	c) we are not in enforced rescue/emergency mode
> > 	d) `log_next_seq' moves forward (always `true', we are in vprintk_emit())
> > 	e) `console_seq' stands still
> > 
> > so we can have an automatic rescue mode fallback in vprintk_emit().
> > if (a)-(e) are true then we give up on waking up printk_kthread,
> > switch to rescue mode and attempt to console_trylock() directly from
> > vprintk_emit(). the part that sucks here is that we need to give
> > printk_kthread some time to catch up. for instance, if (e) is true
> > for the past 50 invocations of vprintk_emit(), IOW:
> > 
> > 	- we added 50 lines to printk
> > 	- none have been printed on the serial console
> >
> > then we
> > 	- declare rescue
> > 	- do console_trylock() instead of wake_up() //unless in deferred vprintk_emit()
> 
> I am not sure if we are able to distinguish a flood of messages
> from a real emergency situation.

that's one of problems. yes.


> Well, there is a handful of annotated locations at the moment.
> I would start thinking of an automatic detection once we have
> more of them and have more data for a good heuristic.

so my 'automatic emergency' switch is for another case. when we
wake_up() printk_kthread, but it never prints anything. could be
caused by a missing printk_emergency annotation, or something else.


> I still would like to see the kernel parameter/sysfs knob
> that would allow to force the rescue/emergency mode all
> the time ;-)

sure.

	-ss

  reply	other threads:[~2017-03-25  0:20 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-06 12:45 Sergey Senozhatsky
2017-03-06 12:45 ` [RFC][PATCH 1/4] " Sergey Senozhatsky
2017-03-22 16:40   ` Petr Mladek
2017-03-23  5:12     ` Sergey Senozhatsky
2017-03-23 10:40       ` Petr Mladek
2017-03-24  5:20         ` Sergey Senozhatsky
2017-03-06 12:45 ` [RFC][PATCH 2/4] printk: offload printing from wake_up_klogd_work_func() Sergey Senozhatsky
2017-03-17 12:19   ` Petr Mladek
2017-03-18  9:57     ` Sergey Senozhatsky
2017-03-20 16:09       ` Petr Mladek
2017-03-21  4:01         ` Sergey Senozhatsky
2017-03-23  9:00         ` Sergey Senozhatsky
2017-03-23 12:11           ` Petr Mladek
2017-03-06 12:45 ` [RFC][PATCH 3/4] kernel, power: disable printk_kthread in unsafe places Sergey Senozhatsky
2017-03-22 15:38   ` Petr Mladek
2017-03-06 12:45 ` [RFC][PATCH 4/4] printk: enable printk offloading Sergey Senozhatsky
2017-03-22 15:43   ` Petr Mladek
2017-03-22 16:40     ` Sergey Senozhatsky
2017-03-22 17:59 ` [RFC][PATCH 0/4] printk: introduce printing kernel thread Peter Zijlstra
2017-03-23  4:09   ` Sergey Senozhatsky
2017-03-23  8:51     ` Peter Zijlstra
2017-03-24  1:59       ` Sergey Senozhatsky
2017-03-24  4:43         ` Sergey Senozhatsky
2017-03-24 14:43         ` Petr Mladek
2017-03-25  0:18           ` Sergey Senozhatsky [this message]
2017-03-23 12:01   ` Petr Mladek
2017-04-03 11:53 ` Sergey Senozhatsky
2017-04-04 12:59   ` Petr Mladek

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=20170325001844.GE6356@tigerII.localdomain \
    --to=sergey.senozhatsky@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=pmladek@suse.com \
    --cc=rjw@rjwysocki.net \
    --cc=rostedt@goodmis.org \
    --cc=sergey.senozhatsky.work@gmail.com \
    --cc=torvalds@linux-foundation.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®