rcu.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rcu: tree_stall: Correctly unlock root node in rcu_check_gp_start_stall
@ 2019-03-29 11:27 Neeraj Upadhyay
  2019-03-29 13:28 ` Mukesh Ojha
  0 siblings, 1 reply; 6+ messages in thread
From: Neeraj Upadhyay @ 2019-03-29 11:27 UTC (permalink / raw)
  To: paulmck, josh, rostedt, mathieu.desnoyers, jiangshanlai, joel
  Cc: rcu, linux-kernel, Neeraj Upadhyay

Only unlock the root node, if current node (rnp) is not
root node.

Signed-off-by: Neeraj Upadhyay <neeraju@codeaurora.org>
---
 kernel/rcu/tree_stall.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/kernel/rcu/tree_stall.h b/kernel/rcu/tree_stall.h
index f65a73a..0651833 100644
--- a/kernel/rcu/tree_stall.h
+++ b/kernel/rcu/tree_stall.h
@@ -630,7 +630,9 @@ static void rcu_check_gp_start_stall(struct rcu_node *rnp, struct rcu_data *rdp,
 	    time_before(j, rcu_state.gp_req_activity + gpssdelay) ||
 	    time_before(j, rcu_state.gp_activity + gpssdelay) ||
 	    atomic_xchg(&warned, 1)) {
-		raw_spin_unlock_rcu_node(rnp_root); /* irqs remain disabled. */
+		if (rnp_root != rnp)
+			/* irqs remain disabled. */
+			raw_spin_unlock_rcu_node(rnp_root);
 		raw_spin_unlock_irqrestore_rcu_node(rnp, flags);
 		return;
 	}
-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a
member of the Code Aurora Forum, hosted by The Linux Foundation


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

* Re: [PATCH] rcu: tree_stall: Correctly unlock root node in rcu_check_gp_start_stall
  2019-03-29 11:27 [PATCH] rcu: tree_stall: Correctly unlock root node in rcu_check_gp_start_stall Neeraj Upadhyay
@ 2019-03-29 13:28 ` Mukesh Ojha
  2019-03-29 14:22   ` Neeraj Upadhyay
  0 siblings, 1 reply; 6+ messages in thread
From: Mukesh Ojha @ 2019-03-29 13:28 UTC (permalink / raw)
  To: Neeraj Upadhyay, paulmck, josh, rostedt, mathieu.desnoyers,
	jiangshanlai, joel
  Cc: rcu, linux-kernel


On 3/29/2019 4:57 PM, Neeraj Upadhyay wrote:
> Only unlock the root node, if current node (rnp) is not
> root node.
>
> Signed-off-by: Neeraj Upadhyay <neeraju@codeaurora.org>



> ---
>   kernel/rcu/tree_stall.h | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/rcu/tree_stall.h b/kernel/rcu/tree_stall.h
> index f65a73a..0651833 100644
> --- a/kernel/rcu/tree_stall.h
> +++ b/kernel/rcu/tree_stall.h


why this is showing as under tree_stall.h while it is under 
"kernel/rcu/tree.c"

> @@ -630,7 +630,9 @@ static void rcu_check_gp_start_stall(struct rcu_node *rnp, struct rcu_data *rdp,
>   	    time_before(j, rcu_state.gp_req_activity + gpssdelay) ||
>   	    time_before(j, rcu_state.gp_activity + gpssdelay) ||
>   	    atomic_xchg(&warned, 1)) {
> -		raw_spin_unlock_rcu_node(rnp_root); /* irqs remain disabled. */
> +		if (rnp_root != rnp)
> +			/* irqs remain disabled. */
> +			raw_spin_unlock_rcu_node(rnp_root);

Looks good as it will balance the lock .if it is the root_node, which 
was not there earlier, and unlock was happening without any lock on root.

Reviewed-by: Mukesh Ojha <mojha@codeaurora.org>

Cheers,
-Mukesh

>   		raw_spin_unlock_irqrestore_rcu_node(rnp, flags);
>   		return;
>   	}

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

* Re: [PATCH] rcu: tree_stall: Correctly unlock root node in rcu_check_gp_start_stall
  2019-03-29 13:28 ` Mukesh Ojha
@ 2019-03-29 14:22   ` Neeraj Upadhyay
  2019-03-29 21:27     ` Paul E. McKenney
  0 siblings, 1 reply; 6+ messages in thread
From: Neeraj Upadhyay @ 2019-03-29 14:22 UTC (permalink / raw)
  To: Mukesh Ojha, paulmck, josh, rostedt, mathieu.desnoyers,
	jiangshanlai, joel
  Cc: rcu, linux-kernel



