Re: [PATCH v2] x86: fix output of show_stack_log_lvl()

From: Ingo Molnar
Date: Fri Feb 20 2015 - 03:10:17 EST



* Adrien Schildknecht <adrien+dev@xxxxxxxxxxx> wrote:

> show_stack_log_lvl() does not set the log level after a new line,
> the following messages printed with pr_cont are thus assigned to the
> default log level.
> This patch prepends the log level to the next message following a new
> line.
>
> print_trace_address() uses printk(log_lvl). Using printk with just
> a log level is ignored and thus has no effect on the next pr_cont.
> We need to prepend the log level directly into the message.

This approach looks good to me, we want to print multi-line
messages with the same consistent loglevel.

Totally unrelated observation:

> +++ b/arch/x86/kernel/dumpstack.c

> touch_nmi_watchdog();
> + printk_stack_address(addr, reliable, data);

The whole code is sprinkled with touch_nmi_watchdog()
calls. Shouldn't we simply make it a rule that if a printk
message makes it to a real console (as opposed to the log
buffer only), it should imply a touch_nmi_watchdog()?

Then all of those crappy touch_nmi_watchdog() calls could
be removed here and in other places where long printk
streams may happen.

Totally unrelated observation #2:

> if (kstack_end(stack))
> break;
> - if (i && ((i % STACKSLOTS_PER_LINE) == 0))
> - pr_cont("\n");

> +++ b/arch/x86/kernel/dumpstack_64.c

> if (((long) stack & (THREAD_SIZE-1)) == 0)
> break;
> }
> - if (i && ((i % STACKSLOTS_PER_LINE) == 0))
> - pr_cont("\n");

Looks like kstack_end() could be defined on 64-bit as well,
unifying the stack printing logic some more?

( I'd no go so far as to unify the two functions, but the
closer to each other the better it is to make changes
that affect both of them. )

Thanks,

Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/