mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-30 08:04:13 +08:00
arc: add show_stack_loglvl()
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. Introduce show_stack_loglvl(), that eventually will substitute show_stack(). As a good side-effect header "Stack Trace:" is now printed with the same log level as the rest of backtrace. [1]: https://lore.kernel.org/lkml/20190528002412.1625-1-dima@arista.com/T/#u Signed-off-by: Dmitry Safonov <dima@arista.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Cc: Vineet Gupta <vgupta@synopsys.com> Link: http://lkml.kernel.org/r/20200418201944.482088-4-dima@arista.com Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
8c49a90987
commit
8ca4d19932
@ -13,7 +13,8 @@
|
|||||||
struct task_struct;
|
struct task_struct;
|
||||||
|
|
||||||
void show_regs(struct pt_regs *regs);
|
void show_regs(struct pt_regs *regs);
|
||||||
void show_stacktrace(struct task_struct *tsk, struct pt_regs *regs);
|
void show_stacktrace(struct task_struct *tsk, struct pt_regs *regs,
|
||||||
|
const char *loglvl);
|
||||||
void show_kernel_fault_diag(const char *str, struct pt_regs *regs,
|
void show_kernel_fault_diag(const char *str, struct pt_regs *regs,
|
||||||
unsigned long address);
|
unsigned long address);
|
||||||
void die(const char *str, struct pt_regs *regs, unsigned long address);
|
void die(const char *str, struct pt_regs *regs, unsigned long address);
|
||||||
|
@ -158,9 +158,11 @@ arc_unwind_core(struct task_struct *tsk, struct pt_regs *regs,
|
|||||||
/* Call-back which plugs into unwinding core to dump the stack in
|
/* Call-back which plugs into unwinding core to dump the stack in
|
||||||
* case of panic/OOPs/BUG etc
|
* case of panic/OOPs/BUG etc
|
||||||
*/
|
*/
|
||||||
static int __print_sym(unsigned int address, void *unused)
|
static int __print_sym(unsigned int address, void *arg)
|
||||||
{
|
{
|
||||||
printk(" %pS\n", (void *)address);
|
const char *loglvl = arg;
|
||||||
|
|
||||||
|
printk("%s %pS\n", loglvl, (void *)address);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -217,17 +219,24 @@ static int __get_first_nonsched(unsigned int address, void *unused)
|
|||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
noinline void show_stacktrace(struct task_struct *tsk, struct pt_regs *regs)
|
noinline void show_stacktrace(struct task_struct *tsk, struct pt_regs *regs,
|
||||||
|
const char *loglvl)
|
||||||
{
|
{
|
||||||
pr_info("\nStack Trace:\n");
|
printk("%s\nStack Trace:\n", loglvl);
|
||||||
arc_unwind_core(tsk, regs, __print_sym, NULL);
|
arc_unwind_core(tsk, regs, __print_sym, (void *)loglvl);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(show_stacktrace);
|
EXPORT_SYMBOL(show_stacktrace);
|
||||||
|
|
||||||
/* Expected by sched Code */
|
/* Expected by sched Code */
|
||||||
|
void show_stack_loglvl(struct task_struct *tsk, unsigned long *sp,
|
||||||
|
const char *loglvl)
|
||||||
|
{
|
||||||
|
show_stacktrace(tsk, NULL, loglvl);
|
||||||
|
}
|
||||||
|
|
||||||
void show_stack(struct task_struct *tsk, unsigned long *sp)
|
void show_stack(struct task_struct *tsk, unsigned long *sp)
|
||||||
{
|
{
|
||||||
show_stacktrace(tsk, NULL);
|
show_stack_loglvl(tsk, sp, KERN_DEFAULT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Another API expected by schedular, shows up in "ps" as Wait Channel
|
/* Another API expected by schedular, shows up in "ps" as Wait Channel
|
||||||
|
@ -240,5 +240,5 @@ void show_kernel_fault_diag(const char *str, struct pt_regs *regs,
|
|||||||
|
|
||||||
/* Show stack trace if this Fatality happened in kernel mode */
|
/* Show stack trace if this Fatality happened in kernel mode */
|
||||||
if (!user_mode(regs))
|
if (!user_mode(regs))
|
||||||
show_stacktrace(current, regs);
|
show_stacktrace(current, regs, KERN_DEFAULT);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user