Received: by 2002:a19:f614:0:0:0:0:0 with SMTP id x20csp32650lfe; Fri, 15 Apr 2022 18:04:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyNv7diU5g4mFWAbtRlAIWmlEQbWrD718JRxZrrWWxpRcpYDUUULf/WsqcCSmJBzED2YMIi X-Received: by 2002:a63:1252:0:b0:39d:aa7a:c6e1 with SMTP id 18-20020a631252000000b0039daa7ac6e1mr1240596pgs.436.1650071069741; Fri, 15 Apr 2022 18:04:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650071069; cv=none; d=google.com; s=arc-20160816; b=D+mLBps+muPBSur1FuyzG0qJwQP+gTMV3j7t605taiQ1baXLj6KWdw4/6QeZjzgVgB ZW6qHe8lAFQs7BxjZFfY1Oagnqvp7rYdYOPQLAmEHcappWtq8hxDm4AXTLsbiC3zmKOO U+SG6Hb8oxFdKbLEIkETw1LTCHFXgmA7Hv7fjgBePT6uU2vXuRDqW6getGfo8+Vj1fYl KAPuUij2+uIJPyZsm63D5I8BoMZQr5LiByaByHy+XG6Ff5AxMAhUyuk+X0zKz6ihtRqr yDdQeF4ouQ1Q+HUk0HVSoJw/Vas/1jUkZoLN95Zj8aWvN47+5Ga3k2qNIFJc/jgbImsI zm/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-disposition:mime-version:message-id:subject:cc:to:from:date :dkim-signature; bh=ha38xYsfejbNBgKN9o0wUY9R1DO01ebDOCHytWPPevo=; b=FShUZqTsalcGVurOTv2wLiABEr3dFTeyBaVKHfpv59lbeopG9xkt2ny9K+OM2mhLfy z13XX6o7YPy6GGb3bT2YNa2CoV31107CwCgM7MVmrtNCsOJnQaROJKkvqb/qop0865al KF91qUkQCPSzRXsc69gV4n9Fma/9ZH5j8sVc0HLRtEHlaCbD4/898WYvshawHICZLj/l VwDHLD7v/kMzmykYbQSoayhu0JlJ+T1BqHDX5ZdnptPHwJwbsmCFv5fNI06/T02lxBLW lYL18ACTo0Z7Ri52t2QlVm9WYMDpf4KCjkprQOJMtoheLBeFQ0qgdzwM/WuW26/rwOiv vtpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=GjZl1h1L; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id w13-20020a170902d70d00b00153bffd0af8si2471828ply.491.2022.04.15.18.04.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Apr 2022 18:04:29 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=GjZl1h1L; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id BD91EF328C; Fri, 15 Apr 2022 17:45:46 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242781AbiDOV4v (ORCPT + 99 others); Fri, 15 Apr 2022 17:56:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34172 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230501AbiDOV4t (ORCPT ); Fri, 15 Apr 2022 17:56:49 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B57D137ABC for ; Fri, 15 Apr 2022 14:54:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-ID:Content-Description:In-Reply-To:References; bh=ha38xYsfejbNBgKN9o0wUY9R1DO01ebDOCHytWPPevo=; b=GjZl1h1L1iVuWJIbmNFwpHu0Zu UQ8E8pgyj8GGMiBLALRDt9I2MhQ5xumTAS9ZA/7UATWuMTYQKqRPtyWYT7yYepz18wN9DIGLvnypv uDo/QYN0jQhKnm8rJ/DCotbg1H1xYcC6xxVfd4fsQZmrTV8Cd88TV0e4hhwyxQMSZXxvTWD5Wld9t ayB/2YXkeK1hu2B+C7H2nDz0IEexHPXYhn//c1XyUHdPlCdsIkt1GLloA67v0vPrQHoZ68A5UNAUa 6Rj1k1i6lRuzwyKClPrsqiI/ri/of/Lo6xvPsLgrdYk+xD382Esvu32HnPeu+iRmYiVTi2hCDKR2x 4tcpV6VQ==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nfTtE-00BRMI-5P; Fri, 15 Apr 2022 21:54:04 +0000 Date: Fri, 15 Apr 2022 14:54:04 -0700 From: Luis Chamberlain To: Steven Rostedt Cc: YueHaibing , mingo@redhat.com, xiaowei66@huawei.com, patches@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH sysctl-next] ftrace: fix building with SYSCTL=n but DYNAMIC_FTRACE=y Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit Sender: Luis Chamberlain X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org One can enable dyanmic tracing but disable sysctls. When this is doen we get the compile kernel warning: CC kernel/trace/ftrace.o kernel/trace/ftrace.c:3086:13: warning: ‘ftrace_shutdown_sysctl’ defined but not used [-Wunused-function] 3086 | static void ftrace_shutdown_sysctl(void) | ^~~~~~~~~~~~~~~~~~~~~~ kernel/trace/ftrace.c:3068:13: warning: ‘ftrace_startup_sysctl’ defined but not used [-Wunused-function] 3068 | static void ftrace_startup_sysctl(void) When CONFIG_DYNAMIC_FTRACE=n the ftrace_startup_sysctl() and routines ftrace_shutdown_sysctl() still compiles, so these are actually more just used for when SYSCTL=y. Fix this then by just moving these routines to when sysctls are enabled. Fixes: 7cde53da38a3 ("ftrace: move sysctl_ftrace_enabled to ftrace.c") Reported-by: kernel test robot Signed-off-by: Luis Chamberlain --- Steven, As with the other fixes I can take this in through sysctl-next if you are OK with that, please let me know. kernel/trace/ftrace.c | 71 +++++++++++++++++++++---------------------- 1 file changed, 34 insertions(+), 37 deletions(-) diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index db8d553728b6..d9424fd9a183 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c @@ -3065,40 +3065,6 @@ int ftrace_shutdown(struct ftrace_ops *ops, int command) return 0; } -static void ftrace_startup_sysctl(void) -{ - int command; - - if (unlikely(ftrace_disabled)) - return; - - /* Force update next time */ - saved_ftrace_func = NULL; - /* ftrace_start_up is true if we want ftrace running */ - if (ftrace_start_up) { - command = FTRACE_UPDATE_CALLS; - if (ftrace_graph_active) - command |= FTRACE_START_FUNC_RET; - ftrace_startup_enable(command); - } -} - -static void ftrace_shutdown_sysctl(void) -{ - int command; - - if (unlikely(ftrace_disabled)) - return; - - /* ftrace_start_up is true if ftrace is running */ - if (ftrace_start_up) { - command = FTRACE_DISABLE_CALLS; - if (ftrace_graph_active) - command |= FTRACE_STOP_FUNC_RET; - ftrace_run_update_code(command); - } -} - static u64 ftrace_update_time; unsigned long ftrace_update_tot_cnt; unsigned long ftrace_number_of_pages; @@ -7267,9 +7233,6 @@ core_initcall(ftrace_nodyn_init); static inline int ftrace_init_dyn_tracefs(struct dentry *d_tracer) { return 0; } static inline void ftrace_startup_all(int command) { } -# define ftrace_startup_sysctl() do { } while (0) -# define ftrace_shutdown_sysctl() do { } while (0) - static void ftrace_update_trampoline(struct ftrace_ops *ops) { } @@ -7910,6 +7873,40 @@ int unregister_ftrace_function(struct ftrace_ops *ops) EXPORT_SYMBOL_GPL(unregister_ftrace_function); #ifdef CONFIG_SYSCTL +static void ftrace_startup_sysctl(void) +{ + int command; + + if (unlikely(ftrace_disabled)) + return; + + /* Force update next time */ + saved_ftrace_func = NULL; + /* ftrace_start_up is true if we want ftrace running */ + if (ftrace_start_up) { + command = FTRACE_UPDATE_CALLS; + if (ftrace_graph_active) + command |= FTRACE_START_FUNC_RET; + ftrace_startup_enable(command); + } +} + +static void ftrace_shutdown_sysctl(void) +{ + int command; + + if (unlikely(ftrace_disabled)) + return; + + /* ftrace_start_up is true if ftrace is running */ + if (ftrace_start_up) { + command = FTRACE_DISABLE_CALLS; + if (ftrace_graph_active) + command |= FTRACE_STOP_FUNC_RET; + ftrace_run_update_code(command); + } +} + static bool is_permanent_ops_registered(void) { struct ftrace_ops *op; -- 2.30.2