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>,
	Steven Rostedt <rostedt@goodmis.org>,
	linux-kernel@vger.kernel.org,
	Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Subject: Re: [PATCHv2] printk: CON_PRINTBUFFER console registration is a bit racy
Date: Wed, 3 Oct 2018 21:27:26 +0900	[thread overview]
Message-ID: <20181003122726.GB30267@tigerII.localdomain> (raw)
In-Reply-To: <20181003092349.a6h5tprezkfo2xcu@pathway.suse.cz>

On (10/03/18 11:23), Petr Mladek wrote:
> On Fri 2018-09-28 18:53:04, Sergey Senozhatsky wrote:
> > CON_PRINTBUFFER console registration requires us to do several
> > preparation steps:
> > - Rollback console_seq to replay logbuf messages which were already
> >   seen on other consoles;
> > - Set exclusive_console flag so console_unlock() will ->write() logbuf
> >   messages only to the exclusive_console driver.
> > 
> > The way we do it, however, is a bit racy
> > 
> > 	logbuf_lock_irqsave(flags);
> > 	console_seq = syslog_seq;
> > 	console_idx = syslog_idx;
> > 	logbuf_unlock_irqrestore(flags);
> > 						<< preemption enabled
> > 						<< irqs enabled
> > 	exclusive_console = newcon;
> > 	console_unlock();
> > 
> > We rollback console_seq under logbuf_lock with IRQs disabled, but
> > we set exclusive_console with local IRQs enabled and logbuf unlocked.
> > If the system oops-es or panic-s before we set exclusive_console - and
> > given that we have IRQs and preemption enabled there is such a
> > possibility - we will re-play all logbuf messages to every registered
> > console, which may be a bit annoying and time consuming.
> > 
> > Move exclusive_console assignment to the same IRQs-disabled and
> > logbuf_lock-protected section where we rollback console_seq.
> > 
> > Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
> 
> JFYI, I have just pushed this into printk.git, for-4.20 branch.

Thanks.

	-ss

      reply	other threads:[~2018-10-03 12:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-28  9:53 Sergey Senozhatsky
2018-10-03  9:23 ` Petr Mladek
2018-10-03 12:27   ` 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=20181003122726.GB30267@tigerII.localdomain \
    --to=sergey.senozhatsky@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pmladek@suse.com \
    --cc=rostedt@goodmis.org \
    --cc=sergey.senozhatsky.work@gmail.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 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®