Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp2743305pxb; Mon, 6 Sep 2021 04:32:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyXfgs8Lwrnab/tXfqHmOARx0mMdDcq//lGx9zakvnUIM7rKdj8dMo+k2C4zYaZj0GzihiZ X-Received: by 2002:a17:906:fa10:: with SMTP id lo16mr12699159ejb.342.1630927936213; Mon, 06 Sep 2021 04:32:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630927936; cv=none; d=google.com; s=arc-20160816; b=DwFy4TxF263vUswH8WTWn+OaZtlspqZQutilQ7pzEY+eRVaLglmHsqwID1MViGrEVq PbvW5CtD7tuG+5NckzdENeHeq0O5qvlXkqJU8DRlYCwoEIFSDOxt26iybSmvbFwD+3L2 4XxHmtlVuy7ODB5RoHxcR461MYVsJFkuNTC1qU0JlVV2aiFZ3YSWjqhvx4Nxkta9E6Zw M8fCIbX24mTQ3uXEAqhnbFDZC6TA6CiP/ccdqaNHzs7qgJkkOdVeg4hDr8jRpxIcm85K yRl1vh0onIMMCPKPtmxRag0Fz+36mrDUXWmGLujDkisXyYn99UxEGDycGNTOkLVuicyU dWcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=u5584h9Ymq6FJrVOmqbbHmgTAcyD3506jVbhrXUrdqI=; b=CyT44Vzz92VZ70st6fUtiWKKrKFNjYqwmNRzm8WOkFF8hwC1s+s/pSuXPzO1bZHAj6 qAG6SrGcVjgiPzpCQf5Fe3fsR9DKUcFywatEOdGiIqcCyyOgJKsPBGXlDj5ze9fJiAlz 7a2BqA2hMAz/I+3l1UA4C0Jv97KPqFTOg6s+PMh4B0/9HaRgdGEvevQ8Zwrq5dh2uY2J dmi1KkPgCkJAkBkwFfdnww1pcACBirgd3q1ySI8y3AYAddjJag7PjzbrbfrrT2gKi6G+ YTcZmHKcKaBUMeSEKli5ssVHrakHEYNzSWx3xa5XZaL2jXNXlLu5Qvp354ZhoEwJPwtS hRTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=aF2L2gLh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id g12si7964397edy.563.2021.09.06.04.31.52; Mon, 06 Sep 2021 04:32:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=aF2L2gLh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S241194AbhIFLSW (ORCPT + 99 others); Mon, 6 Sep 2021 07:18:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236774AbhIFLSV (ORCPT ); Mon, 6 Sep 2021 07:18:21 -0400 Received: from mail-pf1-x432.google.com (mail-pf1-x432.google.com [IPv6:2607:f8b0:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 11789C061575; Mon, 6 Sep 2021 04:17:17 -0700 (PDT) Received: by mail-pf1-x432.google.com with SMTP id i24so5378167pfo.12; Mon, 06 Sep 2021 04:17:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=u5584h9Ymq6FJrVOmqbbHmgTAcyD3506jVbhrXUrdqI=; b=aF2L2gLhiNrHDQGWAT60JTn49NA/ICpeYFMa6AFWkBkMJyhgZf0gAHxa0c1Nti6Rbd 8lh66aq6X38xMNFv6u6GtXuorsGJDjtKyjbw+XcStga7tb/50z340kWqvgsv9V/VitMO fRG/BkcI8YaYASmH/lWlj58ZPo6OxeJtFie2XnN3Ud7aXYTDUAU3pSbqc83B64oBqByn /cyNuOrRdjKgYw8gDJcNVt+a7zMHD9Cvisoxupca77CMswCRWwlfoADG8pnvgUCNXgKP BfX1smZBQ6fqKR8DU8Oq6B3FnbCkQYAB1oRCt/0QcVoBjba9PfDxsxSSn50irqtFdVWc WIgQ== 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:mime-version :content-transfer-encoding; bh=u5584h9Ymq6FJrVOmqbbHmgTAcyD3506jVbhrXUrdqI=; b=goKB9Uw7N/aHa+sxHP+q/fm5GykFn7uTR3J3FT87ZAMxRal3hlf81Uq/W57nd4Be18 oQM8BqY3j8XqSRkR6CBXq3Wu68X2WEtVj+BToMTkxcToSFOCqnRgHHICMyuqrZ4mXSge G386TEDaY7fOd/kXw/eScOG5oZinTIe59qBAYpT986Ely3r+ZLhLVnVfO31HeEsM677P sdMCcUZ/jMM9CTUjmS0OpFjc5BDX01OgEaXQs1r196xKEDkN5ZGZRh+NRgIVhMpR4iqp VE3OQk1LkZKLQO837TsErHEiGnDPuuRM4iXVDvZuafW+FphenswRsV2RN2l64Ique8DN vTqQ== X-Gm-Message-State: AOAM530MLLE/odKlnCQvuwe1ekluqiNFxlNZOvNXSw+EbkxxK/U3Zeno 7t3S4ne0zdlX+KKxjEsgpR8= X-Received: by 2002:a63:9911:: with SMTP id d17mr1882183pge.111.1630927036346; Mon, 06 Sep 2021 04:17:16 -0700 (PDT) Received: from ownia.. ([173.248.225.217]) by smtp.gmail.com with ESMTPSA id a11sm8877458pgj.75.2021.09.06.04.17.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Sep 2021 04:17:15 -0700 (PDT) From: Weizhao Ouyang To: Steven Rostedt , Ingo Molnar Cc: Russell King , Catalin Marinas , Will Deacon , Guo Ren , Michal Simek , Thomas Bogendoerfer , Nick Hu , Greentime Hu , Vincent Chen , "James E.J. Bottomley" , Helge Deller , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Paul Walmsley , Palmer Dabbelt , Albert Ou , Heiko Carstens , Vasily Gorbik , Christian Borntraeger , Yoshinori Sato , Rich Felker , "David S. Miller" , Thomas Gleixner , Borislav Petkov , x86@kernel.org, "H. Peter Anvin" , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-csky@vger.kernel.org, linux-ia64@vger.kernel.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, Weizhao Ouyang Subject: [PATCH v2] ftrace: Cleanup ftrace_dyn_arch_init() Date: Mon, 6 Sep 2021 19:16:27 +0800 Message-Id: <20210906111626.1259867-1-o451686892@gmail.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Most of ARCHs use empty ftrace_dyn_arch_init(), introduce a weak common ftrace_dyn_arch_init() to cleanup them. Signed-off-by: Weizhao Ouyang Acked-by: Heiko Carstens (s390) --- Changes in v2: -- correct CONFIG_DYNAMIC_FTRACE on PowerPC -- add Acked-by tag --- arch/arm/kernel/ftrace.c | 5 ----- arch/arm64/kernel/ftrace.c | 5 ----- arch/csky/kernel/ftrace.c | 5 ----- arch/ia64/kernel/ftrace.c | 6 ------ arch/microblaze/kernel/ftrace.c | 5 ----- arch/mips/include/asm/ftrace.h | 2 ++ arch/nds32/kernel/ftrace.c | 5 ----- arch/parisc/kernel/ftrace.c | 5 ----- arch/powerpc/include/asm/ftrace.h | 4 ++++ arch/riscv/kernel/ftrace.c | 5 ----- arch/s390/kernel/ftrace.c | 5 ----- arch/sh/kernel/ftrace.c | 5 ----- arch/sparc/kernel/ftrace.c | 5 ----- arch/x86/kernel/ftrace.c | 5 ----- include/linux/ftrace.h | 1 - kernel/trace/ftrace.c | 5 +++++ 16 files changed, 11 insertions(+), 62 deletions(-) diff --git a/arch/arm/kernel/ftrace.c b/arch/arm/kernel/ftrace.c index 3c83b5d29697..a006585e1c09 100644 --- a/arch/arm/kernel/ftrace.c +++ b/arch/arm/kernel/ftrace.c @@ -193,11 +193,6 @@ int ftrace_make_nop(struct module *mod, return ret; } - -int __init ftrace_dyn_arch_init(void) -{ - return 0; -} #endif /* CONFIG_DYNAMIC_FTRACE */ #ifdef CONFIG_FUNCTION_GRAPH_TRACER diff --git a/arch/arm64/kernel/ftrace.c b/arch/arm64/kernel/ftrace.c index 7f467bd9db7a..fc62dfe73f93 100644 --- a/arch/arm64/kernel/ftrace.c +++ b/arch/arm64/kernel/ftrace.c @@ -236,11 +236,6 @@ void arch_ftrace_update_code(int command) command |= FTRACE_MAY_SLEEP; ftrace_modify_all_code(command); } - -int __init ftrace_dyn_arch_init(void) -{ - return 0; -} #endif /* CONFIG_DYNAMIC_FTRACE */ #ifdef CONFIG_FUNCTION_GRAPH_TRACER diff --git a/arch/csky/kernel/ftrace.c b/arch/csky/kernel/ftrace.c index b4a7ec1517ff..50bfcf129078 100644 --- a/arch/csky/kernel/ftrace.c +++ b/arch/csky/kernel/ftrace.c @@ -133,11 +133,6 @@ int ftrace_update_ftrace_func(ftrace_func_t func) (unsigned long)func, true, true); return ret; } - -int __init ftrace_dyn_arch_init(void) -{ - return 0; -} #endif /* CONFIG_DYNAMIC_FTRACE */ #ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS diff --git a/arch/ia64/kernel/ftrace.c b/arch/ia64/kernel/ftrace.c index b2ab2d58fb30..d6360fd404ab 100644 --- a/arch/ia64/kernel/ftrace.c +++ b/arch/ia64/kernel/ftrace.c @@ -194,9 +194,3 @@ int ftrace_update_ftrace_func(ftrace_func_t func) flush_icache_range(addr, addr + 16); return 0; } - -/* run from kstop_machine */ -int __init ftrace_dyn_arch_init(void) -{ - return 0; -} diff --git a/arch/microblaze/kernel/ftrace.c b/arch/microblaze/kernel/ftrace.c index 224eea40e1ee..188749d62709 100644 --- a/arch/microblaze/kernel/ftrace.c +++ b/arch/microblaze/kernel/ftrace.c @@ -163,11 +163,6 @@ int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr) return ret; } -int __init ftrace_dyn_arch_init(void) -{ - return 0; -} - int ftrace_update_ftrace_func(ftrace_func_t func) { unsigned long ip = (unsigned long)(&ftrace_call); diff --git a/arch/mips/include/asm/ftrace.h b/arch/mips/include/asm/ftrace.h index b463f2aa5a61..ed013e767390 100644 --- a/arch/mips/include/asm/ftrace.h +++ b/arch/mips/include/asm/ftrace.h @@ -76,6 +76,8 @@ do { \ #ifdef CONFIG_DYNAMIC_FTRACE +int __init ftrace_dyn_arch_init(void); + static inline unsigned long ftrace_call_adjust(unsigned long addr) { return addr; diff --git a/arch/nds32/kernel/ftrace.c b/arch/nds32/kernel/ftrace.c index 0e23e3a8df6b..f0ef4842d191 100644 --- a/arch/nds32/kernel/ftrace.c +++ b/arch/nds32/kernel/ftrace.c @@ -84,11 +84,6 @@ void _ftrace_caller(unsigned long parent_ip) /* restore all state needed by the compiler epilogue */ } -int __init ftrace_dyn_arch_init(void) -{ - return 0; -} - static unsigned long gen_sethi_insn(unsigned long addr) { unsigned long opcode = 0x46000000; diff --git a/arch/parisc/kernel/ftrace.c b/arch/parisc/kernel/ftrace.c index 0a1e75af5382..01581f715737 100644 --- a/arch/parisc/kernel/ftrace.c +++ b/arch/parisc/kernel/ftrace.c @@ -94,11 +94,6 @@ int ftrace_disable_ftrace_graph_caller(void) #endif #ifdef CONFIG_DYNAMIC_FTRACE - -int __init ftrace_dyn_arch_init(void) -{ - return 0; -} int ftrace_update_ftrace_func(ftrace_func_t func) { return 0; diff --git a/arch/powerpc/include/asm/ftrace.h b/arch/powerpc/include/asm/ftrace.h index debe8c4f7062..d59f67c0225f 100644 --- a/arch/powerpc/include/asm/ftrace.h +++ b/arch/powerpc/include/asm/ftrace.h @@ -61,6 +61,10 @@ struct dyn_arch_ftrace { }; #endif /* __ASSEMBLY__ */ +#ifdef CONFIG_DYNAMIC_FTRACE +int __init ftrace_dyn_arch_init(void); +#endif /* CONFIG_DYNAMIC_FTRACE */ + #ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS #define ARCH_SUPPORTS_FTRACE_OPS 1 #endif diff --git a/arch/riscv/kernel/ftrace.c b/arch/riscv/kernel/ftrace.c index 7f1e5203de88..4716f4cdc038 100644 --- a/arch/riscv/kernel/ftrace.c +++ b/arch/riscv/kernel/ftrace.c @@ -154,11 +154,6 @@ int ftrace_update_ftrace_func(ftrace_func_t func) return ret; } - -int __init ftrace_dyn_arch_init(void) -{ - return 0; -} #endif #ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS diff --git a/arch/s390/kernel/ftrace.c b/arch/s390/kernel/ftrace.c index 0a464d328467..3fd80397ff52 100644 --- a/arch/s390/kernel/ftrace.c +++ b/arch/s390/kernel/ftrace.c @@ -262,11 +262,6 @@ int ftrace_update_ftrace_func(ftrace_func_t func) return 0; } -int __init ftrace_dyn_arch_init(void) -{ - return 0; -} - void arch_ftrace_update_code(int command) { if (ftrace_shared_hotpatch_trampoline(NULL)) diff --git a/arch/sh/kernel/ftrace.c b/arch/sh/kernel/ftrace.c index 295c43315bbe..930001bb8c6a 100644 --- a/arch/sh/kernel/ftrace.c +++ b/arch/sh/kernel/ftrace.c @@ -252,11 +252,6 @@ int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr) return ftrace_modify_code(rec->ip, old, new); } - -int __init ftrace_dyn_arch_init(void) -{ - return 0; -} #endif /* CONFIG_DYNAMIC_FTRACE */ #ifdef CONFIG_FUNCTION_GRAPH_TRACER diff --git a/arch/sparc/kernel/ftrace.c b/arch/sparc/kernel/ftrace.c index 684b84ce397f..eaead3da8e03 100644 --- a/arch/sparc/kernel/ftrace.c +++ b/arch/sparc/kernel/ftrace.c @@ -82,11 +82,6 @@ int ftrace_update_ftrace_func(ftrace_func_t func) new = ftrace_call_replace(ip, (unsigned long)func); return ftrace_modify_code(ip, old, new); } - -int __init ftrace_dyn_arch_init(void) -{ - return 0; -} #endif #ifdef CONFIG_FUNCTION_GRAPH_TRACER diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c index 1b3ce3b4a2a2..23d221a9a3cd 100644 --- a/arch/x86/kernel/ftrace.c +++ b/arch/x86/kernel/ftrace.c @@ -252,11 +252,6 @@ void arch_ftrace_update_code(int command) ftrace_modify_all_code(command); } -int __init ftrace_dyn_arch_init(void) -{ - return 0; -} - /* Currently only x86_64 supports dynamic trampolines */ #ifdef CONFIG_X86_64 diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h index 832e65f06754..f1eca123d89d 100644 --- a/include/linux/ftrace.h +++ b/include/linux/ftrace.h @@ -573,7 +573,6 @@ ftrace_set_early_filter(struct ftrace_ops *ops, char *buf, int enable); /* defined in arch */ extern int ftrace_ip_converted(unsigned long ip); -extern int ftrace_dyn_arch_init(void); extern void ftrace_replace_code(int enable); extern int ftrace_update_ftrace_func(ftrace_func_t func); extern void ftrace_caller(void); diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index 7efbc8aaf7f6..4c090323198d 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c @@ -6846,6 +6846,11 @@ void __init ftrace_free_init_mem(void) ftrace_free_mem(NULL, start, end); } +int __init __weak ftrace_dyn_arch_init(void) +{ + return 0; +} + void __init ftrace_init(void) { extern unsigned long __start_mcount_loc[]; -- 2.30.2