public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH] rcu: using ACCESS_ONCE() to observe the jiffies_stall/rnp->qsmask value
@ 2010-09-28  8:32 Dongdong Deng
  2010-09-28 23:28 ` Paul E. McKenney
  0 siblings, 1 reply; 4+ messages in thread
From: Dongdong Deng @ 2010-09-28  8:32 UTC (permalink / raw)
  To: paulmck, dipankar; +Cc: linux-kernel, dongdong.deng

Using ACCESS_ONCE() to observe the jiffies_stall/rnp->qsmask value
due to the caller didn't hold the root_rcu/rnp node's lock.

Signed-off-by: Dongdong Deng <dongdong.deng@windriver.com>
CC: Dipankar Sarma <dipankar@in.ibm.com>
CC: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
 kernel/rcutree.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/rcutree.c b/kernel/rcutree.c
index d5bc439..07a7063 100644
--- a/kernel/rcutree.c
+++ b/kernel/rcutree.c
@@ -532,9 +532,9 @@ static void check_cpu_stall(struct rcu_state *rsp, struct rcu_data *rdp)
 
 	if (rcu_cpu_stall_panicking)
 		return;
-	delta = jiffies - rsp->jiffies_stall;
+	delta = jiffies - ACCESS_ONCE(rsp->jiffies_stall);
 	rnp = rdp->mynode;
-	if ((rnp->qsmask & rdp->grpmask) && delta >= 0) {
+	if ((ACCESS_ONCE(rnp->qsmask) & rdp->grpmask) && delta >= 0) {
 
 		/* We haven't checked in, so go dump stack. */
 		print_cpu_stall(rsp);
-- 
1.6.0.4


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

* Re: [RFC PATCH] rcu: using ACCESS_ONCE() to observe the jiffies_stall/rnp->qsmask value
  2010-09-28  8:32 [RFC PATCH] rcu: using ACCESS_ONCE() to observe the jiffies_stall/rnp->qsmask value Dongdong Deng
@ 2010-09-28 23:28 ` Paul E. McKenney
  2010-09-29  6:46   ` DDD
  0 siblings, 1 reply; 4+ messages in thread
From: Paul E. McKenney @ 2010-09-28 23:28 UTC (permalink / raw)
  To: Dongdong Deng; +Cc: dipankar, linux-kernel

On Tue, Sep 28, 2010 at 04:32:43PM +0800, Dongdong Deng wrote:
> Using ACCESS_ONCE() to observe the jiffies_stall/rnp->qsmask value
> due to the caller didn't hold the root_rcu/rnp node's lock.

Given that the quantities are only used once, ACCESS_ONCE() is strictly
speaking not necessary.  I am tempted to queue your patch regardless
for the documentation benefits.

Or is this patch necessary to fix a failure that you have been seeing?

In any case, thank you for taking a look at RCU!

							Thanx, Paul

> Signed-off-by: Dongdong Deng <dongdong.deng@windriver.com>
> CC: Dipankar Sarma <dipankar@in.ibm.com>
> CC: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> ---
>  kernel/rcutree.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/kernel/rcutree.c b/kernel/rcutree.c
> index d5bc439..07a7063 100644
> --- a/kernel/rcutree.c
> +++ b/kernel/rcutree.c
> @@ -532,9 +532,9 @@ static void check_cpu_stall(struct rcu_state *rsp, struct rcu_data *rdp)
> 
>  	if (rcu_cpu_stall_panicking)
>  		return;
> -	delta = jiffies - rsp->jiffies_stall;
> +	delta = jiffies - ACCESS_ONCE(rsp->jiffies_stall);
>  	rnp = rdp->mynode;
> -	if ((rnp->qsmask & rdp->grpmask) && delta >= 0) {
> +	if ((ACCESS_ONCE(rnp->qsmask) & rdp->grpmask) && delta >= 0) {
> 
>  		/* We haven't checked in, so go dump stack. */
>  		print_cpu_stall(rsp);
> -- 
> 1.6.0.4
> 

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

* Re: [RFC PATCH] rcu: using ACCESS_ONCE() to observe the jiffies_stall/rnp->qsmask value
  2010-09-28 23:28 ` Paul E. McKenney
@ 2010-09-29  6:46   ` DDD
  2010-10-07  0:43     ` Paul E. McKenney
  0 siblings, 1 reply; 4+ messages in thread
From: DDD @ 2010-09-29  6:46 UTC (permalink / raw)
  To: paulmck; +Cc: dipankar, linux-kernel

Paul E. McKenney wrote:
> On Tue, Sep 28, 2010 at 04:32:43PM +0800, Dongdong Deng wrote:
>> Using ACCESS_ONCE() to observe the jiffies_stall/rnp->qsmask value
>> due to the caller didn't hold the root_rcu/rnp node's lock.
> 
> Given that the quantities are only used once, ACCESS_ONCE() is strictly
> speaking not necessary.  I am tempted to queue your patch regardless
> for the documentation benefits.
> 
> Or is this patch necessary to fix a failure that you have been seeing?

