Received: by 10.223.185.116 with SMTP id b49csp2664562wrg; Mon, 5 Mar 2018 06:51:22 -0800 (PST) X-Google-Smtp-Source: AG47ELtRkzDXsv+IVLVsFnpxbqYzRAAvnKgy0lo6n2ZrMNoTMcGK0VhE8ymjOn6/uG+NQl5OsyTn X-Received: by 10.98.12.11 with SMTP id u11mr15735525pfi.192.1520261482307; Mon, 05 Mar 2018 06:51:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520261482; cv=none; d=google.com; s=arc-20160816; b=tQSkJn4AOpKIV47//QS24mR6RU53JL1RvmuKOK3FLt8lo8F8+ipKooSDdVzSOWtkrE IJDxodOmUbk5uXt+Vim7Wuj+tdZbFM21ykg4ychgguo487cS62QbQQpjwtcc2ugHuUm6 rjwAWJ02oAnv7oVTvDsYgJmTynGDTvR31a1jf3vK2MefG004hlI1M7+xBy2G1gosfyqQ T25cPs0YHfqviQ/DpMZefGo51XJ8AwVlNXyypID/kfeihMcBuPf+R6lM8wbpA1yl66zr rh4nLvTVsE66puC5jBFrPq/+B3MZvUfgBc2HxeFY4YZ64B3Rm3+3fz+HykQ7dtk6sWKY yIzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=Fnhrgt1vehdeTGG0d65GEOuQoiahdPq/Iw4/JPbEVIs=; b=QurDCJZB/UdTtr2+7HXiN05uHiKcJqKmcxuH3//xWVw381EM10D4i1JuNM9IpMtrEn Wv1u6gmkGlkF7evylnYRHK/G4VUSW7Eyw+lyJbV84tmza80fWLidJmScsFFTeRHyx7xe n6JQ4bpLSUDN4/wCDB9h47eXc0NH8wDH7B/H8Fny2R/tXucqnVf1clPYBcy+rnjnP0ts L03ccQ3BGkIUd9KwCZz3bpWOhaUMuJGt1fVvlR1OD1mWQMpJvVkUCo0ojE5yAYz9XeEe pIDJ0wr+SjzbsBiUw/d7kkr7foxd6W10E2O+RuVTVz4oxiP9g7//OYS9750gGvxmgTOa pyiw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f3-v6si9673468plm.169.2018.03.05.06.51.07; Mon, 05 Mar 2018 06:51:22 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751903AbeCEOsv (ORCPT + 99 others); Mon, 5 Mar 2018 09:48:51 -0500 Received: from mx2.suse.de ([195.135.220.15]:57050 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752003AbeCEOst (ORCPT ); Mon, 5 Mar 2018 09:48:49 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 3A860AD0C; Mon, 5 Mar 2018 14:48:47 +0000 (UTC) Date: Mon, 5 Mar 2018 15:48:46 +0100 From: Petr Mladek To: Sergey Senozhatsky Cc: Tejun Heo , Steven Rostedt , Dave Young , Andi Kleen , Greentime Hu , Vincent Chen , Arnd Bergmann , Peter Zijlstra , Andrew Morton , Stephen Rothwell , adi-buildroot-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, Sergey Senozhatsky Subject: Re: [PATCH] dump_stack: convert generic dump_stack into a weak symbol Message-ID: <20180305144846.3jommv372c73dltt@pathway.suse.cz> References: <20180305053742.9149-1-sergey.senozhatsky@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180305053742.9149-1-sergey.senozhatsky@gmail.com> User-Agent: NeoMutt/20170421 (1.8.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? Best Regards, Petr