From patchwork Mon Jan 30 19:37:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Rix X-Patchwork-Id: 50442 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2366073wrn; Mon, 30 Jan 2023 11:53:54 -0800 (PST) X-Google-Smtp-Source: AK7set8Mncy6NdQHP0eGtFGd8kPeUbjDrADZT9Enfp900XnETb4eE8bxJydTNSOFuxOV0GXuaMd1 X-Received: by 2002:a17:903:2282:b0:196:6577:5a96 with SMTP id b2-20020a170903228200b0019665775a96mr10021488plh.30.1675108433814; Mon, 30 Jan 2023 11:53:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675108433; cv=none; d=google.com; s=arc-20160816; b=tMB3FtA8hqdoCexW09S3wEtzoLV2fNAO+031WdjNaMcWV2OiUcT9cPuSWhm+HzY3tU NbBZuGhhDu2JQezWxXCC1BLuEK8uiQhBUa0uNVijktevkQJmyehyjdhN8m6TZC7AZ2VC GKh38pq4m5QXsKdCjkmliz4X6/KPEEozM/ReF/Rug93SOQQdGU+GG/L6jbeANwDQR07N Mo1q3pXkqxs3T0+i3KQYSzZSdME6mx1lZbMB4KumHXgOQJkKLvp2QtksHHVAKM427p1f oQFt6b4XaQ2CIMJYUyUmL55pRtL4GEBq7b6U0ecxKb6QtSm8MyH98ButOvqY6nrYplqj 5NWg== 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=iRSQN5/L7bEE3ed7pm8jn+u620qpw2qg0aSU5e5+V5A=; b=Y/KV38u1C5c6e/0XjGyOWg7yH8SceFRSpmJ5k3eTfavlcaVnan4/K0CjfCbeQfWeud IN1peNFBPzWuKzRjmuYMIl/ko5zUdDLNkIeMmoLpwYuP13cR5X4ZqLeLKnornYklNCQl p2IUxjD58rr0HqjkBp6xrwynBb2ueZ9YEKyi8NqbLUv71QXvM9foMJWSdRPwj6m5X74y YlyH7vxbwly+C7nOW5bqzJXRNiMT1QgEccIt0hOQuFwaCGqJT4/AtI9VmT0A/Oa2nJXQ UmhZs8QjsWH5tbDcp93UBVtV35KkOXcxT3or3K1Giuo9VN0wWx8roymmd28eiNbUCWWT J0Fg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Q+mRGe1L; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f14-20020a170902ce8e00b00189a6834dbesi15262335plg.103.2023.01.30.11.53.41; Mon, 30 Jan 2023 11:53:53 -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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Q+mRGe1L; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238199AbjA3TiH (ORCPT + 99 others); Mon, 30 Jan 2023 14:38:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236704AbjA3TiE (ORCPT ); Mon, 30 Jan 2023 14:38:04 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4106340BFF for ; Mon, 30 Jan 2023 11:37:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1675107437; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=iRSQN5/L7bEE3ed7pm8jn+u620qpw2qg0aSU5e5+V5A=; b=Q+mRGe1L4WVrrQNKBejPQ7OAgoqPpBJ0y+WASOzsoA5vgVpXB1TxsRpFXmSj64ITzU1OsM 2nWGalutuei1NPSeSekDEnqFOHWflT652Y6v+uaitwMgtQ/pYUYp6p99IuI8SK+TSflhAW 0tbE5+2dVnTvkG4taSiBhZP0kxw9Cvo= Received: from mail-qv1-f70.google.com (mail-qv1-f70.google.com [209.85.219.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-6-T_cEugAhPtKpm-xXoASZwA-1; Mon, 30 Jan 2023 14:37:14 -0500 X-MC-Unique: T_cEugAhPtKpm-xXoASZwA-1 Received: by mail-qv1-f70.google.com with SMTP id lp6-20020a056214590600b0053a07384c95so3747206qvb.4 for ; Mon, 30 Jan 2023 11:37:13 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=iRSQN5/L7bEE3ed7pm8jn+u620qpw2qg0aSU5e5+V5A=; b=dOUhdVd1Vj/8w8rk5rlhYYry29NUjhrYOec64a4Y7ETZKToocXVMvdvzkndNoglbGR 6rVRkDKpRgSVQZLBsbXFSyqyDSEEaQdRXC4hmJeA+jYqnMNcPvG7q0OJFUDWVN0KJ7Gb cgw/SE60K1jhO6D6fGtsyFQTuUdQyKnl7srlmA9kS5cQ+WKe2rLR9AavrySdw6Lwmj2x Lh4JiKvaoIOGRgwz4D9U1+TMn71XRRvxfKVknJrk8Vq+6Ok5FQbckRT+DZQlveex5WVx L8ZqVayJUK7a/HlZPLycjtrB8l5+Wi1JlLq42AaeoVInO41LXWt9KKuTlwd6yobgnEop zIpA== X-Gm-Message-State: AO0yUKX3Xwdf2WdHS3BkcWb5ROeB3FRtTop9NVDaobdlQMjauqA3+LVg ebF2yMbw925SPsJIjwQp8ysL3nT5zQ68JS1ptoOcAQCfU3TrAFkLPkxq68edf4nAraS9DX6Pj07 bVumVE6vBsQrgU3Ea5PYDd5Sa X-Received: by 2002:a05:622a:1008:b0:3b8:73c:15e6 with SMTP id d8-20020a05622a100800b003b8073c15e6mr37046134qte.18.1675107433502; Mon, 30 Jan 2023 11:37:13 -0800 (PST) X-Received: by 2002:a05:622a:1008:b0:3b8:73c:15e6 with SMTP id d8-20020a05622a100800b003b8073c15e6mr37046108qte.18.1675107433234; Mon, 30 Jan 2023 11:37:13 -0800 (PST) Received: from localhost.localdomain.com (024-205-208-113.res.spectrum.com. [24.205.208.113]) by smtp.gmail.com with ESMTPSA id p64-20020a374243000000b006ee8874f5fasm8499120qka.53.2023.01.30.11.37.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Jan 2023 11:37:12 -0800 (PST) From: Tom Rix To: rostedt@goodmis.org, mhiramat@kernel.org, mark.rutland@arm.com Cc: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Tom Rix Subject: [PATCH] samples: ftrace: make some global variables static Date: Mon, 30 Jan 2023 11:37:08 -0800 Message-Id: <20230130193708.1378108-1-trix@redhat.com> X-Mailer: git-send-email 2.26.3 MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=unavailable 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?1756478501121945775?= X-GMAIL-MSGID: =?utf-8?q?1756478501121945775?= 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. Signed-off-by: Tom Rix Acked-by: Mark Rutland --- 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 24deb51c7261..5e891a995dd3 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) {