mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Petr Mladek <pmladek@suse.com>
To: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
Cc: Tejun Heo <tj@kernel.org>, Steven Rostedt <rostedt@goodmis.org>,
	Dave Young <dyoung@redhat.com>, Andi Kleen <ak@linux.intel.com>,
	Greentime Hu <green.hu@gmail.com>,
	Vincent Chen <deanbo422@gmail.com>, Arnd Bergmann <arnd@arndb.de>,
	Peter Zijlstra <peterz@infradead.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Stephen Rothwell <sfr@canb.auug.org.au>,
	adi-buildroot-devel@lists.sourceforge.net,
	linux-kernel@vger.kernel.org,
	Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Subject: Re: [PATCH] dump_stack: convert generic dump_stack into a weak symbol
Date: Mon, 5 Mar 2018 15:48:46 +0100	[thread overview]
Message-ID: <20180305144846.3jommv372c73dltt@pathway.suse.cz> (raw)
In-Reply-To: <20180305053742.9149-1-sergey.senozhatsky@gmail.com>

On Mon 2018-03-05 14:37:42, Sergey Senozhatsky wrote:
> We want to move dump_stack related functions out of printk C
> code and consolidate them in lib/dump_stack file. The reason why
> dump_stack_print_info()/etc ended up in printk.c was a "generic"
> (dummy) lib dump_stack() function, which archs can override.
> For example, blackfin and nds32, define their own EXPORT_SYMBOL
> dump_stack() functions.
> 
> In case of blackfin that arch-specific dump_stack() symbol invokes
> a global dump_stack_print_info() function. So we can't easily move
> dump_stack_print_info() to lib/dump_stack, because this way we will
> link with lib/dump_stack.o file, which will bring in a generic
> dump_stack() symbol with it, causing a multiple definitions error:
>   - one dump_stack() from arch/blackfin/dumpstack
>   - the other one from lib/dump_stack
> 
> Convert generic dump_stack() into a weak symbol. So we will be
> able link with lib/dump_stack and at the same time archs will
> be able to override dump_stack(). It also opens up a way for us
> to move dump_stack_set_arch_desc(), dump_stack_print_info() and
> show_regs_print_info() to lib/dump_stack.
> 
> Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
> ---
>  arch/blackfin/kernel/dumpstack.c | 1 -
>  arch/nds32/kernel/traps.c        | 2 --
>  lib/dump_stack.c                 | 4 ++--
>  3 files changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/blackfin/kernel/dumpstack.c b/arch/blackfin/kernel/dumpstack.c
> index 3c992c1f8ef2..61af017130cd 100644
> --- a/arch/blackfin/kernel/dumpstack.c
> +++ b/arch/blackfin/kernel/dumpstack.c
> @@ -174,4 +174,3 @@ void dump_stack(void)
>  	show_stack(current, &stack);
>  	trace_buffer_restore(tflags);
>  }
> -EXPORT_SYMBOL(dump_stack);

I was afraid that blackfin modules would not longer be able
to use arch-specific dump_stack symbol. But it seems that only
the symbol name is important. Alos the list of symbols look
promissing:

before:

$> objdump -x vmlinux | less | grep dump_stack
00248530 l     O __ksymtab      00000008 ___ksymtab_dump_stack
002500d4 l     O __ksymtab_strings      0000000c ___kstrtab_dump_stack
00272bb6 l     O .bss   00000080 _dump_stack_arch_desc_str
000051a8 g     F .text  00000042 _dump_stack
002ab05c g     F .init.text     0000002a _dump_stack_set_arch_desc
0003051c g     F .text  000000a4 _dump_stack_print_info


after:

$> objdump -x vmlinux.patched | less | grep dump_stack
00000000 l    df *ABS*  00000000 lib/dump_stack.c
0027c3e8 l     O .bss   00000080 _dump_stack_arch_desc_str
00248580 l     O __ksymtab      00000008 ___ksymtab_dump_stack
002653d4 l     O __ksymtab_strings      0000000c ___kstrtab_dump_stack
000051a8 g     F .text  00000042 _dump_stack
002b69dc g     F .init.text     0000002a _dump_stack_set_arch_desc
001c2a90 g     F .text  000000a4 _dump_stack_print_info

I hope that I did not miss anything. I could not try this at
runtime. I could just cross-compile.

Anyway, from my side:

Reviewed-by: Petr Mladek <pmladek@suse.com>

I'll wait a bit and push it into printk.git for-4.17.


Greentime Hu, you tested this on nds32. Could I use your Tested-by,
please?

Best Regards,
Petr

  reply	other threads:[~2018-03-05 14:48 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-05  5:37 Sergey Senozhatsky
2018-03-05 14:48 ` Petr Mladek [this message]
2018-03-06  2:50   ` Greentime Hu
2018-03-06  4:31     ` Sergey Senozhatsky
2018-03-06  5:34       ` Greentime Hu
2018-03-06  4:29   ` Sergey Senozhatsky
2018-03-06 12:43     ` Petr Mladek
2018-03-06 22:52       ` Stephen Rothwell
2018-03-06 13:27 ` Arnd Bergmann
2018-03-07  2:21   ` Sergey Senozhatsky
2018-03-07  8:46     ` Arnd Bergmann
2018-03-07  9:09       ` Petr Mladek
2018-03-07  9:44         ` Greentime Hu
2018-03-07  9:50           ` Arnd Bergmann
2018-03-07 10:40       ` Sergey Senozhatsky
2018-03-07 10:57         ` Arnd Bergmann
2018-03-07 11:48           ` Sergey Senozhatsky
2018-03-07 12:41             ` Stephen Rothwell
2018-03-07 12:48               ` Arnd Bergmann
2018-03-07 12:53                 ` Stephen Rothwell
2018-03-07 12:58                   ` Arnd Bergmann
2018-03-07 13:10                     ` Stephen Rothwell
2018-03-07 13:40                 ` Sergey Senozhatsky
2018-03-07 14:01               ` Sergey Senozhatsky
2018-03-09  9:50             ` Petr Mladek
2018-03-14 23:42               ` Steven Rostedt
2018-03-14 23:58                 ` Stephen Rothwell
2018-03-07  8:49     ` Petr Mladek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180305144846.3jommv372c73dltt@pathway.suse.cz \
    --to=pmladek@suse.com \
    --cc=adi-buildroot-devel@lists.sourceforge.net \
    --cc=ak@linux.intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=deanbo422@gmail.com \
    --cc=dyoung@redhat.com \
    --cc=green.hu@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=sergey.senozhatsky.work@gmail.com \
    --cc=sergey.senozhatsky@gmail.com \
    --cc=sfr@canb.auug.org.au \
    --cc=tj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®