From: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
To: Petr Mladek <pmladek@suse.com>
Cc: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>,
Jan Kara <jack@suse.cz>,
Andrew Morton <akpm@linux-foundation.org>,
Tejun Heo <tj@kernel.org>, Calvin Owens <calvinowens@fb.com>,
Thomas Gleixner <tglx@linutronix.de>,
Mel Gorman <mgorman@techsingularity.net>,
Steven Rostedt <rostedt@goodmis.org>,
linux-kernel@vger.kernel.org,
Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Subject: Re: [RFC][PATCHv2 3/7] printk: introduce per-cpu alt_print seq buffer
Date: Sat, 8 Oct 2016 04:40:15 +0900 [thread overview]
Message-ID: <20161007194015.GB3496@swordfish> (raw)
In-Reply-To: <20161006145656.GH13369@pathway.suse.cz>
On (10/06/16 16:56), Petr Mladek wrote:
[..]
> > there are many WARN_ON_* on
> > vprintk_alt()->alt_printk_log_store()->vsnprintf() path but they all
> > seem to be calling printk():
> >
> > - WARN_ON_ONCE() from vsnprintf()
> > - WARN_ONCE() from vsnprintf()->format_decode()
> > - WARN_ON vsnprintf()->set_field_width()
> > - WARN_ON from vsnprintf()->set_precision()
> > - WARN_ON from vsnprintf()->pointer()->flags_string()
> >
> > a side note, some of these WARNs are... 'funny'. e.g., to deadlock a
> > system it's enough to just pass an unsupported flag in format string.
> > vsnprintf() will
> > WARN_ONCE(1, "Please remove unsupported %%%c in format string\n", *fmt)
> >
> > but the problem is that we are already in printk():
> >
> > printk()
> > raw_spin_lock(&logbuf_lock)
> > text_len = vscnprintf(text, sizeof(textbuf), fmt, args)
> > WARN_ONCE(1, "Please remove unsupported ...)
> > printk()
> > raw_spin_lock(&logbuf_lock) << deadlock
>
> Just for record. This vscnprintf() is called when logbuf_cpu is set.
> Therefore this particular recursion is not possible at the moment.
ah, indeed. thanks.
> Anyway, I agree that alt_printk_enter() calls might get nested.
> The direct vprintk_emit() calls are one reason. I guess that
> we will need to use the same counter/enter functions also
> for WARN_*DEFERRED(). And it would cause nesting as well.
>
> Therefore we need to be careful about loosing the original
> value of irq flags.
>
> The question is whether we need to store the flags in
> a per-CPU variable. We might also store it on the stack
> of the enter()/exit() function caller. I mean something like
yes, let's keep it on the stack. this particular implementation
was just an experiment, and I hate it. what I currently have in
my tree:
#define alt_printk_enter(flags) \
do { \
local_irq_save(flags); \
__alt_printk_enter(); \
} while (0)
#define alt_printk_exit(flags) \
do { \
__alt_printk_exit(); \
local_irq_restore(flags); \
} while (0)
-ss
next prev parent reply other threads:[~2016-10-10 2:03 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-30 15:17 [RFC][PATCHv2 0/7] printk: use alt_printk to handle printk() recursive calls Sergey Senozhatsky
2016-09-30 15:17 ` [RFC][PATCHv2 1/7] printk: use vprintk_func in vprintk() Sergey Senozhatsky
2016-09-30 15:17 ` [RFC][PATCHv2 2/7] printk: rename nmi.c and exported api Sergey Senozhatsky
2016-09-30 15:17 ` [RFC][PATCHv2 3/7] printk: introduce per-cpu alt_print seq buffer Sergey Senozhatsky
2016-10-01 2:24 ` Sergey Senozhatsky
2016-10-06 14:56 ` Petr Mladek
2016-10-07 19:40 ` Sergey Senozhatsky [this message]
2016-10-10 11:03 ` Petr Mladek
2016-10-06 13:08 ` Petr Mladek
2016-10-07 19:33 ` Sergey Senozhatsky
2016-09-30 15:17 ` [RFC][PATCHv2 4/7] printk: make alt_printk available when config printk set Sergey Senozhatsky
2016-10-06 15:23 ` Petr Mladek
2016-10-07 19:08 ` Sergey Senozhatsky
2016-09-30 15:17 ` [RFC][PATCHv2 5/7] printk: use alternative printk buffers Sergey Senozhatsky
2016-09-30 15:17 ` [RFC][PATCHv2 6/7] printk: report printk recursion from alt_printk flush Sergey Senozhatsky
2016-10-06 15:41 ` Petr Mladek
2016-10-07 18:59 ` Sergey Senozhatsky
2016-10-10 11:02 ` Petr Mladek
2016-09-30 15:17 ` [RFC][PATCHv2 7/7] printk: remove zap_locks() function Sergey Senozhatsky
2016-10-06 15:55 ` [RFC][PATCHv2 0/7] printk: use alt_printk to handle printk() recursive calls Petr Mladek
2016-10-07 18:56 ` Sergey Senozhatsky
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=20161007194015.GB3496@swordfish \
--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=mgorman@techsingularity.net \
--cc=pmladek@suse.com \
--cc=rostedt@goodmis.org \
--cc=sergey.senozhatsky@gmail.com \
--cc=tglx@linutronix.de \
--cc=tj@kernel.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;
as well as URLs for NNTP newsgroup(s).