Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp4940640ybp; Mon, 14 Oct 2019 12:34:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqxHZb7XeRtnQScqu7UrWh9il2tXlq2FNL1yEFtHn3+mABerWxuknDmVKBmm6FNMKQiNE7pT X-Received: by 2002:a17:906:6882:: with SMTP id n2mr31125006ejr.48.1571081665976; Mon, 14 Oct 2019 12:34:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571081665; cv=none; d=google.com; s=arc-20160816; b=wrSIv2K4y2u5p5zxv2zcAJV5cSXL0gwgMZ9kBX14VJPJGzKIDZ8rEw45rgsvHcIHT7 Y8bmHX3eo+71yuPGn6bInBQh3KStKH6xy/PFZnS8vIVqWVnv6BMkAqM6779Z+OVDSRks HjZbMdZUkt0xHyUe2+QAFkZzaQQpyS8vJwMydelhqoKMOm3L+ci8JqI78l3H+ESxVlEt KVxUGVSKOax4+oSPc6p1xbQXLQEye81ga72xhN+YmhFLX8EirBHVOeiLPRIbPJf/5k+n 6e2J3qFQIHfnpeKFLXq3r+yxkypGcYoWgdGNIIdI/brxkf5iGC9zYkyIcZq9mIlUngwF Gxiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=HcvUzuJFn+RmmqNNAbiz0FxwJB/7vqfgbxYqeMhYLjg=; b=FnHm8aqlV4ohmemxo23bGGEl0/8P2cyqjijD6scywGeMWXlAaB/1lH1VDAI2J2Guz1 vLBjqV0sqGWc/nbFRC5CqcR98t24MG8/dSkOwZj17lrwpixyO2gmXmGxnIfH2wabso3c TkMiVGRVgOtiugRJ5DotYS0RDFLRqJsJ7ofrfX7qrVHdstQuvrY5cSc18PHqFJu0w5lM EalH9ZZh/tNu5AF3l8K+1/7ZlFgOpTciRMiCDIk+Db8oGHtD1XAab6ssk+YTXyRpMJuJ YuG5UPBWM6pRxbdyeTz/xM4Lo3PTcd27OXQsyzXdK8rHVBd9Gt6yKXJerFgeZJYLTaD5 jN4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=sYTwemec; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z19si11705529edr.403.2019.10.14.12.34.02; Mon, 14 Oct 2019 12:34:25 -0700 (PDT) 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=@joelfernandes.org header.s=google header.b=sYTwemec; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731684AbfJNRv0 (ORCPT + 99 others); Mon, 14 Oct 2019 13:51:26 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:33904 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730572AbfJNRv0 (ORCPT ); Mon, 14 Oct 2019 13:51:26 -0400 Received: by mail-pg1-f196.google.com with SMTP id k20so3164497pgi.1 for ; Mon, 14 Oct 2019 10:51:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=HcvUzuJFn+RmmqNNAbiz0FxwJB/7vqfgbxYqeMhYLjg=; b=sYTwemecYiXkWr/trjdpTp/EtdmikXY4RSYj52oYXukGC0568QqCQA6Eg/5Xb+kUCb FRkGQXgnQKYwuZgn4XWT7HH3VTcqXLd9EzUmRnRDRl0UHG57E8ve/RYUnKfVdJeyKAOL t09d0ChGvW/6iFITFFsHGoI9EXJ5la69quBJs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=HcvUzuJFn+RmmqNNAbiz0FxwJB/7vqfgbxYqeMhYLjg=; b=MzCnjn7d0kJA7StEGfmcIA7EResizjMNP3haAE+5YR6XHfeeWvxbdaw9/5zmqIW9Z8 0kjRd9qFQcUUCK7GThQGF3BHaflySsFllsMaCylAVTN0V2XhwCqqq0vcJvNoeT9oQwJk 5P0XY/8raZLmrBp16KW1WamfT8d2taCZEtiFkdeQmRZ9UwCdGLLrstt6E2VqR86ob3/h 85cwS6r1Fx7B6Jv8A9yeqE5u544f7nDgUG1aHZgAOH7jAHRXMPO1p2dDg6UM+7L/e3bq RZAesVomnoezmGajl1lvLwP10Ax4n4h4mWVvwndIbMFkLlj3mOioIKglFiMKZGTBo13D I/yA== X-Gm-Message-State: APjAAAW/P796ke/MVfq8FCi2YF1LxwhBGd48NGsUovy/JB+A3rX3xP6+ F5x/eoHW+CwIquQE1OoaLSrRKw== X-Received: by 2002:aa7:9157:: with SMTP id 23mr34274904pfi.73.1571075485244; Mon, 14 Oct 2019 10:51:25 -0700 (PDT) Received: from localhost ([2620:15c:6:12:9c46:e0da:efbf:69cc]) by smtp.gmail.com with ESMTPSA id o60sm29178561pje.21.2019.10.14.10.51.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Oct 2019 10:51:24 -0700 (PDT) Date: Mon, 14 Oct 2019 13:51:23 -0400 From: Joel Fernandes To: "Paul E. McKenney" Cc: Ben Dooks , linux-kernel@lists.codethink.co.uk, Josh Triplett , Steven Rostedt , Mathieu Desnoyers , Lai Jiangshan , rcu@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] rcu: add declarations of undeclared items Message-ID: <20191014175123.GC105106@google.com> References: <20191011170824.30228-1-ben.dooks@codethink.co.uk> <20191012044430.GG2689@paulmck-ThinkPad-P72> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191012044430.GG2689@paulmck-ThinkPad-P72> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 11, 2019 at 09:44:30PM -0700, Paul E. McKenney wrote: > On Fri, Oct 11, 2019 at 06:08:24PM +0100, Ben Dooks wrote: > > The rcu_state, rcu_rnp_online_cpus and rcu_dynticks_curr_cpu_in_eqs > > do not have declarations in a header. Add these to remove the > > following sparse warnings: > > > > kernel/rcu/tree.c:87:18: warning: symbol 'rcu_state' was not declared. Should it be static? > > kernel/rcu/tree.c:191:15: warning: symbol 'rcu_rnp_online_cpus' was not declared. Should it be static? > > kernel/rcu/tree.c:297:6: warning: symbol 'rcu_dynticks_curr_cpu_in_eqs' was not declared. Should it be static? > > > > Signed-off-by: Ben Dooks > > Good catch! > > However, these guys (plus one more) are actually used only in the > kernel/rcu/tree.o translation unit, so they can be marked static. > I made this change as shown below with your Reported-by. > > Seem reasonable? > LGTM. Reviewed-by: Joel Fernandes (Google) thanks, - Joel > Thanx, Paul > > ------------------------------------------------------------------------ > > commit 02995691aa76f3e52599d4f9d9d1ab23c3574f32 > Author: Paul E. McKenney > Date: Fri Oct 11 21:40:09 2019 -0700 > > rcu: Mark non-global functions and variables as static > > Each of rcu_state, rcu_rnp_online_cpus(), rcu_dynticks_curr_cpu_in_eqs(), > and rcu_dynticks_snap() are used only in the kernel/rcu/tree.o translation > unit, and may thus be marked static. This commit therefore makes this > change. > > Reported-by: Ben Dooks > Signed-off-by: Paul E. McKenney > > diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c > index b18fa3d..278798e 100644 > --- a/kernel/rcu/tree.c > +++ b/kernel/rcu/tree.c > @@ -85,7 +85,7 @@ static DEFINE_PER_CPU_SHARED_ALIGNED(struct rcu_data, rcu_data) = { > .dynticks_nmi_nesting = DYNTICK_IRQ_NONIDLE, > .dynticks = ATOMIC_INIT(RCU_DYNTICK_CTRL_CTR), > }; > -struct rcu_state rcu_state = { > +static struct rcu_state rcu_state = { > .level = { &rcu_state.node[0] }, > .gp_state = RCU_GP_IDLE, > .gp_seq = (0UL - 300UL) << RCU_SEQ_CTR_SHIFT, > @@ -189,7 +189,7 @@ EXPORT_SYMBOL_GPL(rcu_get_gp_kthreads_prio); > * held, but the bit corresponding to the current CPU will be stable > * in most contexts. > */ > -unsigned long rcu_rnp_online_cpus(struct rcu_node *rnp) > +static unsigned long rcu_rnp_online_cpus(struct rcu_node *rnp) > { > return READ_ONCE(rnp->qsmaskinitnext); > } > @@ -295,7 +295,7 @@ static void rcu_dynticks_eqs_online(void) > * > * No ordering, as we are sampling CPU-local information. > */ > -bool rcu_dynticks_curr_cpu_in_eqs(void) > +static bool rcu_dynticks_curr_cpu_in_eqs(void) > { > struct rcu_data *rdp = this_cpu_ptr(&rcu_data); > > @@ -306,7 +306,7 @@ bool rcu_dynticks_curr_cpu_in_eqs(void) > * Snapshot the ->dynticks counter with full ordering so as to allow > * stable comparison of this counter with past and future snapshots. > */ > -int rcu_dynticks_snap(struct rcu_data *rdp) > +static int rcu_dynticks_snap(struct rcu_data *rdp) > { > int snap = atomic_add_return(0, &rdp->dynticks); > > diff --git a/kernel/rcu/tree.h b/kernel/rcu/tree.h > index 1540542..f8e6c70 100644 > --- a/kernel/rcu/tree.h > +++ b/kernel/rcu/tree.h > @@ -402,8 +402,6 @@ static const char *tp_rcu_varname __used __tracepoint_string = rcu_name; > #define RCU_NAME rcu_name > #endif /* #else #ifdef CONFIG_TRACING */ > > -int rcu_dynticks_snap(struct rcu_data *rdp); > - > /* Forward declarations for tree_plugin.h */ > static void rcu_bootup_announce(void); > static void rcu_qs(void);