linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] perf/core: Add SRCU annotation for pmus list walk
@ 2019-11-19 12:14 Sebastian Andrzej Siewior
  2019-11-29 10:31 ` Sebastian Andrzej Siewior
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Sebastian Andrzej Siewior @ 2019-11-19 12:14 UTC (permalink / raw)
  To: linux-kernel, Joel Fernandes, Paul E. McKenney
  Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim,
	Thomas Gleixner

Since commit
   28875945ba98d ("rcu: Add support for consolidated-RCU reader checking")

there is an additional check to ensure that a RCU related lock is held
while the RCU list is iterated.
This section holds the SRCU reader lock instead.

Add annotation to list_for_each_entry_rcu() that pmus_srcu must be
acquired during the list traversal.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---

I see the warning in in v5.4-rc during boot. For some reason I don't see
it in tip/master during boot but "perf stat w" triggers it again (among
other things).

 kernel/events/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/events/core.c b/kernel/events/core.c
index 5224388872069..dbb3b26a55612 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -10497,7 +10497,7 @@ static struct pmu *perf_init_event(struct perf_event *event)
 		goto unlock;
 	}
 
-	list_for_each_entry_rcu(pmu, &pmus, entry) {
+	list_for_each_entry_rcu(pmu, &pmus, entry, lockdep_is_held(&pmus_srcu)) {
 		ret = perf_try_init_event(pmu, event);
 		if (!ret)
 			goto unlock;
-- 
2.24.0


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

* Re: [PATCH] perf/core: Add SRCU annotation for pmus list walk
  2019-11-19 12:14 [PATCH] perf/core: Add SRCU annotation for pmus list walk Sebastian Andrzej Siewior
@ 2019-11-29 10:31 ` Sebastian Andrzej Siewior
  2019-11-29 20:05 ` Joel Fernandes
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Sebastian Andrzej Siewior @ 2019-11-29 10:31 UTC (permalink / raw)
  To: linux-kernel, Joel Fernandes, Paul E. McKenney
  Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim,
	Thomas Gleixner

On 2019-11-19 13:14:29 [+0100], To linux-kernel@vger.kernel.org wrote:
> Since commit
>    28875945ba98d ("rcu: Add support for consolidated-RCU reader checking")
> 
> there is an additional check to ensure that a RCU related lock is held
> while the RCU list is iterated.
> This section holds the SRCU reader lock instead.
> 
> Add annotation to list_for_each_entry_rcu() that pmus_srcu must be
> acquired during the list traversal.
> 
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> ---
> 
> I see the warning in in v5.4-rc during boot. For some reason I don't see
> it in tip/master during boot but "perf stat w" triggers it again (among
> other things).

ping.

>  kernel/events/core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/events/core.c b/kernel/events/core.c
> index 5224388872069..dbb3b26a55612 100644
> --- a/kernel/events/core.c
> +++ b/kernel/events/core.c
> @@ -10497,7 +10497,7 @@ static struct pmu *perf_init_event(struct perf_event *event)
>  		goto unlock;
>  	}
>  
> -	list_for_each_entry_rcu(pmu, &pmus, entry) {
> +	list_for_each_entry_rcu(pmu, &pmus, entry, lockdep_is_held(&pmus_srcu)) {
>  		ret = perf_try_init_event(pmu, event);
>  		if (!ret)
>  			goto unlock;

Sebastian

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

* Re: [PATCH] perf/core: Add SRCU annotation for pmus list walk
  2019-11-19 12:14 [PATCH] perf/core: Add SRCU annotation for pmus list walk Sebastian Andrzej Siewior
  2019-11-29 10:31 ` Sebastian Andrzej Siewior
@ 2019-11-29 20:05 ` Joel Fernandes
  2019-12-17 11:48   ` Sebastian Andrzej Siewior
  2019-12-17 12:21 ` Peter Zijlstra
  2019-12-17 12:39 ` [tip: perf/urgent] " tip-bot2 for Sebastian Andrzej Siewior
  3 siblings, 1 reply; 7+ messages in thread
From: Joel Fernandes @ 2019-11-29 20:05 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior
  Cc: linux-kernel, Paul E. McKenney, Peter Zijlstra, Ingo Molnar,
	Arnaldo Carvalho de Melo, Mark Rutland, Alexander Shishkin,
	Jiri Olsa, Namhyung Kim, Thomas Gleixner

