public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Petr Mladek <pmladek@suse.com>
To: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Jan Kara <jack@suse.cz>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] printk/nmi: avoid direct printk()-s from __printk_nmi_flush()
Date: Thu, 1 Sep 2016 10:17:33 +0200	[thread overview]
Message-ID: <20160901081732.GV4866@pathway.suse.cz> (raw)
In-Reply-To: <20160901075507.GA504@swordfish>

On Thu 2016-09-01 16:55:07, Sergey Senozhatsky wrote:
> On (08/30/16 13:19), Petr Mladek wrote:
> > 
> > I see. But then we will need to be more careful because printk_func
> > and printk_func_saved will be manipulated in different contexts:
> > normal, irq, nmi. A solution might be using an atomic counter
> > and selecting the right vprintk_func according to the value.
> 
> alt_printk_enter() must be done with local IRQs disabled. so IRQ cannot
> race with `normal' alt_printk. other IRQs cannot race with the current IRQ,
> because we have local IRQs disabled. the only thing that can race here is - NMI.
> both `normal' and IRQ alt_printk can use the same per-CPU buffer, they never
> race. NMI needs to have its own.

Yes. Well, my concern was how to atomically change the printk_func
pointer and save the previous value at the same time. You could not
use locks because NMIs are involved.

Best Regards,
Petr

      reply	other threads:[~2016-09-01  8:17 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-29 12:32 [PATCH] printk/nmi: avoid direct printk()-s from __printk_nmi_flush() Sergey Senozhatsky
2016-08-29 15:16 ` Petr Mladek
2016-08-30  1:07   ` Sergey Senozhatsky
2016-08-30  7:58   ` Sergey Senozhatsky
2016-08-30  9:04     ` Petr Mladek
2016-08-30  9:39       ` Sergey Senozhatsky
2016-08-30 11:19         ` Petr Mladek
2016-08-31  4:00           ` Sergey Senozhatsky
2016-09-01  7:55           ` Sergey Senozhatsky
2016-09-01  8:17             ` Petr Mladek [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=20160901081732.GV4866@pathway.suse.cz \
    --to=pmladek@suse.com \
    --cc=akpm@linux-foundation.org \
    --cc=jack@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sergey.senozhatsky.work@gmail.com \
    --cc=sergey.senozhatsky@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