On 3/29/19 6:58 PM, Mukesh Ojha wrote:
> 
> On 3/29/2019 4:57 PM, Neeraj Upadhyay wrote:
>> Only unlock the root node, if current node (rnp) is not
>> root node.
>>
>> Signed-off-by: Neeraj Upadhyay <neeraju@codeaurora.org>
> 
> 
> 
>> ---
>>   kernel/rcu/tree_stall.h | 4 +++-
>>   1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/kernel/rcu/tree_stall.h b/kernel/rcu/tree_stall.h
>> index f65a73a..0651833 100644
>> --- a/kernel/rcu/tree_stall.h
>> +++ b/kernel/rcu/tree_stall.h
> 
> 
> why this is showing as under tree_stall.h while it is under 
> "kernel/rcu/tree.c"

It's moved in 
https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git/commit/?h=dev&id=10462d6f58fb6dbde7563e9343505d98d5bfba3d

Please see linux-rcu dev tree for other changes, which moves code to 
this file.


Thanks
Neeraj

> 
>> @@ -630,7 +630,9 @@ static void rcu_check_gp_start_stall(struct 
>> rcu_node *rnp, struct rcu_data *rdp,
>>           time_before(j, rcu_state.gp_req_activity + gpssdelay) ||
>>           time_before(j, rcu_state.gp_activity + gpssdelay) ||
>>           atomic_xchg(&warned, 1)) {
>> -        raw_spin_unlock_rcu_node(rnp_root); /* irqs remain disabled. */
>> +        if (rnp_root != rnp)
>> +            /* irqs remain disabled. */
>> +            raw_spin_unlock_rcu_node(rnp_root);
> 
> Looks good as it will balance the lock .if it is the root_node, which 
> was not there earlier, and unlock was happening without any lock on root.
> 
> Reviewed-by: Mukesh Ojha <mojha@codeaurora.org>
> 
> Cheers,
> -Mukesh
> 
>>           raw_spin_unlock_irqrestore_rcu_node(rnp, flags);
>>           return;
>>       }

-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a
member of the Code Aurora Forum, hosted by The Linux Foundation

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

* Re: [PATCH] rcu: tree_stall: Correctly unlock root node in rcu_check_gp_start_stall
  2019-03-29 14:22   ` Neeraj Upadhyay
@ 2019-03-29 21:27     ` Paul E. McKenney
  2019-03-30  3:44       ` Neeraj Upadhyay
  0 siblings, 1 reply; 6+ messages in thread
From: Paul E. McKenney @ 2019-03-29 21:27 UTC (permalink / raw)
  To: Neeraj Upadhyay
  Cc: Mukesh Ojha, josh, rostedt, mathieu.desnoyers, jiangshanlai,
	joel, rcu, linux-kernel

On Fri, Mar 29, 2019 at 07:52:15PM +0530, Neeraj Upadhyay wrote:
> 
> 
> On 3/29/19 6:58 PM, Mukesh Ojha wrote:
> >
> >On 3/29/2019 4:57 PM, Neeraj Upadhyay wrote:
> >>Only unlock the root node, if current node (rnp) is not
> >>root node.
> >>
> >>Signed-off-by: Neeraj Upadhyay <neeraju@codeaurora.org>
> >
> >
> >
> >>---
> >>  kernel/rcu/tree_stall.h | 4 +++-
> >>  1 file changed, 3 insertions(+), 1 deletion(-)
> >>
> >>diff --git a/kernel/rcu/tree_stall.h b/kernel/rcu/tree_stall.h
> >>index f65a73a..0651833 100644
> >>--- a/kernel/rcu/tree_stall.h
> >>+++ b/kernel/rcu/tree_stall.h
> >
> >
> >why this is showing as under tree_stall.h while it is under
> >"kernel/rcu/tree.c"
> 
> It's moved in https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git/commit/?h=dev&id=10462d6f58fb6dbde7563e9343505d98d5bfba3d
> 
> Please see linux-rcu dev tree for other changes, which moves code to
> this file.
> 
> 
> Thanks
> Neeraj
> 
> >
> >>@@ -630,7 +630,9 @@ static void rcu_check_gp_start_stall(struct
> >>rcu_node *rnp, struct rcu_data *rdp,
> >>          time_before(j, rcu_state.gp_req_activity + gpssdelay) ||
> >>          time_before(j, rcu_state.gp_activity + gpssdelay) ||
> >>          atomic_xchg(&warned, 1)) {
> >>-        raw_spin_unlock_rcu_node(rnp_root); /* irqs remain disabled. */
> >>+        if (rnp_root != rnp)
> >>+            /* irqs remain disabled. */
> >>+            raw_spin_unlock_rcu_node(rnp_root);
> >
> >Looks good as it will balance the lock .if it is the root_node,
> >which was not there earlier, and unlock was happening without any
> >lock on root.
> >
> >Reviewed-by: Mukesh Ojha <mojha@codeaurora.org>

Applied, again thank you both!

In both cases, I updated the commit log, so please check to make sure
that I didn't mess anything up.

							Thanx, Paul

> >Cheers,
> >-Mukesh
> >
> >>          raw_spin_unlock_irqrestore_rcu_node(rnp, flags);
> >>          return;
> >>      }
> 
> -- 
> QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a
> member of the Code Aurora Forum, hosted by The Linux Foundation
> 


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

* Re: [PATCH] rcu: tree_stall: Correctly unlock root node in rcu_check_gp_start_stall
  2019-03-29 21:27     ` Paul E. McKenney
