Received: by 10.223.185.116 with SMTP id b49csp3306062wrg; Mon, 5 Mar 2018 18:52:10 -0800 (PST) X-Google-Smtp-Source: AG47ELu1I6DxGv70vIbSYkx2jZbWcMbKudgyP7iDLda5VL83nApnT74qLCJvNiBTjpk0kATVMz+7 X-Received: by 10.99.110.137 with SMTP id j131mr13892903pgc.85.1520304730274; Mon, 05 Mar 2018 18:52:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520304730; cv=none; d=google.com; s=arc-20160816; b=BWhbNmZzpA8CZJh3sOzzr/yYG3cewQL+eJRXQqKHLDwTAbym3Pa3AjXZpApsZfGmht 82FHsWGa4FHtYaKSjYjjvMJUCBo56Ja0tw5v6X3isOCuVnQ0bOpdDS0cfop1DlxKO+sw 6IwcWxHb58SnWXgsHgyTe+Hf3UUmOgcT6zjT/aeLJD9OJ3sKw+dYsSnksYcowU/XkoJ4 x9D5iXGz7v8NDejcUQdgDNk74kDD0ZRRMaV6379oukCsFG17ZMKtfm1+ZtEAdONIL3fj DkB5rKJEFQHIfJeGYnBph3Tf06DIOFfDhv5UkQcNfKJpUBih2xk9PFbV5oBC3PqWPU2D NUyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=8Ro5tTQIKVqzMJRIZa6twgZKgpqzfn4HDytaXdq+qek=; b=wc1dGpFDJDWzCXyZ0ilqRjc1Dca9Lh3Lk6fQVcneToxOE4lE51r1reJh4BbIVcojyE LtAbkrrNpf5RE/gDJkpQUH3++fSNUskzhYvbtDnW219YcBjBSj0Q5Mx1undVvPa+9Dwy m3P8tyKANwmp+U6N1kwhua1JUvxV4SiVRhxvncD7R78G+a4Cswy3v6y+WLh35ojseKg/ np3ku8ACIcYoBVEKFY7dQ1NF+B40cojDcP1+FS+hlvrdNZttjS4dIU6e1wjuSNZ1cjHG tISjvksbA2bt9YV6SoTRe6ZSXH5QBCPF3DZrnxh2Pe8vP22nXz0v+RBbsoCGKRxaWYSH qTuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Q1WKeGT0; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r13-v6si10628115plj.141.2018.03.05.18.51.56; Mon, 05 Mar 2018 18:52:10 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Q1WKeGT0; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753232AbeCFCuz (ORCPT + 99 others); Mon, 5 Mar 2018 21:50:55 -0500 Received: from mail-ua0-f196.google.com ([209.85.217.196]:39329 "EHLO mail-ua0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752910AbeCFCuy (ORCPT ); Mon, 5 Mar 2018 21:50:54 -0500 Received: by mail-ua0-f196.google.com with SMTP id e25so12060975uam.6 for ; Mon, 05 Mar 2018 18:50:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=8Ro5tTQIKVqzMJRIZa6twgZKgpqzfn4HDytaXdq+qek=; b=Q1WKeGT0qyrtOehtKKq8f7xiPeGJOLx3RXCmNKJM/xj0S/2iS6x/rw66zDf1AhUVKD c1R8VaA9U2JGRtNtFQgkzXaK3mNnmP0kpFkHC+q0AokyTCUpeUk/iRUgNI2ueh2/P0FG gtsOe8uR2oylGjZRMreKRWi7lkCkKocNNULPT1bmTysSIViRnqkfkdRX27kStnU0gI/v vBGIOrcXd19hoBjtxw0FuD1bGWP4KZs9e44sIJfnyBM/dkyJVQs4Udrg2oqmVdVtuqto d5unAAH+M/8fV1fYKLcNkxWQpFC3CaNw58BQONoD/uY72meJej6EHEZgs28AAuAwH0wl X4jg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=8Ro5tTQIKVqzMJRIZa6twgZKgpqzfn4HDytaXdq+qek=; b=AbxcT2kWreAdX65E8QjVVsGZjMy4TYtb4W/AC1XwqlBYqf4swVe9H1ys4z8hf4/608 BHOXnsDkLijEr34kBm78Xek9TvGkWY/ztb3alSMaHCzV+VlNUVChGKBrCs9gQbJVxhpV 83L1/tyy6OhtXz5wq0LicobdsqF56hlsWda39BM6wYJIn/X4qlTQk6B5i+qnuXgvqbbj 90gYvWhYAoLViPAxURuxdR14prpglVgpvIPhjAtsUa7adBYPxBaS5HlWJfwYDj1WIKXK QQzRlVx1R65x/1I0AsYOstOSDh+G1EayHYTL82MFuoAFeuEGVcOLKdM+l4VeVLS/C1JC 9M1w== X-Gm-Message-State: AElRT7FFCaV4uRQzucooicY3xh0konaXNXeg2+Lv3z27/yR7AmZZZQSH 9L5ryOfuSnSLWIJca+ZH/OhpCFpWl0fTZXIpi6HdsQ== X-Received: by 10.159.37.226 with SMTP id 89mr12478288uaf.1.1520304653072; Mon, 05 Mar 2018 18:50:53 -0800 (PST) MIME-Version: 1.0 Received: by 10.159.49.66 with HTTP; Mon, 5 Mar 2018 18:50:12 -0800 (PST) In-Reply-To: <20180305144846.3jommv372c73dltt@pathway.suse.cz> References: <20180305053742.9149-1-sergey.senozhatsky@gmail.com> <20180305144846.3jommv372c73dltt@pathway.suse.cz> From: Greentime Hu Date: Tue, 6 Mar 2018 10:50:12 +0800 Message-ID: Subject: Re: [PATCH] dump_stack: convert generic dump_stack into a weak symbol To: Petr Mladek Cc: Sergey Senozhatsky , Tejun Heo , Steven Rostedt , Dave Young , Andi Kleen , Vincent Chen , Arnd Bergmann , Peter Zijlstra , Andrew Morton , Stephen Rothwell , adi-buildroot-devel@lists.sourceforge.net, Linux Kernel Mailing List , Sergey Senozhatsky Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 2018-03-05 22:48 GMT+08:00 Petr Mladek : > 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 >> --- >> 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 > > 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? > Yes, please use it. :) greentime@atcsqa02:/NOBACKUP/sqa2/greentime/contrib/src_pkg/linux-next $ nds32le-elf-objdump -x vmlinux | less | grep dump_stack 00000000 l df *ABS* 00000000 dump_stack.c b04f7910 l O .bss 00000080 dump_stack_arch_desc_str b04995e8 l O __ksymtab 00000008 __ksymtab_dump_stack b04b9086 l O __ksymtab_strings 0000000b __kstrtab_dump_stack b002a464 g F .text 00000022 dump_stack b03a568c g F .text 000000c2 dump_stack_print_info b0024cf4 g F .init.text 00000038 dump_stack_set_arch_desc