Received: by 10.223.185.116 with SMTP id b49csp2211783wrg; Sun, 4 Mar 2018 21:39:35 -0800 (PST) X-Google-Smtp-Source: AG47ELvXwWEMRTuGx5qqC5j00szBQhyW0i8/KdbqgCZZmj9bjtuZIEL/QMGkbame1mumgIuBF3u9 X-Received: by 10.98.248.7 with SMTP id d7mr14252461pfh.117.1520228375561; Sun, 04 Mar 2018 21:39:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520228375; cv=none; d=google.com; s=arc-20160816; b=mYjL4o+kADK208Am2ph9kUjR2DlLdL7caOWRijJ3iOwWuuEW5Lhx/uxYm3TToRny2P q+bhoZgCrrf23ZJdGjkQTYdKwcS8hxuEapnBKB6Gz/ZXSYaF1MT1NgPD+4+vHbYbj+dq XrHW2lTGwPM3Wj4H32EH9m0/FiKEDjmcCy2etiAc9mASbVkEVGhL37qC3xvNn4sT/Rtr 712zURNBAAFkL40TX0DxfB98W84rTna5/NwMUgaN6CmT9yVl0owJbSuJKdQPsCJIpGHF ceVH9HIFVB9vFrmhfeUubkDJ4iukSE8HBE2q2ooL/CJo1SsWRI3r8fUVqtsC/S6Pz05+ hN3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=Gcr2SDj4Z+2EAvnS1RZ4GIgNKsVk4TykTSlpywXkOn0=; b=JghoNR76WTdLc/32N8Z8J9V1gc3Vwfu/9vg3qyHuMfWtphBOxn3M9Hb6uWoidNCkXg TzjAbVPH464WkIEt8dA0169WKl9oVHAeEi618kHoYtmweW9Aoj2TFwdLAYhmPgjT5RtW XHwr97r1V2Xbtkv9QeMmIUCJYlU1Bkfnv9i4iJ8rIucmAh2UrEtt3fb6T9GAPw2TBifp mupXUHzm91jWie2606ZcjbvSWqdEPC7lGJYD1qpy73xUbRj6JJmWhZKXOGNM084hAhKf Ck3hJZL7Mxd1aDma4ZO6dn8HMRVhneewkkZpslBMb40eNV7ewXkuFPqtGlxPFiJmrMUT KBEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=bCWDNFzK; 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 a6si7878823pgv.76.2018.03.04.21.39.20; Sun, 04 Mar 2018 21:39:35 -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=bCWDNFzK; 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 S932807AbeCEFiP (ORCPT + 99 others); Mon, 5 Mar 2018 00:38:15 -0500 Received: from mail-pf0-f193.google.com ([209.85.192.193]:33630 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932476AbeCEFiM (ORCPT ); Mon, 5 Mar 2018 00:38:12 -0500 Received: by mail-pf0-f193.google.com with SMTP id q13so6779007pff.0 for ; Sun, 04 Mar 2018 21:38:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=Gcr2SDj4Z+2EAvnS1RZ4GIgNKsVk4TykTSlpywXkOn0=; b=bCWDNFzKFr9NTIdguQlNyOgGzU0sjUVPqaXi9z9IAzuox0aiwQB9X1rbkuRuqB8794 JndhNiSb5GbTPKCFrq+Wu7pB8cQSEa0hHUq7j6X82ccWgcX4QaGLNQQ+/pKduoX0+adk HslXSSqmi3WN6s8sjhZVeDgu8XLTxbbWQRSe7Ujr/qzy0VQeDY2WMS/VMYShGIDiMVnk JGHpHsumRXbDk6rrY24mhzHxu/VEw3BK4alcotjoiKpEs5AWBVzcLaAswuV0Nf+D90/S sEjs8eLF/8DtkrPu+L+4LLsQTrT9wFMz7SGr2ZYPcNPDCgxXYvfz2GHZhfjp+6y5j6ob CTdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=Gcr2SDj4Z+2EAvnS1RZ4GIgNKsVk4TykTSlpywXkOn0=; b=nl5hPzmtEf3115hOnjx7OCb9VoiFzr+T2KvGFQ9lHu5DpytUDscuLOXI9nPf/Vwydr F6MMcT23ThM1d7ndDRFvFm6CdwOs7nx/fJzderYA0XgAr2kvVVNjZ/EzDyvERzUps9QJ vp5X0fpP2uLo1JRfkf0BeOU6PvKvmpb4NHHQOWOYU8VQe9DBeVHNZOhdEUBNUxwoLSPy iyg1MrlRnVuduVMf6P0Xx94rPQMSFbVIXgtA/UBbOUJngMh5G0+lVpHvchG95f0z+Kau iUU39YhCKwjas2IULhD3ESSvkpfgRureRi7Pd8RKLjFOhu93ZFyVWEiUTuRooAHHnWRB uXDQ== X-Gm-Message-State: APf1xPDCSejLX6fqrmwsnvMZX0K3IIcJ9KSXXfnGqcs6yvOVA6rolcaW aYbE0pBLnBXh+K78zp9AwVk= X-Received: by 10.98.75.129 with SMTP id d1mr14226478pfj.19.1520228291754; Sun, 04 Mar 2018 21:38:11 -0800 (PST) Received: from localhost.localdomain ([175.223.44.199]) by smtp.gmail.com with ESMTPSA id t85sm24766919pfg.159.2018.03.04.21.38.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 04 Mar 2018 21:38:10 -0800 (PST) From: Sergey Senozhatsky X-Google-Original-From: Sergey Senozhatsky To: Petr Mladek , Tejun Heo , Steven Rostedt , Dave Young , Andi Kleen , Greentime Hu , Vincent Chen , Arnd Bergmann Cc: Peter Zijlstra , Andrew Morton , Stephen Rothwell , adi-buildroot-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, Sergey Senozhatsky Subject: [PATCH] dump_stack: convert generic dump_stack into a weak symbol Date: Mon, 5 Mar 2018 14:37:42 +0900 Message-Id: <20180305053742.9149-1-sergey.senozhatsky@gmail.com> X-Mailer: git-send-email 2.16.2 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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); 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 c5edbedd364d..02a8ad163760 100644 --- a/lib/dump_stack.c +++ b/lib/dump_stack.c @@ -25,7 +25,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; @@ -58,7 +58,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