@ 2019-03-30  3:44       ` Neeraj Upadhyay
  2019-04-04 21:07         ` Paul E. McKenney
  0 siblings, 1 reply; 6+ messages in thread
From: Neeraj Upadhyay @ 2019-03-30  3:44 UTC (permalink / raw)
  To: paulmck
  Cc: Mukesh Ojha, josh, rostedt, mathieu.desnoyers, jiangshanlai,
	joel, rcu, linux-kernel



On 3/30/19 2:57 AM, Paul E. McKenney wrote:
> On Fri, Mar 29, 2019 at 07:52:15PM +0530, Neeraj Upadhyay wrote:
>>
>>
>> On 3/29/19 6:58 PM, Mukesh Ojha wrote:
>>>
>>> On 3/29/2019 4:57 PM, Neeraj Upadhyay wrote:
>>>> Only unlock the root node, if current node (rnp) is not
>>>> root node.
>>>>
>>>> Signed-off-by: Neeraj Upadhyay <neeraju@codeaurora.org>
>>>
>>>
>>>
>>>> ---
>>>>    kernel/rcu/tree_stall.h | 4 +++-
>>>>    1 file changed, 3 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/kernel/rcu/tree_stall.h b/kernel/rcu/tree_stall.h
>>>> index f65a73a..0651833 100644
>>>> --- a/kernel/rcu/tree_stall.h
>>>> +++ b/kernel/rcu/tree_stall.h
>>>
>>>
>>> why this is showing as under tree_stall.h while it is under
>>> "kernel/rcu/tree.c"
>>
>> It's moved in https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git/commit/?h=dev&id=10462d6f58fb6dbde7563e9343505d98d5bfba3d
>>
>> Please see linux-rcu dev tree for other changes, which moves code to
>> this file.
>>
>>
>> Thanks
>> Neeraj
>>
>>>
>>>> @@ -630,7 +630,9 @@ static void rcu_check_gp_start_stall(struct
>>>> rcu_node *rnp, struct rcu_data *rdp,
>>>>            time_before(j, rcu_state.gp_req_activity + gpssdelay) ||
>>>>            time_before(j, rcu_state.gp_activity + gpssdelay) ||
>>>>            atomic_xchg(&warned, 1)) {
>>>> -        raw_spin_unlock_rcu_node(rnp_root); /* irqs remain disabled. */
>>>> +        if (rnp_root != rnp)
>>>> +            /* irqs remain disabled. */
>>>> +            raw_spin_unlock_rcu_node(rnp_root);
>>>
>>> Looks good as it will balance the lock .if it is the root_node,
>>> which was not there earlier, and unlock was happening without any
>>> lock on root.
>>>
>>> Reviewed-by: Mukesh Ojha <mojha@codeaurora.org>
> 
> Applied, again thank you both!
> 
> In both cases, I updated the commit log, so please check to make sure
> that I didn't mess anything up.
> 
> 							Thanx, Paul
> 

Thanks Paul. One minor comment on 
https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git/commit/?h=dev&id=ec6530e763046b6bb1f4c2c2aed49ebc68aae2a0 


"it clearly does not make sense to release
both rnp->lock and rnp->lock"

should be rnp->lock and rnp_root->lock



Thanks
Neeraj

>>> Cheers,
>>> -Mukesh
>>>
>>>>            raw_spin_unlock_irqrestore_rcu_node(rnp, flags);
>>>>            return;
>>>>        }
>>
>> -- 
>> QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a
>> member of the Code Aurora Forum, hosted by The Linux Foundation
>>
> 

-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a
member of the Code Aurora Forum, hosted by The Linux Foundation

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

