linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rcu: Use the proper lockdep annotation in dump_blkd_tasks()
@ 2018-03-09  1:32 Boqun Feng
  2018-03-12  1:47 ` Paul E. McKenney
  0 siblings, 1 reply; 2+ messages in thread
From: Boqun Feng @ 2018-03-09  1:32 UTC (permalink / raw)
  To: linux-kernel
  Cc: Boqun Feng, Paul E. McKenney, Josh Triplett, Steven Rostedt,
	Mathieu Desnoyers, Lai Jiangshan

Sparse reported this:

| kernel/rcu/tree_plugin.h:814:9: warning: incorrect type in argument 1 (different modifiers)
| kernel/rcu/tree_plugin.h:814:9:    expected struct lockdep_map const *lock
| kernel/rcu/tree_plugin.h:814:9:    got struct lockdep_map [noderef] *<noident>

This is caused by using vanilla lockdep annotations on rcu_node::lock,
and that requires accessing ->lock of rcu_node directly. However we need
to keep rcu_node::lock __private to avoid breaking its extra ordering
guarantee. And we have a dedicated lockdep annotation for
rcu_node::lock, so use it.

Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
---
 kernel/rcu/tree_plugin.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h
index 9accacffd138..ea33f57abae5 100644
--- a/kernel/rcu/tree_plugin.h
+++ b/kernel/rcu/tree_plugin.h
@@ -811,7 +811,7 @@ static void dump_blkd_tasks(struct rcu_node *rnp, int ncheck)
 	int i;
 	struct list_head *lhp;
 
-	lockdep_assert_held(&rnp->lock);
+	raw_lockdep_assert_held_rcu_node(rnp);
 	pr_info("%s: grp: %d-%d level: %d ->qamask %#lx ->gp_tasks %p ->boost_tasks %p ->exp_tasks %p &->blkd_tasks: %p offset: %u\n", __func__, rnp->grplo, rnp->grphi, rnp->level, rnp->qsmask, rnp->gp_tasks, rnp->boost_tasks, rnp->exp_tasks, &rnp->blkd_tasks, (unsigned int)offsetof(typeof(*rnp), blkd_tasks));
 	pr_cont("\t->blkd_tasks");
 	i = 0;
-- 
2.16.2

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

* Re: [PATCH] rcu: Use the proper lockdep annotation in dump_blkd_tasks()
  2018-03-09  1:32 [PATCH] rcu: Use the proper lockdep annotation in dump_blkd_tasks() Boqun Feng
@ 2018-03-12  1:47 ` Paul E. McKenney
  0 siblings, 0 replies; 2+ messages in thread
From: Paul E. McKenney @ 2018-03-12  1:47 UTC (permalink / raw)
  To: Boqun Feng
  Cc: linux-kernel, Josh Triplett, Steven Rostedt, Mathieu Desnoyers,
	Lai Jiangshan

On Fri, Mar 09, 2018 at 09:32:18AM +0800, Boqun Feng wrote:
> Sparse reported this:
> 
> | kernel/rcu/tree_plugin.h:814:9: warning: incorrect type in argument 1 (different modifiers)
> | kernel/rcu/tree_plugin.h:814:9:    expected struct lockdep_map const *lock
> | kernel/rcu/tree_plugin.h:814:9:    got struct lockdep_map [noderef] *<noident>
> 
> This is caused by using vanilla lockdep annotations on rcu_node::lock,
> and that requires accessing ->lock of rcu_node directly. However we need
> to keep rcu_node::lock __private to avoid breaking its extra ordering
> guarantee. And we have a dedicated lockdep annotation for
> rcu_node::lock, so use it.
> 
> Signed-off-by: Boqun Feng <boqun.feng@gmail.com>

Good eyes!  Queued both this and v3 for testing and further review.

							Thanx, Paul

> ---
>  kernel/rcu/tree_plugin.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h
> index 9accacffd138..ea33f57abae5 100644
> --- a/kernel/rcu/tree_plugin.h
> +++ b/kernel/rcu/tree_plugin.h
> @@ -811,7 +811,7 @@ static void dump_blkd_tasks(struct rcu_node *rnp, int ncheck)
>  	int i;
>  	struct list_head *lhp;
> 
> -	lockdep_assert_held(&rnp->lock);
> +	raw_lockdep_assert_held_rcu_node(rnp);
>  	pr_info("%s: grp: %d-%d level: %d ->qamask %#lx ->gp_tasks %p ->boost_tasks %p ->exp_tasks %p &->blkd_tasks: %p offset: %u\n", __func__, rnp->grplo, rnp->grphi, rnp->level, rnp->qsmask, rnp->gp_tasks, rnp->boost_tasks, rnp->exp_tasks, &rnp->blkd_tasks, (unsigned int)offsetof(typeof(*rnp), blkd_tasks));
>  	pr_cont("\t->blkd_tasks");
>  	i = 0;
> -- 
> 2.16.2
> 

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

end of thread, other threads:[~2018-03-12  1:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-09  1:32 [PATCH] rcu: Use the proper lockdep annotation in dump_blkd_tasks() Boqun Feng
2018-03-12  1:47 ` 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).