From patchwork Wed Feb 8 01:56:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Rostedt X-Patchwork-Id: 54131 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp3196561wrn; Tue, 7 Feb 2023 18:00:00 -0800 (PST) X-Google-Smtp-Source: AK7set8UUB2vCpfHtG82WE6Rh8Vq8nP2gwwZ3AwuwINOl9+FLCNo0u1midTKRO1aj6jPXB6+FNND X-Received: by 2002:a50:99c1:0:b0:49e:1f0e:e209 with SMTP id n1-20020a5099c1000000b0049e1f0ee209mr1096217edb.10.1675821600711; Tue, 07 Feb 2023 18:00:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675821600; cv=none; d=google.com; s=arc-20160816; b=H3cfnwNWERGaLs11D8U0IWSwlBqnmOAKDMgURV6++jwYlNYYQAenFrBna60+lfWOu+ SpZaMM5jBDMaNGpZqiW/63HC2UrMY7IIQbaIc8jfZ5jZ3WoTQUBPrNGEBaqaaixyND89 PEFMAC6N3MdjqmEK3/xTsG21sIHlXN+oqtkgP2VxuYMF6YC/W4Lk+Df6LeLfnZmlENZQ oY7zoUzrOLgOJkvqKp3MMi2d6xsy5TAW0uVo5lDY1FjpjusG1UPHj9WeT+53RQ96LqBb jOmf3Mfqdr80u8ZcQTAGqWMTcyBeOH7DPeHnb1uOF/53uSdFvLHMsZnJIl8v5RGR91b/ UbZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:subject:cc:to:from:date :user-agent:message-id; bh=Ih8B/f1F/LBHMpnBkyFV7B9QbzUd1oxwrv45qO83hZw=; b=DJDT+o5WFCmS02QxFyReL01m/FGEs06Bs4cKOgEpGPuC0wI2k1Pw9LLdaoWP/zcIVh gUaaV8tvMb7W4Bj9L492uDBDxMAz7ECvw9/aUwre9ML53bTCevaLCbG8801yRjcy6oQf fwW801S/TLlJDBma8U/IJ8hG9dVEAZLGRTJRhxtCP6ikgarBX9Ps6qTPtTzHUY9C9qsX U7pjeBvtR+chpgxDLx/UwgwCEkHo4a+TdOZgVik0pVwrNLMHfo0ij7OjNpqiSGnL+dwm JdKUl0VGf3hWfe/KXckhHTB6btSTLXwLqGO3XCkDcVWHHB9j2T1xcxhsjvR6PdGbPhhL 0UOQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l4-20020a056402124400b004aada67b0ebsi104490edw.510.2023.02.07.17.59.37; Tue, 07 Feb 2023 18:00:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229910AbjBHB5j (ORCPT + 99 others); Tue, 7 Feb 2023 20:57:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56890 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229731AbjBHB5e (ORCPT ); Tue, 7 Feb 2023 20:57:34 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 91D5B3E601 for ; Tue, 7 Feb 2023 17:57:33 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2D02B6147F for ; Wed, 8 Feb 2023 01:57:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9B27DC433D2; Wed, 8 Feb 2023 01:57:32 +0000 (UTC) Received: from rostedt by gandalf.local.home with local (Exim 4.96) (envelope-from ) id 1pPZiF-006dPG-25; Tue, 07 Feb 2023 20:57:31 -0500 Message-ID: <20230208015731.460057881@goodmis.org> User-Agent: quilt/0.66 Date: Tue, 07 Feb 2023 20:56:39 -0500 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Masami Hiramatsu , Andrew Morton , Tom Rix , Mark Rutland Subject: [for-next][PATCH 06/11] samples: ftrace: Make some global variables static References: <20230208015633.791198913@goodmis.org> MIME-Version: 1.0 X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757226310585447519?= X-GMAIL-MSGID: =?utf-8?q?1757226310585447519?= From: Tom Rix smatch reports this representative issue samples/ftrace/ftrace-ops.c:15:14: warning: symbol 'nr_function_calls' was not declared. Should it be static? The nr_functions_calls and several other global variables are only used in ftrace-ops.c, so they should be static. Remove the instances of initializing static int to 0. Link: https://lore.kernel.org/linux-trace-kernel/20230130193708.1378108-1-trix@redhat.com Signed-off-by: Tom Rix Acked-by: Mark Rutland Signed-off-by: Steven Rostedt (Google) --- samples/ftrace/ftrace-ops.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/samples/ftrace/ftrace-ops.c b/samples/ftrace/ftrace-ops.c index 0c8da87ff5c3..68d6685c80bd 100644 --- a/samples/ftrace/ftrace-ops.c +++ b/samples/ftrace/ftrace-ops.c @@ -12,7 +12,7 @@ * Arbitrary large value chosen to be sufficiently large to minimize noise but * sufficiently small to complete quickly. */ -unsigned int nr_function_calls = 100000; +static unsigned int nr_function_calls = 100000; module_param(nr_function_calls, uint, 0); MODULE_PARM_DESC(nr_function_calls, "How many times to call the relevant tracee"); @@ -21,7 +21,7 @@ MODULE_PARM_DESC(nr_function_calls, "How many times to call the relevant tracee" * be called directly or whether it's necessary to go via the list func, which * can be significantly more expensive. */ -unsigned int nr_ops_relevant = 1; +static unsigned int nr_ops_relevant = 1; module_param(nr_ops_relevant, uint, 0); MODULE_PARM_DESC(nr_ops_relevant, "How many ftrace_ops to associate with the relevant tracee"); @@ -30,7 +30,7 @@ MODULE_PARM_DESC(nr_ops_relevant, "How many ftrace_ops to associate with the rel * tracers enabled for distinct functions can force the use of the list func * and incur overhead for all call sites. */ -unsigned int nr_ops_irrelevant = 0; +static unsigned int nr_ops_irrelevant; module_param(nr_ops_irrelevant, uint, 0); MODULE_PARM_DESC(nr_ops_irrelevant, "How many ftrace_ops to associate with the irrelevant tracee"); @@ -38,15 +38,15 @@ MODULE_PARM_DESC(nr_ops_irrelevant, "How many ftrace_ops to associate with the i * On architectures with DYNAMIC_FTRACE_WITH_REGS, saving the full pt_regs can * be more expensive than only saving the minimal necessary regs. */ -bool save_regs = false; +static bool save_regs; module_param(save_regs, bool, 0); MODULE_PARM_DESC(save_regs, "Register ops with FTRACE_OPS_FL_SAVE_REGS (save all registers in the trampoline)"); -bool assist_recursion = false; +static bool assist_recursion; module_param(assist_recursion, bool, 0); MODULE_PARM_DESC(assist_reursion, "Register ops with FTRACE_OPS_FL_RECURSION"); -bool assist_rcu = false; +static bool assist_rcu; module_param(assist_rcu, bool, 0); MODULE_PARM_DESC(assist_reursion, "Register ops with FTRACE_OPS_FL_RCU"); @@ -55,7 +55,7 @@ MODULE_PARM_DESC(assist_reursion, "Register ops with FTRACE_OPS_FL_RCU"); * overhead. Sometimes a consistency check using a more expensive tracer is * desireable. */ -bool check_count = false; +static bool check_count; module_param(check_count, bool, 0); MODULE_PARM_DESC(check_count, "Check that tracers are called the expected number of times\n"); @@ -64,7 +64,7 @@ MODULE_PARM_DESC(check_count, "Check that tracers are called the expected number * runs, but sometimes it can be useful to leave them registered so that they * can be inspected through the tracefs 'enabled_functions' file. */ -bool persist = false; +static bool persist; module_param(persist, bool, 0); MODULE_PARM_DESC(persist, "Successfully load module and leave ftrace ops registered after test completes\n"); @@ -114,8 +114,8 @@ static void ops_func_count(unsigned long ip, unsigned long parent_ip, self->count++; } -struct sample_ops *ops_relevant; -struct sample_ops *ops_irrelevant; +static struct sample_ops *ops_relevant; +static struct sample_ops *ops_irrelevant; static struct sample_ops *ops_alloc_init(void *tracee, ftrace_func_t func, unsigned long flags, int nr) @@ -163,8 +163,8 @@ static void ops_check(struct sample_ops *ops, int nr, } } -ftrace_func_t tracer_relevant = ops_func_nop; -ftrace_func_t tracer_irrelevant = ops_func_nop; +static ftrace_func_t tracer_relevant = ops_func_nop; +static ftrace_func_t tracer_irrelevant = ops_func_nop; static int __init ftrace_ops_sample_init(void) {