Re: [PATCH] dump_stack: convert generic dump_stack into a weak symbol

From: Petr Mladek
Date: Tue Mar 06 2018 - 07:43:36 EST


On Tue 2018-03-06 13:29:57, Sergey Senozhatsky wrote:
> On (03/05/18 15:48), Petr Mladek wrote:
> [..]
> >
> > I hope that I did not miss anything. I could not try this at
> > runtime.
>
> I think you can. The rules are universal, you can do on x86
> something like this
>
> ---
>
> arch/x86/kernel/dumpstack.c | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>
> diff --git a/arch/x86/kernel/dumpstack.c b/arch/x86/kernel/dumpstack.c
> index a2d8a3908670..5d45f406717e 100644
> --- a/arch/x86/kernel/dumpstack.c
> +++ b/arch/x86/kernel/dumpstack.c
> @@ -375,3 +375,16 @@ static int __init code_bytes_setup(char *s)
> return 1;
> }
> __setup("code_bytes=", code_bytes_setup);
> +
> +void dump_stack(void)
> +{
> + dump_stack_print_info(KERN_DEFAULT);
> +
> + pr_crit("\t\tLinux\n\n");
> +
> + pr_crit("An error has occurred. To continue:\n"
> + "Press Enter to return to Linux, or\n"
> + "Press CTRL+ALT+DEL to restart your computer.\n");
> +
> + pr_crit("\n\n\tPress any key to continue _");
> +}
>
> ---
>
> Should be enough for testing.

Yup, this worked.

I have pushed the patch into printk.git for-4.17 branch,
see https://git.kernel.org/pub/scm/linux/kernel/git/pmladek/printk.git/commit/?h=for-4.17&id=33251b634b4aa1317e2f911e3b723179949a0605


Greentime Hu,

the for-4.17 branch in printk.git is based on Linus' tree. Therefore
I had to remove the hunk against arch/nds32/kernel/traps.c because
this file is only in linux-next.

I think that it might be easier if you remove the EXPORT_SYMBOL()
in your branch. Is it OK for you, please?

Best Regards,
Petr