[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191106132516.GC5808@willie-the-truck>
Date: Wed, 6 Nov 2019 13:25:17 +0000
From: Will Deacon <will@...nel.org>
To: Dmitry Safonov <dima@...sta.com>
Cc: linux-kernel@...r.kernel.org,
Dmitry Safonov <0x7f454c46@...il.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Ingo Molnar <mingo@...nel.org>, Jiri Slaby <jslaby@...e.com>,
Petr Mladek <pmladek@...e.com>,
Sergey Senozhatsky <sergey.senozhatsky@...il.com>,
Steven Rostedt <rostedt@...dmis.org>,
Tetsuo Handa <penguin-kernel@...ove.SAKURA.ne.jp>,
Catalin Marinas <catalin.marinas@....com>,
Russell King <linux@...linux.org.uk>,
linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH 09/50] arm64: Add loglvl to dump_backtrace()
On Wed, Nov 06, 2019 at 03:05:00AM +0000, Dmitry Safonov wrote:
> Currently, the log-level of show_stack() depends on a platform
> realization. It creates situations where the headers are printed with
> lower log level or higher than the stacktrace (depending on
> a platform or user).
>
> Furthermore, it forces the logic decision from user to an architecture
> side. In result, some users as sysrq/kdb/etc are doing tricks with
> temporary rising console_loglevel while printing their messages.
> And in result it not only may print unwanted messages from other CPUs,
> but also omit printing at all in the unlucky case where the printk()
> was deferred.
>
> Introducing log-level parameter and KERN_UNSUPPRESSED [1] seems
> an easier approach than introducing more printk buffers.
> Also, it will consolidate printings with headers.
>
> Add log level argument to dump_backtrace() as a preparation for
> introducing show_stack_loglvl().
>
> Cc: Catalin Marinas <catalin.marinas@....com>
> Cc: Russell King <linux@...linux.org.uk>
> Cc: Will Deacon <will@...nel.org>
> Cc: linux-arm-kernel@...ts.infradead.org
> [1]: https://lore.kernel.org/lkml/20190528002412.1625-1-dima@arista.com/T/#u
> Signed-off-by: Dmitry Safonov <dima@...sta.com>
> ---
> arch/arm64/include/asm/stacktrace.h | 3 ++-
> arch/arm64/kernel/process.c | 2 +-
> arch/arm64/kernel/traps.c | 17 +++++++++--------
> 3 files changed, 12 insertions(+), 10 deletions(-)
[...]
> diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c
> index 34739e80211b..59072c7b9fb4 100644
> --- a/arch/arm64/kernel/traps.c
> +++ b/arch/arm64/kernel/traps.c
> @@ -52,9 +52,9 @@ static const char *handler[]= {
>
> int show_unhandled_signals = 0;
>
> -static void dump_backtrace_entry(unsigned long where)
> +static void dump_backtrace_entry(unsigned long where, const char *loglvl)
> {
> - printk(" %pS\n", (void *)where);
> + printk("%s %pS\n", loglvl, (void *)where);
> }
>
> static void dump_kernel_instr(const char *lvl, struct pt_regs *regs)
> @@ -82,12 +82,13 @@ static void dump_kernel_instr(const char *lvl, struct pt_regs *regs)
> printk("%sCode: %s\n", lvl, str);
> }
>
> -void dump_backtrace(struct pt_regs *regs, struct task_struct *tsk)
> +void dump_backtrace(struct pt_regs *regs, struct task_struct *tsk,
> + const char *loglvl)
> {
> struct stackframe frame;
> int skip = 0;
>
> - pr_debug("%s(regs = %p tsk = %p)\n", __func__, regs, tsk);
> + printk("%s%s(regs = %p tsk = %p)\n", loglvl, __func__, regs, tsk);
This one needs to stay as pr_debug().
Will
Powered by blists - more mailing lists