mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
To: Petr Mladek <pmladek@suse.com>
Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Jan Kara <jack@suse.cz>, Tejun Heo <tj@kernel.org>,
	Calvin Owens <calvinowens@fb.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Steven Rostedt <rostedt@goodmis.org>,
	Ingo Molnar <mingo@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Andy Lutomirski <luto@kernel.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	linux-kernel@vger.kernel.org,
	Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
Subject: Re: [RFC][PATCHv5 7/7] printk: remove zap_locks() function
Date: Tue, 13 Dec 2016 10:26:06 +0900	[thread overview]
Message-ID: <20161213012606.GC415@jagdpanzerIV.localdomain> (raw)
In-Reply-To: <20161212163727.GF2441@pathway.suse.cz>

On (12/12/16 17:37), Petr Mladek wrote:
> On Thu 2016-12-01 22:55:46, Sergey Senozhatsky wrote:
> > We use printk-safe now which makes printk-recursion detection code
> > in vprintk_emit() unreachable. The tricky thing here is that, apart
> > from detecting and reporting printk recursions, that code also used
> > to zap_locks() in case of panic() from the same CPU. However,
> > zap_locks() does not look to be needed anymore:
> > 
> > 1) Since commit 08d78658f393 ("panic: release stale console lock to
> >    always get the logbuf printed out") panic flushing of `logbuf' to
> >    console ignores the state of `console_sem' by doing
> >    	panic()
> > 		console_trylock();
> > 		console_unlock();
> > 
> > 2) Since commit cf9b1106c81c ("printk/nmi: flush NMI messages on the
> >    system panic") panic attempts to zap the `logbuf_lock' spin_lock to
> >    successfully flush nmi messages to `logbuf'.
> > 
> > Basically, it seems that we either already do what zap_locks() used to
> > do but in other places or we ignore the state of the lock. The only
> > reaming difference is that we don't re-init the console semaphore in
> > printk_safe_flush_on_panic(), but this is not necessary because we
> > don't call console drivers from printk_safe_flush_on_panic() due to
> > the fact that we are using a deferred printk() version (as was
> > suggested by Petr Mladek).
> > 
> > Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
> 
> I like this patch. The code is unused after protecting the section
> by printk_safe_enter()/exit(). And also the panic mode is handled
> by the commits mentioned above.

and the scenario that code tried to address was super-tiny.
basically, a recursion from vscnprintf()/log_output() every 30
seconds (zap_locks() timeout):

	if (unlikely(logbuf_cpu == this_cpu)) {
		zap_locks();
	}

	raw_spin_lock(&logbuf_lock);
	logbuf_cpu = this_cpu;

	text_len = vscnprintf(text, sizeof(textbuf), fmt, args);
	kern_level = printk_get_level(text));
	log_output(facility, level, lflags, dict, dictlen, text, text_len);

	logbuf_cpu = UINT_MAX;
	raw_spin_unlock(&logbuf_lock);

now we cover a much bigger scope.


> Reviewed-by: Petr Mladek <pmladek@suse.com>

thanks.

	-ss

      reply	other threads:[~2016-12-13  1:26 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-01 13:55 [RFC][PATCHv5 0/7] printk: use printk_safe to handle printk() recursive calls Sergey Senozhatsky
2016-12-01 13:55 ` [RFC][PATCHv5 1/7] printk: use vprintk_func in vprintk() Sergey Senozhatsky
2016-12-01 13:55 ` [RFC][PATCHv5 2/7] printk: rename nmi.c and exported api Sergey Senozhatsky
2016-12-01 13:55 ` [RFC][PATCHv5 3/7] printk: introduce per-cpu safe_print seq buffer Sergey Senozhatsky
2016-12-09 16:46   ` Petr Mladek
2016-12-10  3:10     ` Sergey Senozhatsky
2016-12-12 13:54       ` Petr Mladek
2016-12-12 14:12         ` Sergey Senozhatsky
2016-12-12 15:15           ` Petr Mladek
2016-12-12 15:28         ` Sergey Senozhatsky
2016-12-01 13:55 ` [RFC][PATCHv5 4/7] printk: always use deferred printk when flush printk_safe lines Sergey Senozhatsky
2016-12-12 15:20   ` Petr Mladek
2016-12-01 13:55 ` [RFC][PATCHv5 5/7] printk: report lost messages in printk safe/nmi contexts Sergey Senozhatsky
2016-12-12 15:58   ` Petr Mladek
2016-12-13  1:52     ` Sergey Senozhatsky
2016-12-14 10:51       ` Petr Mladek
2016-12-01 13:55 ` [RFC][PATCHv5 6/7] printk: use printk_safe buffers in printk Sergey Senozhatsky
2016-12-12 16:30   ` Petr Mladek
2016-12-13  1:27     ` Sergey Senozhatsky
2016-12-01 13:55 ` [RFC][PATCHv5 7/7] printk: remove zap_locks() function Sergey Senozhatsky
2016-12-12 16:37   ` Petr Mladek
2016-12-13  1:26     ` 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=20161213012606.GC415@jagdpanzerIV.localdomain \
    --to=sergey.senozhatsky.work@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=calvinowens@fb.com \
    --cc=jack@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=pmladek@suse.com \
    --cc=rostedt@goodmis.org \
    --cc=sergey.senozhatsky@gmail.com \
    --cc=tglx@linutronix.de \
    --cc=tj@kernel.org \
    --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®