* [PATCH] rcu: add declarations of undeclared items @ 2019-10-11 17:08 Ben Dooks 2019-10-12 4:44 ` Paul E. McKenney 0 siblings, 1 reply; 5+ messages in thread From: Ben Dooks @ 2019-10-11 17:08 UTC (permalink / raw) To: linux-kernel Cc: Ben Dooks, Paul E. McKenney, Josh Triplett, Steven Rostedt, Mathieu Desnoyers, Lai Jiangshan, Joel Fernandes, rcu, linux-kernel 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 <ben.dooks@codethink.co.uk> --- Cc: "Paul E. McKenney" <paulmck@kernel.org> Cc: Josh Triplett <josh@joshtriplett.org> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Cc: Lai Jiangshan <jiangshanlai@gmail.com> Cc: Joel Fernandes <joel@joelfernandes.org> Cc: rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org --- kernel/rcu/tree.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/kernel/rcu/tree.h b/kernel/rcu/tree.h index c612f306fe89..1f88351b9014 100644 --- a/kernel/rcu/tree.h +++ b/kernel/rcu/tree.h @@ -352,6 +352,8 @@ struct rcu_state { /* GP pre-initialization. */ }; +extern struct rcu_state rcu_state; + /* Values for rcu_state structure's gp_flags field. */ #define RCU_GP_FLAG_INIT 0x1 /* Need grace-period initialization. */ #define RCU_GP_FLAG_FQS 0x2 /* Need grace-period quiescent-state forcing. */ @@ -472,3 +474,7 @@ static void rcu_iw_handler(struct irq_work *iwp); static void check_cpu_stall(struct rcu_data *rdp); static void rcu_check_gp_start_stall(struct rcu_node *rnp, struct rcu_data *rdp, const unsigned long gpssdelay); + +extern unsigned long rcu_rnp_online_cpus(struct rcu_node *rnp); +extern bool rcu_dynticks_curr_cpu_in_eqs(void); + -- 2.23.0 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] rcu: add declarations of undeclared items 2019-10-11 17:08 [PATCH] rcu: add declarations of undeclared items Ben Dooks @ 2019-10-12 4:44 ` Paul E. McKenney 2019-10-14 7:16 ` Ben Dooks 2019-10-14 17:51 ` Joel Fernandes 0 siblings, 2 replies; 5+ messages in thread From: Paul E. McKenney @ 2019-10-12 4:44 UTC (permalink / raw) To: Ben Dooks Cc: linux-kernel, Josh Triplett, Steven Rostedt, Mathieu Desnoyers, Lai Jiangshan, Joel Fernandes, rcu, linux-kernel 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 <ben.dooks@codethink.co.uk> 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? Thanx, Paul ------------------------------------------------------------------------ commit 02995691aa76f3e52599d4f9d9d1ab23c3574f32 Author: Paul E. McKenney <paulmck@kernel.org> 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 <ben.dooks@codethink.co.uk> Signed-off-by: Paul E. McKenney <paulmck@kernel.org> 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); ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] rcu: add declarations of undeclared items 2019-10-12 4:44 ` Paul E. McKenney @ 2019-10-14 7:16 ` Ben Dooks 2019-10-14 17:51 ` Joel Fernandes 1 sibling, 0 replies; 5+ messages in thread From: Ben Dooks @ 2019-10-14 7:16 UTC (permalink / raw) To: paulmck Cc: linux-kernel, Josh Triplett, Steven Rostedt, Mathieu Desnoyers, Lai Jiangshan, Joel Fernandes, rcu, linux-kernel On 2019-10-12 05:44, 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 <ben.dooks@codethink.co.uk> > > 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? yes, thanks. ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] rcu: add declarations of undeclared items 2019-10-12 4:44 ` Paul E. McKenney 2019-10-14 7:16 ` Ben Dooks @ 2019-10-14 17:51 ` Joel Fernandes 2019-10-15 1:41 ` Paul E. McKenney 1 sibling, 1 reply; 5+ messages in thread From: Joel Fernandes @ 2019-10-14 17:51 UTC (permalink / raw) To: Paul E. McKenney Cc: Ben Dooks, linux-kernel, Josh Triplett, Steven Rostedt, Mathieu Desnoyers, Lai Jiangshan, rcu, linux-kernel 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 <ben.dooks@codethink.co.uk> > > 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) <joel@joelfernandes.org> thanks, - Joel > Thanx, Paul > > ------------------------------------------------------------------------ > > commit 02995691aa76f3e52599d4f9d9d1ab23c3574f32 > Author: Paul E. McKenney <paulmck@kernel.org> > 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 <ben.dooks@codethink.co.uk> > Signed-off-by: Paul E. McKenney <paulmck@kernel.org> > > 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); ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] rcu: add declarations of undeclared items 2019-10-14 17:51 ` Joel Fernandes @ 2019-10-15 1:41 ` Paul E. McKenney 0 siblings, 0 replies; 5+ messages in thread From: Paul E. McKenney @ 2019-10-15 1:41 UTC (permalink / raw) To: Joel Fernandes Cc: Ben Dooks, linux-kernel, Josh Triplett, Steven Rostedt, Mathieu Desnoyers, Lai Jiangshan, rcu, linux-kernel On Mon, Oct 14, 2019 at 01:51:23PM -0400, Joel Fernandes wrote: > 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 <ben.dooks@codethink.co.uk> > > > > 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) <joel@joelfernandes.org> Applied, thank you! Thanx, Paul > thanks, > > - Joel > > > Thanx, Paul > > > > ------------------------------------------------------------------------ > > > > commit 02995691aa76f3e52599d4f9d9d1ab23c3574f32 > > Author: Paul E. McKenney <paulmck@kernel.org> > > 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 <ben.dooks@codethink.co.uk> > > Signed-off-by: Paul E. McKenney <paulmck@kernel.org> > > > > 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); ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-10-15 1:41 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2019-10-11 17:08 [PATCH] rcu: add declarations of undeclared items Ben Dooks 2019-10-12 4:44 ` Paul E. McKenney 2019-10-14 7:16 ` Ben Dooks 2019-10-14 17:51 ` Joel Fernandes 2019-10-15 1:41 ` Paul E. McKenney
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).