linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rcuperf: fix duplicate struct initializer
@ 2017-04-19 17:14 Arnd Bergmann
  2017-04-19 18:15 ` Paul E. McKenney
  0 siblings, 1 reply; 4+ messages in thread
From: Arnd Bergmann @ 2017-04-19 17:14 UTC (permalink / raw)
  To: Paul E. McKenney, Josh Triplett
  Cc: Arnd Bergmann, Steven Rostedt, Mathieu Desnoyers, Lai Jiangshan,
	Wei Yongjun, Ingo Molnar, Boqun Feng, SeongJae Park,
	linux-kernel

Building with "make W=1" shows a set of new warnings in the rcuperf code:

kernel/rcu/rcuperf.c:282:11: error: initialized field overwritten [-Werror=override-init]
  .async  = srcu_call_rcu,
kernel/rcu/rcuperf.c:282:11: note: (near initialization for 'sched_ops.async')
kernel/rcu/rcuperf.c:283:16: error: initialized field overwritten [-Werror=override-init]
  .gp_barrier = srcu_rcu_barrier,
kernel/rcu/rcuperf.c:283:16: note: (near initialization for 'sched_ops.gp_barrier')
kernel/rcu/rcuperf.c:313:11: error: initialized field overwritten [-Werror=override-init]
  .async  = call_rcu_tasks,
kernel/rcu/rcuperf.c:313:11: note: (near initialization for 'tasks_ops.async')
kernel/rcu/rcuperf.c:314:16: error: initialized field overwritten [-Werror=override-init]
  .gp_barrier = rcu_barrier_tasks,
kernel/rcu/rcuperf.c:314:16: note: (near initialization for 'tasks_ops.gp_barrier')

This appears to be a copy-paste bug, so we can remove the extranous copy.

Fixes: f743d20f2cc6 ("rcuperf: Add ability to performance-test call_rcu() and friends")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 kernel/rcu/rcuperf.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/kernel/rcu/rcuperf.c b/kernel/rcu/rcuperf.c
index 329010a41f30..e1ce97bead94 100644
--- a/kernel/rcu/rcuperf.c
+++ b/kernel/rcu/rcuperf.c
@@ -279,8 +279,6 @@ static struct rcu_perf_ops sched_ops = {
 	.exp_completed	= rcu_exp_batches_completed_sched,
 	.async		= call_rcu_sched,
 	.gp_barrier	= rcu_barrier_sched,
-	.async		= srcu_call_rcu,
-	.gp_barrier	= srcu_rcu_barrier,
 	.sync		= synchronize_sched,
 	.exp_sync	= synchronize_sched_expedited,
 	.name		= "sched"
@@ -310,8 +308,6 @@ static struct rcu_perf_ops tasks_ops = {
 	.completed	= rcu_no_completed,
 	.async		= call_rcu_tasks,
 	.gp_barrier	= rcu_barrier_tasks,
-	.async		= call_rcu_tasks,
-	.gp_barrier	= rcu_barrier_tasks,
 	.sync		= synchronize_rcu_tasks,
 	.exp_sync	= synchronize_rcu_tasks,
 	.name		= "tasks"
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] rcuperf: fix duplicate struct initializer
  2017-04-19 17:14 [PATCH] rcuperf: fix duplicate struct initializer Arnd Bergmann
@ 2017-04-19 18:15 ` Paul E. McKenney
  2017-04-19 18:45   ` Arnd Bergmann
  0 siblings, 1 reply; 4+ messages in thread
From: Paul E. McKenney @ 2017-04-19 18:15 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Josh Triplett, Steven Rostedt, Mathieu Desnoyers, Lai Jiangshan,
	Wei Yongjun, Ingo Molnar, Boqun Feng, SeongJae Park,
	linux-kernel

On Wed, Apr 19, 2017 at 07:14:34PM +0200, Arnd Bergmann wrote:
> Building with "make W=1" shows a set of new warnings in the rcuperf code:
> 
> kernel/rcu/rcuperf.c:282:11: error: initialized field overwritten [-Werror=override-init]
>   .async  = srcu_call_rcu,
> kernel/rcu/rcuperf.c:282:11: note: (near initialization for 'sched_ops.async')
> kernel/rcu/rcuperf.c:283:16: error: initialized field overwritten [-Werror=override-init]
>   .gp_barrier = srcu_rcu_barrier,
> kernel/rcu/rcuperf.c:283:16: note: (near initialization for 'sched_ops.gp_barrier')
> kernel/rcu/rcuperf.c:313:11: error: initialized field overwritten [-Werror=override-init]
>   .async  = call_rcu_tasks,
> kernel/rcu/rcuperf.c:313:11: note: (near initialization for 'tasks_ops.async')
> kernel/rcu/rcuperf.c:314:16: error: initialized field overwritten [-Werror=override-init]
>   .gp_barrier = rcu_barrier_tasks,
> kernel/rcu/rcuperf.c:314:16: note: (near initialization for 'tasks_ops.gp_barrier')
> 
> This appears to be a copy-paste bug, so we can remove the extranous copy.
> 
> Fixes: f743d20f2cc6 ("rcuperf: Add ability to performance-test call_rcu() and friends")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

For those times when you want to be -really- sure that the field is in
fact initialized!  ;-)

Good catch!!!  I merged this into the original commit with attribution:

[ paulmck: Removed the redundant initialization noted by Arnd Bergmann. ]

							Thanx, Paul

> ---
>  kernel/rcu/rcuperf.c | 4 ----
>  1 file changed, 4 deletions(-)
> 
> diff --git a/kernel/rcu/rcuperf.c b/kernel/rcu/rcuperf.c
> index 329010a41f30..e1ce97bead94 100644
> --- a/kernel/rcu/rcuperf.c
> +++ b/kernel/rcu/rcuperf.c
> @@ -279,8 +279,6 @@ static struct rcu_perf_ops sched_ops = {
>  	.exp_completed	= rcu_exp_batches_completed_sched,
>  	.async		= call_rcu_sched,
>  	.gp_barrier	= rcu_barrier_sched,
> -	.async		= srcu_call_rcu,
> -	.gp_barrier	= srcu_rcu_barrier,
>  	.sync		= synchronize_sched,
>  	.exp_sync	= synchronize_sched_expedited,
>  	.name		= "sched"
> @@ -310,8 +308,6 @@ static struct rcu_perf_ops tasks_ops = {
>  	.completed	= rcu_no_completed,
>  	.async		= call_rcu_tasks,
>  	.gp_barrier	= rcu_barrier_tasks,
> -	.async		= call_rcu_tasks,
> -	.gp_barrier	= rcu_barrier_tasks,
>  	.sync		= synchronize_rcu_tasks,
>  	.exp_sync	= synchronize_rcu_tasks,
>  	.name		= "tasks"
> -- 
> 2.9.0
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] rcuperf: fix duplicate struct initializer
  2017-04-19 18:15 ` Paul E. McKenney
