From: Petr Mladek <pmladek@suse.cz>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Steven Rostedt <rostedt@goodmis.org>,
linux-kernel@vger.kernel.org, jkosina@suse.cz,
paulmck@linux.vnet.ibm.com, Ingo Molnar <mingo@kernel.org>,
Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [RFC][PATCH] printk: Fixup the nmi printk mess
Date: Fri, 12 Jun 2015 16:28:05 +0200 [thread overview]
Message-ID: <20150612142805.GI9409@pathway.suse.cz> (raw)
In-Reply-To: <20150612120037.GR3644@twins.programming.kicks-ass.net>
On Fri 2015-06-12 14:00:37, Peter Zijlstra wrote:
> On Thu, Jun 11, 2015 at 04:55:47PM +0200, Petr Mladek wrote:
> > > + * 'Consume' this chunk, avoids concurrent callers printing the same
> > > + * stuff.
> > > + */
> > > + if (atomic_cmpxchg(&s->read, i, len) != i)
> > > + goto again;
> >
> > I think that this is racy:
>
> Indeed. I'll think a bit on that.
>
> > I think that ordering CPUs is not worth it. I would go back to the
> > first solution, add the @lock there, and double check races with
> > seq_buf().
>
> You mean, provide printk_nmi_flush() but completely screw concurrency?
> And basically reserve it for a last ditch effort for getting crap out?
This looks much easier to me. We could call this only when the system
is going down.
Another possibility would be to ignore this race because it is rather
theoretical and it better to print some mess than nothing.
I wonder what Andrew thinks about it. I really admired the atomic
operations in the 2nd patch but I was also scared by them.
Note that I have already had two attempts to make printk() safe in
NMI. The first one was too precise, too complicated, and thus
rejected, see https://lkml.org/lkml/2014/6/10/388.
The second one was rather defensive and quite simple. It has not
been completely rejected but there is still some resistance to
accept non-trivial code for handling printk() in NMI, see
https://lkml.org/lkml/2015/5/29/699
I hope that your approach has a chance if we do not make it too
complicated. The big plus is that it generalizes the already used
solution for arch_trigger_all_cpu_backtrace() and the
1st variant was rather easy but quite functional.
Best Regards,
Petr
next prev parent reply other threads:[~2015-06-12 14:28 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-10 12:55 [RFC][PATCH] printk: Fixup the nmi printk mess Peter Zijlstra
2015-06-10 14:31 ` Petr Mladek
2015-06-10 14:57 ` Petr Mladek
2015-06-10 15:32 ` Peter Zijlstra
2015-06-10 15:54 ` Steven Rostedt
2015-06-10 15:29 ` Peter Zijlstra
2015-06-10 19:23 ` Peter Zijlstra
2015-06-10 19:36 ` Peter Zijlstra
2015-06-10 19:36 ` Steven Rostedt
2015-06-11 14:55 ` Petr Mladek
2015-06-12 12:00 ` Peter Zijlstra
2015-06-12 14:28 ` Petr Mladek [this message]
2015-06-12 15:35 ` Petr Mladek
2015-06-25 18:14 ` Peter Zijlstra
2015-06-26 8:06 ` Petr Mladek
2015-06-11 9:57 ` Petr Mladek
2015-06-10 15:53 ` Steven Rostedt
2015-06-10 16:02 ` Steven Rostedt
2015-06-10 16:19 ` Joe Perches
2015-06-10 19:25 ` Peter Zijlstra
2015-06-10 19:35 ` Steven Rostedt
2015-06-10 19:39 ` Joe Perches
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=20150612142805.GI9409@pathway.suse.cz \
--to=pmladek@suse.cz \
--cc=jkosina@suse.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=paulmck@linux.vnet.ibm.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
/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