Commit c261ad6e authored by Dmitry Safonov's avatar Dmitry Safonov Committed by Linus Torvalds

ia64: pass log level as arg into ia64_do_show_stack()

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 ia64_do_show_stack() as a preparation to
introduce show_stack_loglvl().  Also, make ia64_do_show_stack() static as
it's not used outside.

[1]: https://lore.kernel.org/lkml/20190528002412.1625-1-dima@arista.com/T/#uSigned-off-by: default avatarDmitry Safonov <dima@arista.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: Tony Luck <tony.luck@intel.com>
Link: http://lkml.kernel.org/r/20200418201944.482088-16-dima@arista.comSigned-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent d1e9086d
...@@ -114,7 +114,6 @@ static inline long regs_return_value(struct pt_regs *regs) ...@@ -114,7 +114,6 @@ static inline long regs_return_value(struct pt_regs *regs)
struct task_struct; /* forward decl */ struct task_struct; /* forward decl */
struct unw_frame_info; /* forward decl */ struct unw_frame_info; /* forward decl */
extern void ia64_do_show_stack (struct unw_frame_info *, void *);
extern unsigned long ia64_get_user_rbs_end (struct task_struct *, struct pt_regs *, extern unsigned long ia64_get_user_rbs_end (struct task_struct *, struct pt_regs *,
unsigned long *); unsigned long *);
extern long ia64_peek (struct task_struct *, struct switch_stack *, unsigned long, extern long ia64_peek (struct task_struct *, struct switch_stack *, unsigned long,
......
...@@ -64,12 +64,13 @@ EXPORT_SYMBOL(boot_option_idle_override); ...@@ -64,12 +64,13 @@ EXPORT_SYMBOL(boot_option_idle_override);
void (*pm_power_off) (void); void (*pm_power_off) (void);
EXPORT_SYMBOL(pm_power_off); EXPORT_SYMBOL(pm_power_off);
void static void
ia64_do_show_stack (struct unw_frame_info *info, void *arg) ia64_do_show_stack (struct unw_frame_info *info, void *arg)
{ {
unsigned long ip, sp, bsp; unsigned long ip, sp, bsp;
const char *loglvl = arg;
printk("\nCall Trace:\n"); printk("%s\nCall Trace:\n", loglvl);
do { do {
unw_get_ip(info, &ip); unw_get_ip(info, &ip);
if (ip == 0) if (ip == 0)
...@@ -77,9 +78,9 @@ ia64_do_show_stack (struct unw_frame_info *info, void *arg) ...@@ -77,9 +78,9 @@ ia64_do_show_stack (struct unw_frame_info *info, void *arg)
unw_get_sp(info, &sp); unw_get_sp(info, &sp);
unw_get_bsp(info, &bsp); unw_get_bsp(info, &bsp);
printk(" [<%016lx>] %pS\n" printk("%s [<%016lx>] %pS\n"
" sp=%016lx bsp=%016lx\n", " sp=%016lx bsp=%016lx\n",
ip, (void *)ip, sp, bsp); loglvl, ip, (void *)ip, sp, bsp);
} while (unw_unwind(info) >= 0); } while (unw_unwind(info) >= 0);
} }
...@@ -87,12 +88,12 @@ void ...@@ -87,12 +88,12 @@ void
show_stack (struct task_struct *task, unsigned long *sp) show_stack (struct task_struct *task, unsigned long *sp)
{ {
if (!task) if (!task)
unw_init_running(ia64_do_show_stack, NULL); unw_init_running(ia64_do_show_stack, (void *)KERN_DEFAULT);
else { else {
struct unw_frame_info info; struct unw_frame_info info;
unw_init_from_blocked_task(&info, task); unw_init_from_blocked_task(&info, task);
ia64_do_show_stack(&info, NULL); ia64_do_show_stack(&info, (void *)KERN_DEFAULT);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment