linux-kernel.vger.kernel.org archive mirror
 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>,
	Sergey Senozhatsky <sergey.senozhatsky@gmail.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Tejun Heo <tj@kernel.org>, Jan Kara <jack@suse.cz>,
	Calvin Owens <calvinowens@fb.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] printk: introduce should_ignore_loglevel()
Date: Mon, 27 Jun 2016 22:04:30 +0900	[thread overview]
Message-ID: <20160627130430.GA566@swordfish> (raw)
In-Reply-To: <20160627092645.GK29718@pathway.suse.cz>

On (06/27/16 11:26), Petr Mladek wrote:
> On Sat 2016-06-25 14:22:37, Sergey Senozhatsky wrote:
> > On (06/24/16 18:05), Petr Mladek wrote:
> > [..]
> > > > +static bool should_ignore_loglevel(int level)
> > > > +{
> > > > +	return (level >= console_loglevel && !ignore_loglevel);
> > > 
> > > The patch looks fine. It is nice optimization.
> > > 
> > > I was just quite confused by the name of this function. A function
> > > called should_ignore_loglevel() should not return false when
> > > ignore_loglevel variable is true.
> > > 
> > > I would call it ignore_message() or ignore_message_on_console() or so.
> > 
> > Hello Petr, you are right.
> > 
> > I was thinking about
> > 
> > s/should_ignore_loglevel/suppress_message/g
> > or.... s/should_ignore_loglevel/suppress_message_by_level/g
> > s/should_ignore_loglevel/suppress_message_printing/g
> > 
> > suppress_message_printing() is probably fine.
> 
> All variants look fine to me. After renaming, feel free to
> add:
> 
> Reviewed-by: Petr Mladek <pmladek@suse.com>
> 

thanks.

> PS: The ignore_loglevel handling is a bit racy in some situations.
> For example, uv_nmi_dump_state() or __handle_sysrq() set another
> level, print some messages, and restore the original level. They
> do not wait until all the printed messages appear on the console.
> Also they do not synchronize against each other.
>

__handle_sysrq() also assumes that only cpu printk-s, so it does
KERN_CONT printks in SMP mode. and there are billions of places
that do things like this.

as of deferred loglevel check, we probably can add "console_loglevel:3;"
to 'struct printk_log' and `static struct cont', and keep there
console_loglevel actual at the time the was appeneded to the log
buffer. so then suppress_message_printing() will have one extra param

bool suppress_message_printing(int leve, int cons_loglevel)
{
	return (level >= cons_loglevel ...);
}


speaking of KERN_CONT, I've found one regression with async printk,
and I think I now have some idea what's going on there, will post
some-sort-of-a-patch today or tomorrow.


> I am not sure if we have already discussed this. It is not critical
> and it works well most of the time. I just want to make sure that
> you know about it as you have more plans with the printk/console code.

thanks, I'll put in on a list; not sure we discussed this either.

	-ss

      reply	other threads:[~2016-06-27 13:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-23 16:33 [PATCH] printk: introduce should_ignore_loglevel() Sergey Senozhatsky
2016-06-24 16:05 ` Petr Mladek
2016-06-25  5:22   ` Sergey Senozhatsky
2016-06-27  9:26     ` Petr Mladek
2016-06-27 13:04       ` Sergey Senozhatsky [this message]

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=20160627130430.GA566@swordfish \
    --to=sergey.senozhatsky@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=calvinowens@fb.com \
    --cc=jack@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pmladek@suse.com \
    --cc=sergey.senozhatsky.work@gmail.com \
    --cc=tj@kernel.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;
as well as URLs for NNTP newsgroup(s).