All of lore.kernel.org
 help / color / mirror / Atom feed
* rcu: Call mod_timer() correctly in wake_nocb_leader_defer()
@ 2017-05-17 19:44 Dan Carpenter
  2017-05-17 20:21 ` Paul E. McKenney
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Dan Carpenter @ 2017-05-17 19:44 UTC (permalink / raw)
  To: kernel-janitors

Smatch complains that:

	kernel/rcu/tree_plugin.h:1838 wake_nocb_leader_defer()
	warn: mod_timer() takes an absolute time not an offset.

which is true.

Fixes: ebf7068a4396 ("rcu: Use timer as backstop for NOCB deferred wakeups")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h
index 34dbd0aad732..74492f20c252 100644
--- a/kernel/rcu/tree_plugin.h
+++ b/kernel/rcu/tree_plugin.h
@@ -1835,7 +1835,7 @@ static void wake_nocb_leader_defer(struct rcu_data *rdp, int waketype,
 	trace_rcu_nocb_wake(rdp->rsp->name, rdp->cpu, reason);
 	raw_spin_unlock_irqrestore(&rdp->nocb_lock, flags);
 	if (needtimer)
-		mod_timer(&rdp->nocb_timer, 1);
+		mod_timer(&rdp->nocb_timer, jiffies + 1);
 }
 
 /*

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

* Re: rcu: Call mod_timer() correctly in wake_nocb_leader_defer()
  2017-05-17 19:44 rcu: Call mod_timer() correctly in wake_nocb_leader_defer() Dan Carpenter
@ 2017-05-17 20:21 ` Paul E. McKenney
  2017-05-17 20:37 ` Dan Carpenter
  2017-05-17 21:15 ` Paul E. McKenney
  2 siblings, 0 replies; 4+ messages in thread
From: Paul E. McKenney @ 2017-05-17 20:21 UTC (permalink / raw)
  To: kernel-janitors

On Wed, May 17, 2017 at 10:44:46PM +0300, Dan Carpenter wrote:
> Smatch complains that:
> 
> 	kernel/rcu/tree_plugin.h:1838 wake_nocb_leader_defer()
> 	warn: mod_timer() takes an absolute time not an offset.
> 
> which is true.
> 
> Fixes: ebf7068a4396 ("rcu: Use timer as backstop for NOCB deferred wakeups")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Good catch, and color me slow and stupid!!!

I will fold this into the original commit with the following attribution:

[ paulmck: Dan Williams fix for mod_timer() bug detected by smatch. ]

Does that work for you?

							Thanx, Paul

PS.  This likely fixes the bug that causes about one temporary
     grace-period stall every 20 hours of rcutorture testing on the
     TREE01 test scenario.  I finally bisected to it, but it would take
     me through the weekend to accumulate statistical confidence in
     my bisection.  So it will take me some time to establish
     statistcal confidence in this fix, but hey, a fix!!!  ;-)

     Thank you!!!

> diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h
> index 34dbd0aad732..74492f20c252 100644
> --- a/kernel/rcu/tree_plugin.h
> +++ b/kernel/rcu/tree_plugin.h
> @@ -1835,7 +1835,7 @@ static void wake_nocb_leader_defer(struct rcu_data *rdp, int waketype,
>  	trace_rcu_nocb_wake(rdp->rsp->name, rdp->cpu, reason);
>  	raw_spin_unlock_irqrestore(&rdp->nocb_lock, flags);
>  	if (needtimer)
> -		mod_timer(&rdp->nocb_timer, 1);
> +		mod_timer(&rdp->nocb_timer, jiffies + 1);
>  }
> 
>  /*
> 


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

* Re: rcu: Call mod_timer() correctly in wake_nocb_leader_defer()
  2017-05-17 19:44 rcu: Call mod_timer() correctly in wake_nocb_leader_defer() Dan Carpenter
  2017-05-17 20:21 ` Paul E. McKenney
@ 2017-05-17 20:37 ` Dan Carpenter
  2017-05-17 21:15 ` Paul E. McKenney
  2 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2017-05-17 20:37 UTC (permalink / raw)
  To: kernel-janitors

On Wed, May 17, 2017 at 01:21:48PM -0700, Paul E. McKenney wrote:
> On Wed, May 17, 2017 at 10:44:46PM +0300, Dan Carpenter wrote:
> > Smatch complains that:
> > 
> > 	kernel/rcu/tree_plugin.h:1838 wake_nocb_leader_defer()
> > 	warn: mod_timer() takes an absolute time not an offset.
> > 
> > which is true.
> > 
> > Fixes: ebf7068a4396 ("rcu: Use timer as backstop for NOCB deferred wakeups")
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> Good catch, and color me slow and stupid!!!
> 
> I will fold this into the original commit with the following attribution:
> 
> [ paulmck: Dan Williams fix for mod_timer() bug detected by smatch. ]
> 
> Does that work for you?

Not really, no.  If you changed the Williams to Carpenter, then it's
fine, though.  ;)

regards,
dan carpenter



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

* Re: rcu: Call mod_timer() correctly in wake_nocb_leader_defer()
  2017-05-17 19:44 rcu: Call mod_timer() correctly in wake_nocb_leader_defer() Dan Carpenter
  2017-05-17 20:21 ` Paul E. McKenney
  2017-05-17 20:37 ` Dan Carpenter
@ 2017-05-17 21:15 ` Paul E. McKenney
  2 siblings, 0 replies; 4+ messages in thread
From: Paul E. McKenney @ 2017-05-17 21:15 UTC (permalink / raw)
  To: kernel-janitors

On Wed, May 17, 2017 at 11:37:16PM +0300, Dan Carpenter wrote:
> On Wed, May 17, 2017 at 01:21:48PM -0700, Paul E. McKenney wrote:
> > On Wed, May 17, 2017 at 10:44:46PM +0300, Dan Carpenter wrote:
> > > Smatch complains that:
> > > 
> > > 	kernel/rcu/tree_plugin.h:1838 wake_nocb_leader_defer()
> > > 	warn: mod_timer() takes an absolute time not an offset.
> > > 
> > > which is true.
> > > 
> > > Fixes: ebf7068a4396 ("rcu: Use timer as backstop for NOCB deferred wakeups")
> > > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> > 
> > Good catch, and color me slow and stupid!!!
> > 
> > I will fold this into the original commit with the following attribution:
> > 
> > [ paulmck: Dan Williams fix for mod_timer() bug detected by smatch. ]
> > 
> > Does that work for you?
> 
> Not really, no.  If you changed the Williams to Carpenter, then it's
> fine, though.  ;)

Gah!!!  I been Danned!!!  ;-)

Please accept my apologies, is the following better?

							Thanx, Paul

[ paulmck: Dan Carpenter fix for mod_timer() usage bug found by smatch. ]


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

end of thread, other threads:[~2017-05-17 21:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-17 19:44 rcu: Call mod_timer() correctly in wake_nocb_leader_defer() Dan Carpenter
2017-05-17 20:21 ` Paul E. McKenney
2017-05-17 20:37 ` Dan Carpenter
2017-05-17 21:15 ` Paul E. McKenney

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.