Skip to content

Commit ce23c47

Browse files
0x7f454c46torvalds
authored andcommitted
m68k: 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(). [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: Geert Uytterhoeven <geert@linux-m68k.org> Link: http://lkml.kernel.org/r/20200418201944.482088-18-dima@arista.com Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent ffdac29 commit ce23c47

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

‎arch/m68k/kernel/traps.c‎

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -811,13 +811,13 @@ asmlinkage void buserr_c(struct frame *fp)
811811

812812
static int kstack_depth_to_print = 48;
813813

814-
void show_trace(unsigned long *stack)
814+
static void show_trace(unsigned long *stack, const char *loglvl)
815815
{
816816
unsigned long *endstack;
817817
unsigned long addr;
818818
int i;
819819

820-
pr_info("Call Trace:");
820+
printk("%sCall Trace:", loglvl);
821821
addr = (unsigned long)stack + THREAD_SIZE - 1;
822822
endstack = (unsigned long *)(addr & -THREAD_SIZE);
823823
i = 0;
@@ -935,7 +935,8 @@ void show_registers(struct pt_regs *regs)
935935
pr_cont("\n");
936936
}
937937

938-
void show_stack(struct task_struct *task, unsigned long *stack)
938+
void show_stack_loglvl(struct task_struct *task, unsigned long *stack,
939+
const char *loglvl)
939940
{
940941
unsigned long *p;
941942
unsigned long *endstack;
@@ -949,7 +950,7 @@ void show_stack(struct task_struct *task, unsigned long *stack)
949950
}
950951
endstack = (unsigned long *)(((unsigned long)stack + THREAD_SIZE - 1) & -THREAD_SIZE);
951952

952-
pr_info("Stack from %08lx:", (unsigned long)stack);
953+
printk("%sStack from %08lx:", loglvl, (unsigned long)stack);
953954
p = stack;
954955
for (i = 0; i < kstack_depth_to_print; i++) {
955956
if (p + 1 > endstack)
@@ -959,7 +960,12 @@ void show_stack(struct task_struct *task, unsigned long *stack)
959960
pr_cont(" %08lx", *p++);
960961
}
961962
pr_cont("\n");
962-
show_trace(stack);
963+
show_trace(stack, loglvl);
964+
}
965+
966+
void show_stack(struct task_struct *task, unsigned long *stack)
967+
{
968+
show_stack_loglvl(task, stack, KERN_INFO);
963969
}
964970

965971
/*

0 commit comments

Comments
 (0)