On Tue, Nov 19, 2019 at 01:14:29PM +0100, Sebastian Andrzej Siewior wrote:
> Since commit
>    28875945ba98d ("rcu: Add support for consolidated-RCU reader checking")
> 
> there is an additional check to ensure that a RCU related lock is held
> while the RCU list is iterated.
> This section holds the SRCU reader lock instead.
> 
> Add annotation to list_for_each_entry_rcu() that pmus_srcu must be
> acquired during the list traversal.
> 

Reviewed-by: Joel Fernandes (Google) <joel@joelfernandes.org>

thanks,

 - Joel

> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> ---
> 
> I see the warning in in v5.4-rc during boot. For some reason I don't see
> it in tip/master during boot but "perf stat w" triggers it again (among
> other things).
> 
>  kernel/events/core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/events/core.c b/kernel/events/core.c
> index 5224388872069..dbb3b26a55612 100644
> --- a/kernel/events/core.c
> +++ b/kernel/events/core.c
> @@ -10497,7 +10497,7 @@ static struct pmu *perf_init_event(struct perf_event *event)
>  		goto unlock;
>  	}
>  
> -	list_for_each_entry_rcu(pmu, &pmus, entry) {
> +	list_for_each_entry_rcu(pmu, &pmus, entry, lockdep_is_held(&pmus_srcu)) {
>  		ret = perf_try_init_event(pmu, event);
>  		if (!ret)
>  			goto unlock;
> -- 
> 2.24.0
> 

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

* Re: [PATCH] perf/core: Add SRCU annotation for pmus list walk
  2019-11-29 20:05 ` Joel Fernandes
@ 2019-12-17 11:48   ` Sebastian Andrzej Siewior
  0 siblings, 0 replies; 7+ messages in thread
From: Sebastian Andrzej Siewior @ 2019-12-17 11:48 UTC (permalink / raw)
  To: Joel Fernandes
  Cc: linux-kernel, Paul E. McKenney, Peter Zijlstra, Ingo Molnar,
	Arnaldo Carvalho de Melo, Mark Rutland, Alexander Shishkin,
	Jiri Olsa, Namhyung Kim, Thomas Gleixner

On 2019-11-29 15:05:22 [-0500], Joel Fernandes wrote:
> On Tue, Nov 19, 2019 at 01:14:29PM +0100, Sebastian Andrzej Siewior wrote:
> > Since commit
> >    28875945ba98d ("rcu: Add support for consolidated-RCU reader checking")
> > 
> > there is an additional check to ensure that a RCU related lock is held
> > while the RCU list is iterated.
> > This section holds the SRCU reader lock instead.
> > 
> > Add annotation to list_for_each_entry_rcu() that pmus_srcu must be
> > acquired during the list traversal.
> > 
> 
> Reviewed-by: Joel Fernandes (Google) <joel@joelfernandes.org>
> 
> thanks,
> 
>  - Joel
> 
> > Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> > ---
> > 
> > I see the warning in in v5.4-rc during boot. For some reason I don't see
> > it in tip/master during boot but "perf stat w" triggers it again (among
> > other things).

kind ping

Sebastian

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

* Re: [PATCH] perf/core: Add SRCU annotation for pmus list walk
  2019-11-19 12:14 [PATCH] perf/core: Add SRCU annotation for pmus list walk Sebastian Andrzej Siewior
  2019-11-29 10:31 ` Sebastian Andrzej Siewior
  2019-11-29 20:05 ` Joel Fernandes
@ 2019-12-17 12:21 ` Peter Zijlstra
  2019-12-17 13:03   ` Sebastian Andrzej Siewior
  2019-12-17 12:39 ` [tip: perf/urgent] " tip-bot2 for Sebastian Andrzej Siewior
  3 siblings, 1 reply; 7+ messages in thread
From: Peter Zijlstra @ 2019-12-17 12:21 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior
  Cc: linux-kernel, Joel Fernandes, Paul E. McKenney, Ingo Molnar,
	Arnaldo Carvalho de Melo, Mark Rutland, Alexander Shishkin,
	Jiri Olsa, Namhyung Kim, Thomas Gleixner

On Tue, Nov 19, 2019 at 01:14:29PM +0100, Sebastian Andrzej Siewior wrote:
> Since commit
>    28875945ba98d ("rcu: Add support for consolidated-RCU reader checking")
> 
> there is an additional check to ensure that a RCU related lock is held
> while the RCU list is iterated.
> This section holds the SRCU reader lock instead.
> 
> Add annotation to list_for_each_entry_rcu() that pmus_srcu must be
> acquired during the list traversal.
> 
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> ---
> 
> I see the warning in in v5.4-rc during boot. For some reason I don't see
> it in tip/master during boot but "perf stat w" triggers it again (among
> other things).
> 
>  kernel/events/core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/events/core.c b/kernel/events/core.c
> index 5224388872069..dbb3b26a55612 100644
> --- a/kernel/events/core.c
> +++ b/kernel/events/core.c
> @@ -10497,7 +10497,7 @@ static struct pmu *perf_init_event(struct perf_event *event)
>  		goto unlock;
>  	}
>  
> -	list_for_each_entry_rcu(pmu, &pmus, entry) {
> +	list_for_each_entry_rcu(pmu, &pmus, entry, lockdep_is_held(&pmus_srcu)) {

That's a bit obnoxious, but ok, I suppose.

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

* [tip: perf/urgent] perf/core: Add SRCU annotation for pmus list walk
  2019-11-19 12:14 [PATCH] perf/core: Add SRCU annotation for pmus list walk Sebastian Andrzej Siewior
                   ` (2 preceding siblings ...)
  2019-12-17 12:21 ` Peter Zijlstra
@ 2019-12-17 12:39 ` tip-bot2 for Sebastian Andrzej Siewior
  3 siblings, 0 replies; 7+ messages in thread
From: tip-bot2 for Sebastian Andrzej Siewior @ 2019-12-17 12:39 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Sebastian Andrzej Siewior, Peter Zijlstra (Intel),
	Joel Fernandes (Google),
	x86, LKML

The following commit has been merged into the perf/urgent branch of tip:

Commit-ID:     9f0bff1180efc9ea988fed3fd93da7647151ac8b
Gitweb:        https://git.kernel.org/tip/9f0bff1180efc9ea988fed3fd93da7647151ac8b
Author:        Sebastian Andrzej Siewior <bigeasy@linutronix.de>
AuthorDate:    Tue, 19 Nov 2019 13:14:29 +01:00
Committer:     Peter Zijlstra <peterz@infradead.org>
CommitterDate: Tue, 17 Dec 2019 13:32:46 +01:00

perf/core: Add SRCU annotation for pmus list walk

Since commit
   28875945ba98d ("rcu: Add support for consolidated-RCU reader checking")

there is an additional check to ensure that a RCU related lock is held
while the RCU list is iterated.
This section holds the SRCU reader lock instead.

Add annotation to list_for_each_entry_rcu() that pmus_srcu must be
acquired during the list traversal.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Joel Fernandes (Google) <joel@joelfernandes.org>
Link: https://lkml.kernel.org/r/20191119121429.zhcubzdhm672zasg@linutronix.de
---
 kernel/events/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/events/core.c b/kernel/events/core.c
index 4ff86d5..a1f8bde 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -10523,7 +10523,7 @@ again:
 		goto unlock;
 	}
 
-	list_for_each_entry_rcu(pmu, &pmus, entry) {
+	list_for_each_entry_rcu(pmu, &pmus, entry, lockdep_is_held(&pmus_srcu)) {
 		ret = perf_try_init_event(pmu, event);
 		if (!ret)
 			goto unlock;

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

* Re: [PATCH] perf/core: Add SRCU annotation for pmus list walk
  2019-12-17 12:21 ` Peter Zijlstra
@ 2019-12-17 13:03   ` Sebastian Andrzej Siewior
  0 siblings, 0 replies; 7+ messages in thread
From: Sebastian Andrzej Siewior @ 2019-12-17 13:03 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: linux-kernel, Joel Fernandes, Paul E. McKenney, Ingo Molnar,
	Arnaldo Carvalho de Melo, Mark Rutland, Alexander Shishkin,
	Jiri Olsa, Namhyung Kim, Thomas Gleixner

On 2019-12-17 13:21:52 [+0100], Peter Zijlstra wrote:
> That's a bit obnoxious, but ok, I suppose.

If you want something else, feel free. I asked a few times for a
statement from the RCU division and all I got were ACKs from Joel which
implies that this is what they want. So…

Sebastian

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

end of thread, other threads:[~2019-12-17 13:03 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-19 12:14 [PATCH] perf/core: Add SRCU annotation for pmus list walk Sebastian Andrzej Siewior
2019-11-29 10:31 ` Sebastian Andrzej Siewior
2019-11-29 20:05 ` Joel Fernandes
2019-12-17 11:48   ` Sebastian Andrzej Siewior
2019-12-17 12:21 ` Peter Zijlstra
2019-12-17 13:03   ` Sebastian Andrzej Siewior
2019-12-17 12:39 ` [tip: perf/urgent] " tip-bot2 for Sebastian Andrzej Siewior

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