Hello Pual,

No, I didn't see a failure about it.
I got this patch from code review.  :-)

Thanks,
Dongdong

> In any case, thank you for taking a look at RCU!
> 
> 							Thanx, Paul
> 
>> Signed-off-by: Dongdong Deng <dongdong.deng@windriver.com>
>> CC: Dipankar Sarma <dipankar@in.ibm.com>
>> CC: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
>> ---
>>  kernel/rcutree.c |    4 ++--
>>  1 files changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/kernel/rcutree.c b/kernel/rcutree.c
>> index d5bc439..07a7063 100644
>> --- a/kernel/rcutree.c
>> +++ b/kernel/rcutree.c
>> @@ -532,9 +532,9 @@ static void check_cpu_stall(struct rcu_state *rsp, struct rcu_data *rdp)
>>
>>  	if (rcu_cpu_stall_panicking)
>>  		return;
>> -	delta = jiffies - rsp->jiffies_stall;
>> +	delta = jiffies - ACCESS_ONCE(rsp->jiffies_stall);
>>  	rnp = rdp->mynode;
>> -	if ((rnp->qsmask & rdp->grpmask) && delta >= 0) {
>> +	if ((ACCESS_ONCE(rnp->qsmask) & rdp->grpmask) && delta >= 0) {
>>
>>  		/* We haven't checked in, so go dump stack. */
>>  		print_cpu_stall(rsp);
>> -- 
>> 1.6.0.4
>>
> 



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

* Re: [RFC PATCH] rcu: using ACCESS_ONCE() to observe the jiffies_stall/rnp->qsmask value
  2010-09-29  6:46   ` DDD
@ 2010-10-07  0:43     ` Paul E. McKenney
  0 siblings, 0 replies; 4+ messages in thread
From: Paul E. McKenney @ 2010-10-07  0:43 UTC (permalink / raw)
  To: DDD; +Cc: dipankar, linux-kernel

On Wed, Sep 29, 2010 at 02:46:18PM +0800, DDD wrote:
> Paul E. McKenney wrote:
> >On Tue, Sep 28, 2010 at 04:32:43PM +0800, Dongdong Deng wrote:
> >>Using ACCESS_ONCE() to observe the jiffies_stall/rnp->qsmask value
> >>due to the caller didn't hold the root_rcu/rnp node's lock.
> >
> >Given that the quantities are only used once, ACCESS_ONCE() is strictly
> >speaking not necessary.  I am tempted to queue your patch regardless
> >for the documentation benefits.
> >
> >Or is this patch necessary to fix a failure that you have been seeing?
> 
> Hello Pual,
> 
> No, I didn't see a failure about it.
> I got this patch from code review.  :-)

Thank you for the info, patch queued.

							Thanx, Paul

> Thanks,
> Dongdong
> 
> >In any case, thank you for taking a look at RCU!
> >
> >							Thanx, Paul
> >
> >>Signed-off-by: Dongdong Deng <dongdong.deng@windriver.com>
> >>CC: Dipankar Sarma <dipankar@in.ibm.com>
> >>CC: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> >>---
> >> kernel/rcutree.c |    4 ++--
> >> 1 files changed, 2 insertions(+), 2 deletions(-)
> >>
> >>diff --git a/kernel/rcutree.c b/kernel/rcutree.c
> >>index d5bc439..07a7063 100644
> >>--- a/kernel/rcutree.c
> >>+++ b/kernel/rcutree.c
> >>@@ -532,9 +532,9 @@ static void check_cpu_stall(struct rcu_state *rsp, struct rcu_data *rdp)
> >>
> >> 	if (rcu_cpu_stall_panicking)
> >> 		return;
> >>-	delta = jiffies - rsp->jiffies_stall;
> >>+	delta = jiffies - ACCESS_ONCE(rsp->jiffies_stall);
> >> 	rnp = rdp->mynode;
> >>-	if ((rnp->qsmask & rdp->grpmask) && delta >= 0) {
> >>+	if ((ACCESS_ONCE(rnp->qsmask) & rdp->grpmask) && delta >= 0) {
> >>
> >> 		/* We haven't checked in, so go dump stack. */
> >> 		print_cpu_stall(rsp);
> >>-- 
> >>1.6.0.4
> >>
> >
> 
> 

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

end of thread, other threads:[~2010-10-07  0:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-28  8:32 [RFC PATCH] rcu: using ACCESS_ONCE() to observe the jiffies_stall/rnp->qsmask value Dongdong Deng
2010-09-28 23:28 ` Paul E. McKenney
2010-09-29  6:46   ` DDD
2010-10-07  0:43     ` 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