Skip to content

Commit 2deebe4

Browse files
0x7f454c46torvalds
authored andcommitted
sh: add loglvl to printk_address()
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 printk_address() as a preparation to introduce show_stack_loglvl(). As a good side-effect show_fault_oops() now prints the address with KERN_EMREG as the rest of output, making sure there won't be situation where "PC: " is printed without actual address. [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: Rich Felker <dalias@libc.org> Link: http://lkml.kernel.org/r/20200418201944.482088-32-dima@arista.com Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 8b92f34 commit 2deebe4

3 files changed

Lines changed: 6 additions & 5 deletions

File tree

‎arch/sh/include/asm/kdebug.h‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ enum die_val {
1212
};
1313

1414
/* arch/sh/kernel/dumpstack.c */
15-
extern void printk_address(unsigned long address, int reliable);
15+
extern void printk_address(unsigned long address, int reliable,
16+
const char *loglvl);
1617
extern void dump_mem(const char *str, const char *loglvl,
1718
unsigned long bottom, unsigned long top);
1819

‎arch/sh/kernel/dumpstack.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ void dump_mem(const char *str, const char *loglvl,
4444
}
4545
}
4646

47-
void printk_address(unsigned long address, int reliable)
47+
void printk_address(unsigned long address, int reliable, const char *loglvl)
4848
{
49-
printk(" [<%p>] %s%pS\n", (void *) address,
49+
printk("%s [<%p>] %s%pS\n", loglvl, (void *) address,
5050
reliable ? "" : "? ", (void *) address);
5151
}
5252

@@ -118,7 +118,7 @@ static int print_trace_stack(void *data, char *name)
118118
*/
119119
static void print_trace_address(void *data, unsigned long addr, int reliable)
120120
{
121-
printk_address(addr, reliable);
121+
printk_address(addr, reliable, (char *)data);
122122
}
123123

124124
static const struct stacktrace_ops print_trace_ops = {

‎arch/sh/mm/fault.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ show_fault_oops(struct pt_regs *regs, unsigned long address)
214214
: "paging request",
215215
address);
216216
pr_alert("PC:");
217-
printk_address(regs->pc, 1);
217+
printk_address(regs->pc, 1, KERN_ALERT);
218218

219219
show_pte(NULL, address);
220220
}

0 commit comments

Comments
 (0)