From: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
To: Petr Mladek <pmladek@suse.com>, Tejun Heo <tj@kernel.org>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>,
Linux-Next Mailing List <linux-next@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Dave Young <dyoung@redhat.com>,
Steven Rostedt <rostedt@goodmis.org>,
Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>,
akpm@linux-foundation.org, Andi Kleen <ak@linux.intel.com>
Subject: Re: linux-next: build failure after merge of the printk tree
Date: Sat, 3 Mar 2018 23:47:39 +0900 [thread overview]
Message-ID: <20180303144739.GA516@tigerII.localdomain> (raw)
In-Reply-To: <20180302155454.eme5gplxdcltvwkw@pathway.suse.cz>
Cc-ing Tejun
On (03/02/18 16:54), Petr Mladek wrote:
[..]
> > (Though it is not immediately obvious why.)
>
> It is a mistery to me. The error appears when I move any of
> dump_stack_print_info() or show_regs_print_info() function
> definitions from kernel/printk/printk.c to lib/dump_stack.c.
> All the other changes seems unrelated.
>
> The thing is that we basically do not touch dump_stack() definition
> by that patch.
Apparently dump_stack_print_info() was in lib/dump_stack.c a long
time ago, but it was deliberately moved to printk.c, when kernel gained
a "generic" (dummy) dump_stack() fallback. Some archs, like blackfin,
define their own dump_stack() symbol and make it global via EXPORT_SYMBOL.
In case of blackfin that arch-specific dump_stack() symbol invokes a
global dump_stack_print_info(). If we move dump_stack_print_info() back
to lib/dump_stack.c then we link both with arch/blackfin/dumpstack.o
and lib/dump_stack.o, which results in multiple definitions error.
If we move dump_stack_print_info() out on libdump_stack.o, then we
never link with lib/dump_stack.o
... so what are we going to do with that.
a) we can drop the patch and cherry pick only the kexec part
b) we can try to mark dummy lib/dump_stack() as __weak
EXPORT_SYMBOL and remove EXPORT_SYMBOL from arch-specific
definitions.
So we will end up with EXPORT_SYMBOL dump_stack() and archs
may re-define it. If some arch will accidentally mark its
own dump_stack() as EXPORT_SYMBOL then there should be a
linkage warning - a symbol is exported twice.
Something like below.
Opinions? Will this work?
========= 8< =========
From: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Subject: [PATCH] dump_stack: mark dummy dump_stack() as weak
---
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);
diff --git a/arch/nds32/kernel/traps.c b/arch/nds32/kernel/traps.c
index 8828b4aeb72b..455bb0787367 100644
--- a/arch/nds32/kernel/traps.c
+++ b/arch/nds32/kernel/traps.c
@@ -166,8 +166,6 @@ void dump_stack(void)
__dump(NULL, base_reg);
}
-EXPORT_SYMBOL(dump_stack);
-
void show_stack(struct task_struct *tsk, unsigned long *sp)
{
unsigned long *base_reg;
diff --git a/lib/dump_stack.c b/lib/dump_stack.c
index 5cff72f18c4a..9cf4465dbffa 100644
--- a/lib/dump_stack.c
+++ b/lib/dump_stack.c
@@ -85,7 +85,7 @@ static void __dump_stack(void)
#ifdef CONFIG_SMP
static atomic_t dump_lock = ATOMIC_INIT(-1);
-asmlinkage __visible void dump_stack(void)
+asmlinkage __weak __visible void dump_stack(void)
{
unsigned long flags;
int was_locked;
@@ -118,7 +118,7 @@ asmlinkage __visible void dump_stack(void)
local_irq_restore(flags);
}
#else
-asmlinkage __visible void dump_stack(void)
+asmlinkage __weak __visible void dump_stack(void)
{
__dump_stack();
}
--
2.16.2
next prev parent reply other threads:[~2018-03-03 14:47 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-02 5:07 linux-next: build failure after merge of the printk tree Stephen Rothwell
2018-03-02 15:54 ` Petr Mladek
2018-03-03 2:43 ` Stephen Rothwell
2018-03-03 14:47 ` Sergey Senozhatsky [this message]
2018-03-05 3:20 ` Dave Young
2018-03-05 5:27 ` Greentime Hu
2018-03-05 5:41 ` Sergey Senozhatsky
2018-03-05 12:25 ` Petr Mladek
-- strict thread matches above, loose matches on Subject: below --
2023-01-15 23:23 Stephen Rothwell
2023-01-16 15:54 ` Petr Mladek
2022-11-21 0:00 Stephen Rothwell
2022-11-21 13:42 ` Petr Mladek
2021-07-20 7:43 Stephen Rothwell
2021-07-20 8:17 ` Naresh Kamboju
2021-07-20 12:28 ` Chris Down
2021-07-21 8:57 ` Petr Mladek
2021-07-21 11:22 ` Chris Down
2021-07-21 12:49 ` Petr Mladek
2021-07-22 23:01 ` Stephen Rothwell
2021-07-23 11:14 ` Petr Mladek
2021-07-23 12:14 ` Chris Down
2020-07-29 11:03 Stephen Rothwell
2020-07-29 11:47 ` Herbert Xu
2020-07-28 1:49 Stephen Rothwell
2020-07-28 1:51 ` Herbert Xu
2020-07-28 2:21 ` Stephen Rothwell
2020-07-28 1:54 ` Sergey Senozhatsky
2020-07-28 2:24 ` Stephen Rothwell
2020-06-21 3:15 Stephen Rothwell
2020-06-21 3:26 ` Herbert Xu
2020-06-23 0:26 ` Stephen Rothwell
2020-06-23 12:16 ` Petr Mladek
2020-06-23 12:19 ` Herbert Xu
2020-06-23 14:28 ` Petr Mladek
2020-06-23 15:17 ` Peter Zijlstra
2020-06-24 8:22 ` Petr Mladek
2020-06-24 0:20 ` Herbert Xu
2020-06-24 8:19 ` Petr Mladek
2020-06-24 8:21 ` Herbert Xu
2019-12-05 22:25 Stephen Rothwell
2019-12-06 10:03 ` Petr Mladek
2017-12-07 0:37 Stephen Rothwell
2017-12-07 1:26 ` Sergey Senozhatsky
2017-12-07 13:12 ` Petr Mladek
2017-12-06 3:23 Stephen Rothwell
2017-12-06 4:28 ` Sergey Senozhatsky
2017-12-06 10:17 ` Petr Mladek
2017-12-06 10:39 ` Sergey Senozhatsky
2017-12-07 1:24 ` Sergey Senozhatsky
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=20180303144739.GA516@tigerII.localdomain \
--to=sergey.senozhatsky@gmail.com \
--cc=ak@linux.intel.com \
--cc=akpm@linux-foundation.org \
--cc=dyoung@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-next@vger.kernel.org \
--cc=pmladek@suse.com \
--cc=rostedt@goodmis.org \
--cc=sergey.senozhatsky.work@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;
as well as URLs for NNTP newsgroup(s).