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


Groups > linux.kernel > #1681623 > unrolled thread

Re: [RFC][PATCHv3 2/5] printk: introduce printing kernel thread

Started byPavel Machek <pavel@ucw.cz>
First post2017-07-05 18:10 +0200
Last post2017-07-05 18:40 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [RFC][PATCHv3 2/5] printk: introduce printing kernel thread Pavel Machek <pavel@ucw.cz> - 2017-07-05 18:10 +0200
    Re: [RFC][PATCHv3 2/5] printk: introduce printing kernel thread Sergey Senozhatsky <sergey.senozhatsky@gmail.com> - 2017-07-05 18:40 +0200

#1681623 — Re: [RFC][PATCHv3 2/5] printk: introduce printing kernel thread

FromPavel Machek <pavel@ucw.cz>
Date2017-07-05 18:10 +0200
SubjectRe: [RFC][PATCHv3 2/5] printk: introduce printing kernel thread
Message-ID<tZV2i-8vO-23@gated-at.bofh.it>
On Mon 2017-07-03 20:11:30, Sergey Senozhatsky wrote:
> On (06/30/17 22:38), Sergey Senozhatsky wrote:
> > On (06/30/17 15:16), Petr Mladek wrote:
> > > Anyway, the handshake during offloading might be pretty
> > > problematic. To be honest, I do not have much experience
> > > with it. I have shared some my fears in the other mail[1].
> > > Jan Kara spent a lot of time on this and probably could
> > > say more.
> > > 
> > > Maybe, we could try to look into the throotling path. Slowing down
> > > massive printk() callers looks necessary when things gets
> > > out of control.
> > 
> > throttling, in some form, is already there. I think.
> > 
> > there is a printk_delay() function. which we can silently activate
> > when things don't look cool anymore. and printk_delay() is already
> > getting called on every vprintk_emit() entry. the question is -- how
> > big should be our delay value, and... when do we need to activate
> > printk_delay()?
> > 
> > when the distance between console_seq and log_next_seq... suggests
> > that we will drop (overwrite) un-flushed messages sooner than console_seq
> > reaches log_next_seq? so log_next_seq is closer to log_first_seq than
> > console_seq to log_next_seq.
> 
> something like below, may be. a sketch, just to demonstrate the
> idea. but, once polished, can go to printk out of series.
> 
> ===8<===8<===8<===
> 
> Throttle printk() callers when we detect that consoles are
> far behind the logbuf: we printed to the consoles 4 times
> less messages than we still have to print.
> 
> Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
> ---
>  kernel/printk/printk.c | 38 ++++++++++++++++++++++++++++++++------
>  1 file changed, 32 insertions(+), 6 deletions(-)
> 
> diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
> index f24d3789faa0..fd546bd95207 100644
> --- a/kernel/printk/printk.c
> +++ b/kernel/printk/printk.c
> @@ -1758,17 +1758,43 @@ static void call_console_drivers(const char *ext_text, size_t ext_len,
>  	}
>  }
>  
> +#define PRINTK_FLOOD_DEFAULT_DELAY	10
> +
>  int printk_delay_msec __read_mostly;

= 10;

> +	if (console_seen < 4 * console_to_see) {
> +		if (printk_delay_msec)
> +			__printk_delay(printk_delay_msec);
> +		else
> +			__printk_delay(PRINTK_FLOOD_DEFAULT_DELAY);

And get rid of if () here? We want to enable delays of 0...
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

[toc] | [next] | [standalone]


#1681651

FromSergey Senozhatsky <sergey.senozhatsky@gmail.com>
Date2017-07-05 18:40 +0200
Message-ID<tZVvl-dV-37@gated-at.bofh.it>
In reply to#1681623
Hello,

On (07/02/17 22:27), Pavel Machek wrote:
[..]
> > +#define PRINTK_FLOOD_DEFAULT_DELAY	10
> > +
> >  int printk_delay_msec __read_mostly;
> 
> = 10;

the idea is to throttle printk() only (and as long as) when we see
that something is not right. like when we added 4 (a random number)
times more messages that we were able to print so far. printk_delay_msec
would throttle all printk calls. there is a difference.

there are some cases that are sort of broken with this automatic
throttling. the simples one is printk() under console_lock().
the harder one is throttling printk() from IRQ context. that
can be risky, in theory. may be I'm overcomplicating here; if
the system has hard locked up due to printk throttling from IRQ,
then probably it was going to lockup anyway.

need to check sysrq-t case, tho.

> > +	if (console_seen < 4 * console_to_see) {
> > +		if (printk_delay_msec)
> > +			__printk_delay(printk_delay_msec);
> > +		else
> > +			__printk_delay(PRINTK_FLOOD_DEFAULT_DELAY);
> 
> And get rid of if () here? We want to enable delays of 0...

this if () is totally useless and stupid, yes. realized after I sent
the mail.

	-ss

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web