@ 2017-04-19 18:45   ` Arnd Bergmann
  2017-04-19 19:11     ` Joe Perches
  0 siblings, 1 reply; 4+ messages in thread
From: Arnd Bergmann @ 2017-04-19 18:45 UTC (permalink / raw)
  To: Paul E. McKenney
  Cc: Josh Triplett, Steven Rostedt, Mathieu Desnoyers, Lai Jiangshan,
	Wei Yongjun, Ingo Molnar, Boqun Feng, SeongJae Park,
	Linux Kernel Mailing List

On Wed, Apr 19, 2017 at 8:15 PM, Paul E. McKenney
<paulmck@linux.vnet.ibm.com> wrote:
> On Wed, Apr 19, 2017 at 07:14:34PM +0200, Arnd Bergmann wrote:
>> Building with "make W=1" shows a set of new warnings in the rcuperf code:
>>
>> kernel/rcu/rcuperf.c:282:11: error: initialized field overwritten [-Werror=override-init]
>>   .async  = srcu_call_rcu,
>> kernel/rcu/rcuperf.c:282:11: note: (near initialization for 'sched_ops.async')
>> kernel/rcu/rcuperf.c:283:16: error: initialized field overwritten [-Werror=override-init]
>>   .gp_barrier = srcu_rcu_barrier,
>> kernel/rcu/rcuperf.c:283:16: note: (near initialization for 'sched_ops.gp_barrier')
>> kernel/rcu/rcuperf.c:313:11: error: initialized field overwritten [-Werror=override-init]
>>   .async  = call_rcu_tasks,
>> kernel/rcu/rcuperf.c:313:11: note: (near initialization for 'tasks_ops.async')
>> kernel/rcu/rcuperf.c:314:16: error: initialized field overwritten [-Werror=override-init]
>>   .gp_barrier = rcu_barrier_tasks,
>> kernel/rcu/rcuperf.c:314:16: note: (near initialization for 'tasks_ops.gp_barrier')
>>
>> This appears to be a copy-paste bug, so we can remove the extranous copy.
>>
>> Fixes: f743d20f2cc6 ("rcuperf: Add ability to performance-test call_rcu() and friends")
>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>
> For those times when you want to be -really- sure that the field is in
> fact initialized!  ;-)
>
> Good catch!!!  I merged this into the original commit with attribution:
>
> [ paulmck: Removed the redundant initialization noted by Arnd Bergmann. ]

