Received: by 10.223.185.116 with SMTP id b49csp4843590wrg; Wed, 7 Mar 2018 01:52:24 -0800 (PST) X-Google-Smtp-Source: AG47ELvEz06/ASd3ZcuM15P78oolw/WmDZz0V2tVhK29V+omVOMzhiw6Qkw3RrF7e27HxQYhnG5b X-Received: by 2002:a17:902:b697:: with SMTP id c23-v6mr19804264pls.328.1520416344450; Wed, 07 Mar 2018 01:52:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520416344; cv=none; d=google.com; s=arc-20160816; b=Y7cnfB290eD4aukxJfIGXUqOpqOPH5PuBJXIOYk29jnI7xqnLwRDbT2wN0xkSxAgC3 6dbvLcqyvYfAhnGNJkd6rUuf74Gd2bnfIrrfS7cUAlAWUu3QGwpiNauLg1pEToCWYsCl hV3rQO78c0JKN0eEWp7Z+40FhXk68kWvjidHKlFjalYWnHarq86j9u/9nAEFYTk5k/+p skvF8G6chcjH+2Ygr04OQFeKvgn5EffdY904VieCU7u0Sn8/7qyitLBeY0N1ATnIz8Hf ejAEBkcdGva6Tvblac1yvbmTP8+Yw/oZJVvj3+XNpOPNCAwlsQpV6u1QPsebF5Hk/uRK ZOGA== 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=24xTXOo/5Ave2ltfUXS1hnIspFe14nSfiCCJOO1klb8=; b=Hi+zUgBk5m4t4bXZHJT+DMmeQps2qUZxCo8QlEynb7JeDCRLCo8E2MmlnzE3UCAwPw meQpT6sA6aQ+tNhNHAVj/AoYMdFHcNLDnwLoZhnN09MbflbCHgNquQR3Wj1tN/2V/dFL 34cyYH54yAByA8JC76Fovt/Z+vzVpayPQAiIbCj7zpHnLSxi6qe+hErZunallx2cdERH 3WcACXGsBLJHhY54S3+6QVnrLpC32Mxk8fguQMdvbNAMXGkb4pbtQ3z3X1/+pCLsDhVR 7HrwOEAD0whhz9wcgDjCmusw217Vs5QB7E4aBsyO4R+9H5/ihDCzEbdO5VLKBQxfXgqC en9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=LmLs9/DN; 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 j74si13542097pfk.202.2018.03.07.01.52.09; Wed, 07 Mar 2018 01:52:24 -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=fail header.i=@gmail.com header.s=20161025 header.b=LmLs9/DN; 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 S1754256AbeCGJuh (ORCPT + 99 others); Wed, 7 Mar 2018 04:50:37 -0500 Received: from mail-io0-f196.google.com ([209.85.223.196]:38855 "EHLO mail-io0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751072AbeCGJue (ORCPT ); Wed, 7 Mar 2018 04:50:34 -0500 Received: by mail-io0-f196.google.com with SMTP id g21so2363257ioj.5 for ; Wed, 07 Mar 2018 01:50:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=24xTXOo/5Ave2ltfUXS1hnIspFe14nSfiCCJOO1klb8=; b=LmLs9/DNk2e3I1ynhoDxSIsOqZRjpSnh3Uu3fkh6d56vJ0NcU6j7C5BEQAQQQgCfUW R7rOtC9mNf2wOynwBJ6AS5x2PToXGttEZz6FhnfsCWIdultJsX/4hZ3EzAgQDM5uwr8g lRNi0lwXaBUtXYt/GCa3YvBe2ANAvPi9lNeGyo1tACB5IPqLat5BFlm1h7TltTi8hUPq diwqB4GTmQnRVBS2A09LaY15Mc7NBxgGImsLhFw6Umx/j2A23ZYXqpiVJ+q5f3PhR/Uh d+W9yhSy+0PX7vDeVpGrW0UiU5YUHmzhJ2s1rO7jTe4fxxweYvVRhmUZ76Ppq2uXY1Rt 2RUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=24xTXOo/5Ave2ltfUXS1hnIspFe14nSfiCCJOO1klb8=; b=B9939+k0OlOPe4SXLnrOV9hwsEGFhHDh/EkWUZWUwXRqxXfSDZ9CwhHQ2fI7WBkR2y o0H6rxm2Rw6EBTZvYZQPov2mNK17uu0jXO0ZTyRr0+QwDaIeOJTnCk/rbrRHPVro2IJR PpA4GmG/fFEEQulzG2BhDAiHdGR+fb7ItUfO3VfH9rnH/kmpChjwVvokllBfZEvNl0Pn oqy976H5A2xKYP0f/KPBAiZDNjCzcpfpyewqFjWkBEPm1COqKPHEzNowqaID1TxNtmvU OfiSFPmKslz+v7giXu9gzMC0K8EXDKSTnUQEzGsXmoPYkGzqRt8TI1KXa6VHsNcxoM2Q X4jg== X-Gm-Message-State: AElRT7HlBQirpzhueo8dv3Svrrn8s1qPHFxu5sGxOavx7OklRT0uEqqf jZMvqaBfpBDePXu1bAoTh9HrmtjYaNXS7lxa3v8= X-Received: by 10.107.97.21 with SMTP id v21mr24681134iob.22.1520416233927; Wed, 07 Mar 2018 01:50:33 -0800 (PST) MIME-Version: 1.0 Received: by 10.79.34.71 with HTTP; Wed, 7 Mar 2018 01:50:33 -0800 (PST) In-Reply-To: References: <20180305053742.9149-1-sergey.senozhatsky@gmail.com> <20180307022127.GB802@jagdpanzerIV> <20180307090917.2xqifk2wpk5ty36j@pathway.suse.cz> From: Arnd Bergmann Date: Wed, 7 Mar 2018 10:50:33 +0100 X-Google-Sender-Auth: RF9KaSjJ23FR4nQUuXuCjdrTGtQ Message-ID: Subject: Re: [PATCH] dump_stack: convert generic dump_stack into a weak symbol To: Greentime Hu Cc: Petr Mladek , Sergey Senozhatsky , Tejun Heo , Steven Rostedt , Dave Young , Andi Kleen , Vincent Chen , 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 On Wed, Mar 7, 2018 at 10:44 AM, Greentime Hu wrote: > 2018-03-07 17:09 GMT+08:00 Petr Mladek : >> Ah, there was a mid-air collision. Arnd already answered most of my >> questions and even more. >> >> On Wed 2018-03-07 09:46:27, Arnd Bergmann wrote: >>> On Wed, Mar 7, 2018 at 3:21 AM, Sergey Senozhatsky >>> wrote: >>> > On (03/06/18 14:27), Arnd Bergmann wrote: >>> >> Weak symbols are generally discouraged in the kernel. We have >>> >> them in a couple of places, but I find them rather confusing as they >>> >> make it harder to figure out what is actually going on. >>> > >>> > Honestly, I kind of find __weak less confusing than EXPORT_SYMBOL(dump_stack) >>> > in 3 different places. __weak hints that the symbol likely will be overridden >>> > somewhere, while EXPORT_SYMBOL() does not (at least not to me). Dunno. >>> >>> It's not either/or, they are both wrong ;-) >>> >>> The EXPORT_SYMBOL() is not the thing that makes it work. The duplicate >>> declaration today only works because lib/dump_stack.o is listed as lib-y >>> in the Makefile instead of obj-y. On blackfin and nds32, this causes the entire >>> file to just not be included in the final vmlinux, because there are no >>> references to it. >>> >>> With your patch, I would actually expect the lib/dump_stack.o file >>> to still not be picked up, so now you have a missing EXPORT_SYMBOL() >>> on the two unusual architectures until the point when you add another >>> (referenced) symbol to it. >> >> Great catch! We should change it from lib-y to obj-y. Of course, >> the best solution would be if nds32 uses the generic implementation >> and we could avoid adding __weak. >> > > I agree too. > I think I can add a patch to remove the dump_stack() implementation in > nds32 and use the generic one. Looks good, Acked-by: Arnd Bergmann > diff --git a/arch/nds32/kernel/traps.c b/arch/nds32/kernel/traps.c > index 8828b4aeb72b..6e34eb9824a4 100644 > --- a/arch/nds32/kernel/traps.c > +++ b/arch/nds32/kernel/traps.c > @@ -156,18 +156,6 @@ static void __dump(struct task_struct *tsk, > unsigned long *base_reg) > pr_emerg("\n"); > } > > -void dump_stack(void) > -{ > - unsigned long *base_reg; > - if (!IS_ENABLED(CONFIG_FRAME_POINTER)) > - __asm__ __volatile__("\tori\t%0, $sp, #0\n":"=r"(base_reg)); > - else > - __asm__ __volatile__("\tori\t%0, $fp, #0\n":"=r"(base_reg)); > - __dump(NULL, base_reg); > -} > - > -EXPORT_SYMBOL(dump_stack); > -