Skip to content

Commit a1eea2e

Browse files
0x7f454c46torvalds
authored andcommitted
c6x: 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: Aurelien Jacquiot <jacquiot.aurelien@gmail.com> Cc: Mark Salter <msalter@redhat.com> Link: http://lkml.kernel.org/r/20200418201944.482088-12-dima@arista.com Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent c0fe096 commit a1eea2e

1 file changed

Lines changed: 14 additions & 7 deletions

File tree

‎arch/c6x/kernel/traps.c‎

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -344,12 +344,13 @@ asmlinkage int process_exception(struct pt_regs *regs)
344344

345345
static int kstack_depth_to_print = 48;
346346

347-
static void show_trace(unsigned long *stack, unsigned long *endstack)
347+
static void show_trace(unsigned long *stack, unsigned long *endstack,
348+
const char *loglvl)
348349
{
349350
unsigned long addr;
350351
int i;
351352

352-
pr_debug("Call trace:");
353+
printk("%sCall trace:", loglvl);
353354
i = 0;
354355
while (stack + 1 <= endstack) {
355356
addr = *stack++;
@@ -364,16 +365,17 @@ static void show_trace(unsigned long *stack, unsigned long *endstack)
364365
if (__kernel_text_address(addr)) {
365366
#ifndef CONFIG_KALLSYMS
366367
if (i % 5 == 0)
367-
pr_debug("\n ");
368+
printk("%s\n ", loglvl);
368369
#endif
369-
pr_debug(" [<%08lx>] %pS\n", addr, (void *)addr);
370+
printk("%s [<%08lx>] %pS\n", loglvl, addr, (void *)addr);
370371
i++;
371372
}
372373
}
373-
pr_debug("\n");
374+
printk("%s\n", loglvl);
374375
}
375376

376-
void show_stack(struct task_struct *task, unsigned long *stack)
377+
void show_stack_loglvl(struct task_struct *task, unsigned long *stack,
378+
const char *loglvl)
377379
{
378380
unsigned long *p, *endstack;
379381
int i;
@@ -398,7 +400,12 @@ void show_stack(struct task_struct *task, unsigned long *stack)
398400
pr_cont(" %08lx", *p++);
399401
}
400402
pr_cont("\n");
401-
show_trace(stack, endstack);
403+
show_trace(stack, endstack, loglvl);
404+
}
405+
406+
void show_stack(struct task_struct *task, unsigned long *stack)
407+
{
408+
show_stack_loglvl(task, stack, KERN_DEBUG);
402409
}
403410

404411
int is_valid_bugaddr(unsigned long addr)

0 commit comments

Comments
 (0)