* Re: [PATCH] rcu: tree_stall: Correctly unlock root node in rcu_check_gp_start_stall
  2019-03-30  3:44       ` Neeraj Upadhyay
@ 2019-04-04 21:07         ` Paul E. McKenney
  0 siblings, 0 replies; 6+ messages in thread
From: Paul E. McKenney @ 2019-04-04 21:07 UTC (permalink / raw)
  To: Neeraj Upadhyay
  Cc: Mukesh Ojha, josh, rostedt, mathieu.desnoyers, jiangshanlai,
	joel, rcu, linux-kernel

On Sat, Mar 30, 2019 at 09:14:36AM +0530, Neeraj Upadhyay wrote:
> On 3/30/19 2:57 AM, Paul E. McKenney wrote:
> >On Fri, Mar 29, 2019 at 07:52:15PM +0530, Neeraj Upadhyay wrote:
> >>
> >>
> >>On 3/29/19 6:58 PM, Mukesh Ojha wrote:
> >>>
> >>>On 3/29/2019 4:57 PM, Neeraj Upadhyay wrote:
> >>>>Only unlock the root node, if current node (rnp) is not
> >>>>root node.
> >>>>
> >>>>Signed-off-by: Neeraj Upadhyay <neeraju@codeaurora.org>
> >>>
> >>>
> >>>
> >>>>---
> >>>>   kernel/rcu/tree_stall.h | 4 +++-
> >>>>   1 file changed, 3 insertions(+), 1 deletion(-)
> >>>>
> >>>>diff --git a/kernel/rcu/tree_stall.h b/kernel/rcu/tree_stall.h
> >>>>index f65a73a..0651833 100644
> >>>>--- a/kernel/rcu/tree_stall.h
> >>>>+++ b/kernel/rcu/tree_stall.h
> >>>
> >>>
> >>>why this is showing as under tree_stall.h while it is under
> >>>"kernel/rcu/tree.c"
> >>
> >>It's moved in https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git/commit/?h=dev&id=10462d6f58fb6dbde7563e9343505d98d5bfba3d
> >>
> >>Please see linux-rcu dev tree for other changes, which moves code to
> >>this file.
> >>
> >>
> >>Thanks
> >>Neeraj
> >>
> >>>
> >>>>@@ -630,7 +630,9 @@ static void rcu_check_gp_start_stall(struct
> >>>>rcu_node *rnp, struct rcu_data *rdp,
> >>>>           time_before(j, rcu_state.gp_req_activity + gpssdelay) ||
> >>>>           time_before(j, rcu_state.gp_activity + gpssdelay) ||
> >>>>           atomic_xchg(&warned, 1)) {
> >>>>-        raw_spin_unlock_rcu_node(rnp_root); /* irqs remain disabled. */
> >>>>+        if (rnp_root != rnp)
> >>>>+            /* irqs remain disabled. */
> >>>>+            raw_spin_unlock_rcu_node(rnp_root);
> >>>
> >>>Looks good as it will balance the lock .if it is the root_node,
> >>>which was not there earlier, and unlock was happening without any
> >>>lock on root.
> >>>
> >>>Reviewed-by: Mukesh Ojha <mojha@codeaurora.org>
> >
> >Applied, again thank you both!
> >
> >In both cases, I updated the commit log, so please check to make sure
> >that I didn't mess anything up.
> >
> >							Thanx, Paul
> >
> 
> Thanks Paul. One minor comment on https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git/commit/?h=dev&id=ec6530e763046b6bb1f4c2c2aed49ebc68aae2a0
> 
> 
> "it clearly does not make sense to release
> both rnp->lock and rnp->lock"
> 
> should be rnp->lock and rnp_root->lock

Good eyes, fixed, thank you!

							Thanx, Paul

> Thanks
> Neeraj
> 
> >>>Cheers,
> >>>-Mukesh
> >>>
> >>>>           raw_spin_unlock_irqrestore_rcu_node(rnp, flags);
> >>>>           return;
> >>>>       }
> >>
> >>-- 
> >>QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a
> >>member of the Code Aurora Forum, hosted by The Linux Foundation
> >>
> >
> 
> -- 
> QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a
> member of the Code Aurora Forum, hosted by The Linux Foundation
> 


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

end of thread, other threads:[~2019-04-04 21:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-29 11:27 [PATCH] rcu: tree_stall: Correctly unlock root node in rcu_check_gp_start_stall Neeraj Upadhyay
2019-03-29 13:28 ` Mukesh Ojha
2019-03-29 14:22   ` Neeraj Upadhyay
2019-03-29 21:27     ` Paul E. McKenney
2019-03-30  3:44       ` Neeraj Upadhyay
2019-04-04 21:07         ` 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).