linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] locking/lockdep: unlikely bfs error check
@ 2021-06-16 14:42 Xiongwei Song
  2021-06-16 14:42 ` [PATCH] locking/lockdep: print possible warning after counting deps Xiongwei Song
  2021-06-16 14:48 ` [PATCH] locking/lockdep: unlikely bfs error check Waiman Long
  0 siblings, 2 replies; 7+ messages in thread
From: Xiongwei Song @ 2021-06-16 14:42 UTC (permalink / raw)
  To: peterz, mingo, will, longman, boqun.feng; +Cc: linux-kernel, Xiongwei Song

From: Xiongwei Song <sxwjean@gmail.com>

The error from graph walk is small probability event, so unlikely
bfs_error can improve performance a little bit.

Signed-off-by: Xiongwei Song <sxwjean@gmail.com>
---
 kernel/locking/lockdep.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
index 074fd6418c20..af8c9203cd3e 100644
--- a/kernel/locking/lockdep.c
+++ b/kernel/locking/lockdep.c
@@ -2646,7 +2646,7 @@ static int check_irq_usage(struct task_struct *curr, struct held_lock *prev,
 	bfs_init_rootb(&this, prev);
 
 	ret = __bfs_backwards(&this, &usage_mask, usage_accumulate, usage_skip, NULL);
-	if (bfs_error(ret)) {
+	if (unlikely(bfs_error(ret))) {
 		print_bfs_bug(ret);
 		return 0;
 	}
@@ -2664,7 +2664,7 @@ static int check_irq_usage(struct task_struct *curr, struct held_lock *prev,
 	bfs_init_root(&that, next);
 
 	ret = find_usage_forwards(&that, forward_mask, &target_entry1);
-	if (bfs_error(ret)) {
+	if (unlikely(bfs_error(ret))) {
 		print_bfs_bug(ret);
 		return 0;
 	}
@@ -2679,7 +2679,7 @@ static int check_irq_usage(struct task_struct *curr, struct held_lock *prev,
 	backward_mask = original_mask(target_entry1->class->usage_mask);
 
 	ret = find_usage_backwards(&this, backward_mask, &target_entry);
-	if (bfs_error(ret)) {
+	if (unlikely(bfs_error(ret))) {
 		print_bfs_bug(ret);
 		return 0;
 	}
@@ -2998,7 +2998,7 @@ check_prev_add(struct task_struct *curr, struct held_lock *prev,
 	 * Is the <prev> -> <next> link redundant?
 	 */
 	ret = check_redundant(prev, next);
-	if (bfs_error(ret))
+	if (unlikely(bfs_error(ret)))
 		return 0;
 	else if (ret == BFS_RMATCH)
 		return 2;
@@ -3911,7 +3911,7 @@ check_usage_forwards(struct task_struct *curr, struct held_lock *this,
 
 	bfs_init_root(&root, this);
 	ret = find_usage_forwards(&root, usage_mask, &target_entry);
-	if (bfs_error(ret)) {
+	if (unlikely(bfs_error(ret))) {
 		print_bfs_bug(ret);
 		return 0;
 	}
@@ -3946,7 +3946,7 @@ check_usage_backwards(struct task_struct *curr, struct held_lock *this,
 
 	bfs_init_rootb(&root, this);
 	ret = find_usage_backwards(&root, usage_mask, &target_entry);
-	if (bfs_error(ret)) {
+	if (unlikely(bfs_error(ret))) {
 		print_bfs_bug(ret);
 		return 0;
 	}
-- 
2.30.2


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

* [PATCH] locking/lockdep: print possible warning after counting deps
  2021-06-16 14:42 [PATCH] locking/lockdep: unlikely bfs error check Xiongwei Song
@ 2021-06-16 14:42 ` Xiongwei Song
  2021-06-17  2:22   ` Xiongwei Song
  2021-06-16 14:48 ` [PATCH] locking/lockdep: unlikely bfs error check Waiman Long
  1 sibling, 1 reply; 7+ messages in thread
From: Xiongwei Song @ 2021-06-16 14:42 UTC (permalink / raw)
  To: peterz, mingo, will, longman, boqun.feng; +Cc: linux-kernel, Xiongwei Song

From: Xiongwei Song <sxwjean@gmail.com>

The graph walk might hit error when counting dependencies. Once the
return value is negative, print a warning to reminder users.

Signed-off-by: Xiongwei Song <sxwjean@gmail.com>
---
 kernel/locking/lockdep.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
index 7641bd407239..074fd6418c20 100644
--- a/kernel/locking/lockdep.c
+++ b/kernel/locking/lockdep.c
@@ -2028,8 +2028,12 @@ static unsigned long __lockdep_count_forward_deps(struct lock_list *this)
 {
 	unsigned long  count = 0;
 	struct lock_list *target_entry;
+	enum bfs_result ret;
+
+	ret = __bfs_forwards(this, (void *)&count, noop_count, NULL, &target_entry);
 
-	__bfs_forwards(this, (void *)&count, noop_count, NULL, &target_entry);
+	if (unlikely(bfs_error(ret)))
+		print_bfs_bug(ret);
 
 	return count;
 }
@@ -2053,8 +2057,12 @@ static unsigned long __lockdep_count_backward_deps(struct lock_list *this)
 {
 	unsigned long  count = 0;
 	struct lock_list *target_entry;
+	enum bfs_result ret;
+
+	ret = __bfs_backwards(this, (void *)&count, noop_count, NULL, &target_entry);
 
-	__bfs_backwards(this, (void *)&count, noop_count, NULL, &target_entry);
+	if (unlikely(bfs_error(ret)))
+		print_bfs_bug(ret);
 
 	return count;
 }
-- 
2.30.2


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

* Re: [PATCH] locking/lockdep: unlikely bfs error check
  2021-06-16 14:42 [PATCH] locking/lockdep: unlikely bfs error check Xiongwei Song
  2021-06-16 14:42 ` [PATCH] locking/lockdep: print possible warning after counting deps Xiongwei Song
@ 2021-06-16 14:48 ` Waiman Long
  2021-06-16 14:59   ` Xiongwei Song
  1 sibling, 1 reply; 7+ messages in thread
From: Waiman Long @ 2021-06-16 14:48 UTC (permalink / raw)
  To: Xiongwei Song, peterz, mingo, will, boqun.feng
  Cc: linux-kernel, Xiongwei Song

On 6/16/21 10:42 AM, Xiongwei Song wrote:
> From: Xiongwei Song <sxwjean@gmail.com>
>
> The error from graph walk is small probability event, so unlikely
> bfs_error can improve performance a little bit.
>
> Signed-off-by: Xiongwei Song <sxwjean@gmail.com>
> ---
>   kernel/locking/lockdep.c | 12 ++++++------
>   1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
> index 074fd6418c20..af8c9203cd3e 100644
> --- a/kernel/locking/lockdep.c
> +++ b/kernel/locking/lockdep.c
> @@ -2646,7 +2646,7 @@ static int check_irq_usage(struct task_struct *curr, struct held_lock *prev,
>   	bfs_init_rootb(&this, prev);
>   
>   	ret = __bfs_backwards(&this, &usage_mask, usage_accumulate, usage_skip, NULL);
> -	if (bfs_error(ret)) {
> +	if (unlikely(bfs_error(ret))) {
>   		print_bfs_bug(ret);
>   		return 0;
>   	}
> @@ -2664,7 +2664,7 @@ static int check_irq_usage(struct task_struct *curr, struct held_lock *prev,
>   	bfs_init_root(&that, next);
>   
>   	ret = find_usage_forwards(&that, forward_mask, &target_entry1);
> -	if (bfs_error(ret)) {
> +	if (unlikely(bfs_error(ret))) {
>   		print_bfs_bug(ret);
>   		return 0;
>   	}
> @@ -2679,7 +2679,7 @@ static int check_irq_usage(struct task_struct *curr, struct held_lock *prev,
>   	backward_mask = original_mask(target_entry1->class->usage_mask);
>   
>   	ret = find_usage_backwards(&this, backward_mask, &target_entry);
> -	if (bfs_error(ret)) {
> +	if (unlikely(bfs_error(ret))) {
>   		print_bfs_bug(ret);
>   		return 0;
>   	}
> @@ -2998,7 +2998,7 @@ check_prev_add(struct task_struct *curr, struct held_lock *prev,
>   	 * Is the <prev> -> <next> link redundant?
>   	 */
>   	ret = check_redundant(prev, next);
> -	if (bfs_error(ret))
> +	if (unlikely(bfs_error(ret)))
>   		return 0;
>   	else if (ret == BFS_RMATCH)
>   		return 2;
> @@ -3911,7 +3911,7 @@ check_usage_forwards(struct task_struct *curr, struct held_lock *this,
>   
>   	bfs_init_root(&root, this);
>   	ret = find_usage_forwards(&root, usage_mask, &target_entry);
> -	if (bfs_error(ret)) {
> +	if (unlikely(bfs_error(ret))) {
>   		print_bfs_bug(ret);
>   		return 0;
>   	}
> @@ -3946,7 +3946,7 @@ check_usage_backwards(struct task_struct *curr, struct held_lock *this,
>   
>   	bfs_init_rootb(&root, this);
>   	ret = find_usage_backwards(&root, usage_mask, &target_entry);
> -	if (bfs_error(ret)) {
> +	if (unlikely(bfs_error(ret))) {
>   		print_bfs_bug(ret);
>   		return 0;
>   	}

I think it is better to put the unlikely() directly into the bfs_error() 
inline function instead of sprinkling it all over the place.

Cheers,
Longman


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

* Re: [PATCH] locking/lockdep: unlikely bfs error check
  2021-06-16 14:48 ` [PATCH] locking/lockdep: unlikely bfs error check Waiman Long
@ 2021-06-16 14:59   ` Xiongwei Song
  2021-06-16 15:11     ` Waiman Long
  0 siblings, 1 reply; 7+ messages in thread
From: Xiongwei Song @ 2021-06-16 14:59 UTC (permalink / raw)
  To: Waiman Long; +Cc: peterz, mingo, will, boqun.feng, linux-kernel, Xiongwei Song



> On Jun 16, 2021, at 10:48 PM, Waiman Long <llong@redhat.com> wrote:
> 
> On 6/16/21 10:42 AM, Xiongwei Song wrote:
>> From: Xiongwei Song <sxwjean@gmail.com>
>> 
>> The error from graph walk is small probability event, so unlikely
>> bfs_error can improve performance a little bit.
>> 
>> Signed-off-by: Xiongwei Song <sxwjean@gmail.com>
>> ---
>>  kernel/locking/lockdep.c | 12 ++++++------
>>  1 file changed, 6 insertions(+), 6 deletions(-)
>> 
>> diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
>> index 074fd6418c20..af8c9203cd3e 100644
>> --- a/kernel/locking/lockdep.c
>> +++ b/kernel/locking/lockdep.c
>> @@ -2646,7 +2646,7 @@ static int check_irq_usage(struct task_struct *curr, struct held_lock *prev,
>>  	bfs_init_rootb(&this, prev);
>>    	ret = __bfs_backwards(&this, &usage_mask, usage_accumulate, usage_skip, NULL);
>> -	if (bfs_error(ret)) {
>> +	if (unlikely(bfs_error(ret))) {
>>  		print_bfs_bug(ret);
>>  		return 0;
>>  	}
>> @@ -2664,7 +2664,7 @@ static int check_irq_usage(struct task_struct *curr, struct held_lock *prev,
>>  	bfs_init_root(&that, next);
>>    	ret = find_usage_forwards(&that, forward_mask, &target_entry1);
>> -	if (bfs_error(ret)) {
>> +	if (unlikely(bfs_error(ret))) {
>>  		print_bfs_bug(ret);
>>  		return 0;
>>  	}
>> @@ -2679,7 +2679,7 @@ static int check_irq_usage(struct task_struct *curr, struct held_lock *prev,
>>  	backward_mask = original_mask(target_entry1->class->usage_mask);
>>    	ret = find_usage_backwards(&this, backward_mask, &target_entry);
>> -	if (bfs_error(ret)) {
>> +	if (unlikely(bfs_error(ret))) {
>>  		print_bfs_bug(ret);
>>  		return 0;
>>  	}
>> @@ -2998,7 +2998,7 @@ check_prev_add(struct task_struct *curr, struct held_lock *prev,
>>  	 * Is the <prev> -> <next> link redundant?
>>  	 */
>>  	ret = check_redundant(prev, next);
>> -	if (bfs_error(ret))
>> +	if (unlikely(bfs_error(ret)))
>>  		return 0;
>>  	else if (ret == BFS_RMATCH)
>>  		return 2;
>> @@ -3911,7 +3911,7 @@ check_usage_forwards(struct task_struct *curr, struct held_lock *this,
>>    	bfs_init_root(&root, this);
>>  	ret = find_usage_forwards(&root, usage_mask, &target_entry);
>> -	if (bfs_error(ret)) {
>> +	if (unlikely(bfs_error(ret))) {
>>  		print_bfs_bug(ret);
>>  		return 0;
>>  	}
>> @@ -3946,7 +3946,7 @@ check_usage_backwards(struct task_struct *curr, struct held_lock *this,
>>    	bfs_init_rootb(&root, this);
>>  	ret = find_usage_backwards(&root, usage_mask, &target_entry);
>> -	if (bfs_error(ret)) {
>> +	if (unlikely(bfs_error(ret))) {
>>  		print_bfs_bug(ret);
>>  		return 0;
>>  	}
> 
> I think it is better to put the unlikely() directly into the bfs_error() inline function instead of sprinkling it all over the place.

Sounds good. Thank you for the suggestion. I will update the patch.

Regards,
Xiongwei

> 
> Cheers,
> Longman
> 


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

* Re: [PATCH] locking/lockdep: unlikely bfs error check
  2021-06-16 14:59   ` Xiongwei Song
@ 2021-06-16 15:11     ` Waiman Long
  2021-06-17  2:14       ` Xiongwei Song
  0 siblings, 1 reply; 7+ messages in thread
From: Waiman Long @ 2021-06-16 15:11 UTC (permalink / raw)
  To: Xiongwei Song, Waiman Long
  Cc: peterz, mingo, will, boqun.feng, linux-kernel, Xiongwei Song

On 6/16/21 10:59 AM, Xiongwei Song wrote:
>
>> On Jun 16, 2021, at 10:48 PM, Waiman Long <llong@redhat.com> wrote:
>>
>> On 6/16/21 10:42 AM, Xiongwei Song wrote:
>>> From: Xiongwei Song <sxwjean@gmail.com>
>>>
>>> The error from graph walk is small probability event, so unlikely
>>> bfs_error can improve performance a little bit.
>>>
>>> Signed-off-by: Xiongwei Song <sxwjean@gmail.com>
>>> ---
>>>   kernel/locking/lockdep.c | 12 ++++++------
>>>   1 file changed, 6 insertions(+), 6 deletions(-)
>>>
>>> diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
>>> index 074fd6418c20..af8c9203cd3e 100644
>>> --- a/kernel/locking/lockdep.c
>>> +++ b/kernel/locking/lockdep.c
>>> @@ -2646,7 +2646,7 @@ static int check_irq_usage(struct task_struct *curr, struct held_lock *prev,
>>>   	bfs_init_rootb(&this, prev);
>>>     	ret = __bfs_backwards(&this, &usage_mask, usage_accumulate, usage_skip, NULL);
>>> -	if (bfs_error(ret)) {
>>> +	if (unlikely(bfs_error(ret))) {
>>>   		print_bfs_bug(ret);
>>>   		return 0;
>>>   	}
>>> @@ -2664,7 +2664,7 @@ static int check_irq_usage(struct task_struct *curr, struct held_lock *prev,
>>>   	bfs_init_root(&that, next);
>>>     	ret = find_usage_forwards(&that, forward_mask, &target_entry1);
>>> -	if (bfs_error(ret)) {
>>> +	if (unlikely(bfs_error(ret))) {
>>>   		print_bfs_bug(ret);
>>>   		return 0;
>>>   	}
>>> @@ -2679,7 +2679,7 @@ static int check_irq_usage(struct task_struct *curr, struct held_lock *prev,
>>>   	backward_mask = original_mask(target_entry1->class->usage_mask);
>>>     	ret = find_usage_backwards(&this, backward_mask, &target_entry);
>>> -	if (bfs_error(ret)) {
>>> +	if (unlikely(bfs_error(ret))) {
>>>   		print_bfs_bug(ret);
>>>   		return 0;
>>>   	}
>>> @@ -2998,7 +2998,7 @@ check_prev_add(struct task_struct *curr, struct held_lock *prev,
>>>   	 * Is the <prev> -> <next> link redundant?
>>>   	 */
>>>   	ret = check_redundant(prev, next);
>>> -	if (bfs_error(ret))
>>> +	if (unlikely(bfs_error(ret)))
>>>   		return 0;
>>>   	else if (ret == BFS_RMATCH)
>>>   		return 2;
>>> @@ -3911,7 +3911,7 @@ check_usage_forwards(struct task_struct *curr, struct held_lock *this,
>>>     	bfs_init_root(&root, this);
>>>   	ret = find_usage_forwards(&root, usage_mask, &target_entry);
>>> -	if (bfs_error(ret)) {
>>> +	if (unlikely(bfs_error(ret))) {
>>>   		print_bfs_bug(ret);
>>>   		return 0;
>>>   	}
>>> @@ -3946,7 +3946,7 @@ check_usage_backwards(struct task_struct *curr, struct held_lock *this,
>>>     	bfs_init_rootb(&root, this);
>>>   	ret = find_usage_backwards(&root, usage_mask, &target_entry);
>>> -	if (bfs_error(ret)) {
>>> +	if (unlikely(bfs_error(ret))) {
>>>   		print_bfs_bug(ret);
>>>   		return 0;
>>>   	}
>> I think it is better to put the unlikely() directly into the bfs_error() inline function instead of sprinkling it all over the place.
> Sounds good. Thank you for the suggestion. I will update the patch.

Another nit. It is a bit odd that sent out two patches separately though 
they do seem to have a bit of dependency. I think you should post them 
as a 2-patch series.

Cheers,
Longman


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

* Re: [PATCH] locking/lockdep: unlikely bfs error check
  2021-06-16 15:11     ` Waiman Long
@ 2021-06-17  2:14       ` Xiongwei Song
  0 siblings, 0 replies; 7+ messages in thread
From: Xiongwei Song @ 2021-06-17  2:14 UTC (permalink / raw)
  To: Waiman Long
  Cc: Xiongwei Song, peterz, mingo, will, Boqun Feng,
	Linux Kernel Mailing List

On Wed, Jun 16, 2021 at 11:11 PM Waiman Long <llong@redhat.com> wrote:
>
> On 6/16/21 10:59 AM, Xiongwei Song wrote:
> >
> >> On Jun 16, 2021, at 10:48 PM, Waiman Long <llong@redhat.com> wrote:
> >>
> >> On 6/16/21 10:42 AM, Xiongwei Song wrote:
> >>> From: Xiongwei Song <sxwjean@gmail.com>
> >>>
> >>> The error from graph walk is small probability event, so unlikely
> >>> bfs_error can improve performance a little bit.
> >>>
> >>> Signed-off-by: Xiongwei Song <sxwjean@gmail.com>
> >>> ---
> >>>   kernel/locking/lockdep.c | 12 ++++++------
> >>>   1 file changed, 6 insertions(+), 6 deletions(-)
> >>>
> >>> diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
> >>> index 074fd6418c20..af8c9203cd3e 100644
> >>> --- a/kernel/locking/lockdep.c
> >>> +++ b/kernel/locking/lockdep.c
> >>> @@ -2646,7 +2646,7 @@ static int check_irq_usage(struct task_struct *curr, struct held_lock *prev,
> >>>     bfs_init_rootb(&this, prev);
> >>>             ret = __bfs_backwards(&this, &usage_mask, usage_accumulate, usage_skip, NULL);
> >>> -   if (bfs_error(ret)) {
> >>> +   if (unlikely(bfs_error(ret))) {
> >>>             print_bfs_bug(ret);
> >>>             return 0;
> >>>     }
> >>> @@ -2664,7 +2664,7 @@ static int check_irq_usage(struct task_struct *curr, struct held_lock *prev,
> >>>     bfs_init_root(&that, next);
> >>>             ret = find_usage_forwards(&that, forward_mask, &target_entry1);
> >>> -   if (bfs_error(ret)) {
> >>> +   if (unlikely(bfs_error(ret))) {
> >>>             print_bfs_bug(ret);
> >>>             return 0;
> >>>     }
> >>> @@ -2679,7 +2679,7 @@ static int check_irq_usage(struct task_struct *curr, struct held_lock *prev,
> >>>     backward_mask = original_mask(target_entry1->class->usage_mask);
> >>>             ret = find_usage_backwards(&this, backward_mask, &target_entry);
> >>> -   if (bfs_error(ret)) {
> >>> +   if (unlikely(bfs_error(ret))) {
> >>>             print_bfs_bug(ret);
> >>>             return 0;
> >>>     }
> >>> @@ -2998,7 +2998,7 @@ check_prev_add(struct task_struct *curr, struct held_lock *prev,
> >>>      * Is the <prev> -> <next> link redundant?
> >>>      */
> >>>     ret = check_redundant(prev, next);
> >>> -   if (bfs_error(ret))
> >>> +   if (unlikely(bfs_error(ret)))
> >>>             return 0;
> >>>     else if (ret == BFS_RMATCH)
> >>>             return 2;
> >>> @@ -3911,7 +3911,7 @@ check_usage_forwards(struct task_struct *curr, struct held_lock *this,
> >>>             bfs_init_root(&root, this);
> >>>     ret = find_usage_forwards(&root, usage_mask, &target_entry);
> >>> -   if (bfs_error(ret)) {
> >>> +   if (unlikely(bfs_error(ret))) {
> >>>             print_bfs_bug(ret);
> >>>             return 0;
> >>>     }
> >>> @@ -3946,7 +3946,7 @@ check_usage_backwards(struct task_struct *curr, struct held_lock *this,
> >>>             bfs_init_rootb(&root, this);
> >>>     ret = find_usage_backwards(&root, usage_mask, &target_entry);
> >>> -   if (bfs_error(ret)) {
> >>> +   if (unlikely(bfs_error(ret))) {
> >>>             print_bfs_bug(ret);
> >>>             return 0;
> >>>     }
> >> I think it is better to put the unlikely() directly into the bfs_error() inline function instead of sprinkling it all over the place.
> > Sounds good. Thank you for the suggestion. I will update the patch.
>
> Another nit. It is a bit odd that sent out two patches separately though
> they do seem to have a bit of dependency. I think you should post them
> as a 2-patch series.

Ok. Let me do it. Thank you again.

Regards,
Xiongwei

> Cheers,
> Longman
>

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

* Re: [PATCH] locking/lockdep: print possible warning after counting deps
  2021-06-16 14:42 ` [PATCH] locking/lockdep: print possible warning after counting deps Xiongwei Song
@ 2021-06-17  2:22   ` Xiongwei Song
  0 siblings, 0 replies; 7+ messages in thread
From: Xiongwei Song @ 2021-06-17  2:22 UTC (permalink / raw)
  To: Xiongwei Song
  Cc: peterz, mingo, will, longman, Boqun Feng, Linux Kernel Mailing List

Please ignore this patch. I will resend as  Longman's suggestions.
Please see https://lkml.org/lkml/2021/6/16/949.

Regards,
Xiongwei


On Wed, Jun 16, 2021 at 10:42 PM Xiongwei Song <sxwjean@me.com> wrote:
>
> From: Xiongwei Song <sxwjean@gmail.com>
>
> The graph walk might hit error when counting dependencies. Once the
> return value is negative, print a warning to reminder users.
>
> Signed-off-by: Xiongwei Song <sxwjean@gmail.com>
> ---
>  kernel/locking/lockdep.c | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
> index 7641bd407239..074fd6418c20 100644
> --- a/kernel/locking/lockdep.c
> +++ b/kernel/locking/lockdep.c
> @@ -2028,8 +2028,12 @@ static unsigned long __lockdep_count_forward_deps(struct lock_list *this)
>  {
>         unsigned long  count = 0;
>         struct lock_list *target_entry;
> +       enum bfs_result ret;
> +
> +       ret = __bfs_forwards(this, (void *)&count, noop_count, NULL, &target_entry);
>
> -       __bfs_forwards(this, (void *)&count, noop_count, NULL, &target_entry);
> +       if (unlikely(bfs_error(ret)))
> +               print_bfs_bug(ret);
>
>         return count;
>  }
> @@ -2053,8 +2057,12 @@ static unsigned long __lockdep_count_backward_deps(struct lock_list *this)
>  {
>         unsigned long  count = 0;
>         struct lock_list *target_entry;
> +       enum bfs_result ret;
> +
> +       ret = __bfs_backwards(this, (void *)&count, noop_count, NULL, &target_entry);
>
> -       __bfs_backwards(this, (void *)&count, noop_count, NULL, &target_entry);
> +       if (unlikely(bfs_error(ret)))
> +               print_bfs_bug(ret);
>
>         return count;
>  }
> --
> 2.30.2
>

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

end of thread, other threads:[~2021-06-17  2:23 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-16 14:42 [PATCH] locking/lockdep: unlikely bfs error check Xiongwei Song
2021-06-16 14:42 ` [PATCH] locking/lockdep: print possible warning after counting deps Xiongwei Song
2021-06-17  2:22   ` Xiongwei Song
2021-06-16 14:48 ` [PATCH] locking/lockdep: unlikely bfs error check Waiman Long
2021-06-16 14:59   ` Xiongwei Song
2021-06-16 15:11     ` Waiman Long
2021-06-17  2:14       ` Xiongwei Song

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