Thanks!

Note that one of them was not redundant but actually incorrect, as it
replaced the _rcu_sched variant with the srcu_ variant.

       Arnd

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] rcuperf: fix duplicate struct initializer
  2017-04-19 18:45   ` Arnd Bergmann
@ 2017-04-19 19:11     ` Joe Perches
  0 siblings, 0 replies; 4+ messages in thread
From: Joe Perches @ 2017-04-19 19:11 UTC (permalink / raw)
  To: Arnd Bergmann, Paul E. McKenney
  Cc: Josh Triplett, Steven Rostedt, Mathieu Desnoyers, Lai Jiangshan,
	Wei Yongjun, Ingo Molnar, Boqun Feng, SeongJae Park,
	Linux Kernel Mailing List

On Wed, 2017-04-19 at 20:45 +0200, Arnd Bergmann wrote:
> On Wed, Apr 19, 2017 at 8:15 PM, Paul E. McKenney
> <paulmck@linux.vnet.ibm.com> wrote:
> > On Wed, Apr 19, 2017 at 07:14:34PM +0200, Arnd Bergmann wrote:
> > > Building with "make W=1" shows a set of new warnings in the rcuperf code:
> > > 
> > > kernel/rcu/rcuperf.c:282:11: error: initialized field overwritten [-Werror=override-init]
> > >   .async  = srcu_call_rcu,
> > > kernel/rcu/rcuperf.c:282:11: note: (near initialization for 'sched_ops.async')
> > > kernel/rcu/rcuperf.c:283:16: error: initialized field overwritten [-Werror=override-init]
> > >   .gp_barrier = srcu_rcu_barrier,
> > > kernel/rcu/rcuperf.c:283:16: note: (near initialization for 'sched_ops.gp_barrier')
> > > kernel/rcu/rcuperf.c:313:11: error: initialized field overwritten [-Werror=override-init]
> > >   .async  = call_rcu_tasks,
> > > kernel/rcu/rcuperf.c:313:11: note: (near initialization for 'tasks_ops.async')
> > > kernel/rcu/rcuperf.c:314:16: error: initialized field overwritten [-Werror=override-init]
> > >   .gp_barrier = rcu_barrier_tasks,
> > > kernel/rcu/rcuperf.c:314:16: note: (near initialization for 'tasks_ops.gp_barrier')
> > > 
> > > This appears to be a copy-paste bug, so we can remove the extranous copy.
> > > 
> > > Fixes: f743d20f2cc6 ("rcuperf: Add ability to performance-test call_rcu() and friends")
> > > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> > 
> > For those times when you want to be -really- sure that the field is in
> > fact initialized!  ;-)
> > 
> > Good catch!!!  I merged this into the original commit with attribution:
> > 
> > [ paulmck: Removed the redundant initialization noted by Arnd Bergmann. ]
> 
> Thanks!
> 
> Note that one of them was not redundant but actually incorrect, as it
> replaced the _rcu_sched variant with the srcu_ variant.

Perhaps that should be mentioned in the changelog.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-04-19 19:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-19 17:14 [PATCH] rcuperf: fix duplicate struct initializer Arnd Bergmann
2017-04-19 18:15 ` Paul E. McKenney
2017-04-19 18:45   ` Arnd Bergmann
2017-04-19 19:11     ` Joe Perches

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).