public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>,
	"Qixuan.Wu" <qixuan.wu@linux.alibaba.com>,
	linux-kernel-owner <linux-kernel-owner@vger.kernel.org>,
	Petr Mladek <pmladek@suse.com>, Jan Kara <jack@suse.cz>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	Sergey Senozhatsky <sergey.senozhatsky@gmail.com>,
	"chenggang.qin" <chenggang.qin@linux.alibaba.com>,
	caijingxian <caijingxian@linux.alibaba.com>,
	"yuanliang.wyl" <yuanliang.wyl@alibaba-inc.com>
Subject: Re: Would you help to tell why async printk solution was not taken to upstream kernel ?
Date: Tue, 6 Mar 2018 11:00:26 +0900	[thread overview]
Message-ID: <20180306020026.GB6713@jagdpanzerIV> (raw)
In-Reply-To: <20180305154524.2056b773@gandalf.local.home>

On (03/05/18 15:45), Steven Rostedt wrote:
> On Mon, 5 Mar 2018 11:14:16 +0900
> Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> wrote:
> 
> > It can print more than "one full buffer worth". In theory and on practice.
> 
> How so? As soon as another process adds to the buffer, it will take
> over the printing.

The very same CPU which holds the console_sem can add messages to the
logbuf.

There are at least 3 cases I can easily think of.


#1 preemption under console_sem

console_lock()
 for (;;) {
  local_irq_save()
  call_console_drivers()
  local_irq_restore()
  << preemption >>
       printk // from another task, same CPU
 }


#2 IRQ->printk under console_sem

console_lock()
 for (;;) {
  local_irq_save()
  call_console_drivers()
  local_irq_restore()
  << IRQ >>
       printk
 }


#3 This, eventually, becomes #2. But the root cause and, thus,
probability are completely different. printks from console drivers
(some console drivers are really complex, with dependencies on timers,
networking, etc. etc.). We currently handle those via
printk_safe -> IRQ work. But I think we kinda should stop doing so.

console_lock()
 for (;;) {
  local_irq_save()
  call_console_drivers()
   printk()
  local_irq_restore()
 }

	-ss

  reply	other threads:[~2018-03-06  2:00 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1eb584e2-a479-46dd-8a25-820da7a34e85.qixuan.wu@linux.alibaba.com>
2018-03-04 13:01 ` Would you help to tell why async printk solution was not taken to upstream kernel ? Sergey Senozhatsky
2018-03-04 15:08   ` Qixuan.Wu
2018-03-04 15:43     ` Steven Rostedt
2018-03-05  2:14       ` Sergey Senozhatsky
2018-03-05 20:45         ` Steven Rostedt
2018-03-06  2:00           ` Sergey Senozhatsky [this message]
2018-03-06  2:47             ` Steven Rostedt
2018-03-06  2:53               ` Sergey Senozhatsky
2018-03-06  3:16                 ` Steven Rostedt
2018-03-06  8:10                   ` Sergey Senozhatsky
2018-03-05 20:58         ` Steven Rostedt
2018-03-06  1:52           ` Sergey Senozhatsky
2018-03-06  2:43             ` Sergey Senozhatsky
2018-03-06  3:18               ` Steven Rostedt
2018-03-05  6:56       ` Qixuan.Wu
2018-03-05 13:29         ` 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=20180306020026.GB6713@jagdpanzerIV \
    --to=sergey.senozhatsky.work@gmail.com \
    --cc=caijingxian@linux.alibaba.com \
    --cc=chenggang.qin@linux.alibaba.com \
    --cc=jack@suse.cz \
    --cc=linux-kernel-owner@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pmladek@suse.com \
    --cc=qixuan.wu@linux.alibaba.com \
    --cc=rostedt@goodmis.org \
    --cc=sergey.senozhatsky@gmail.com \
    --cc=yuanliang.wyl@alibaba-inc.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