* [PATCH tip/core/rcu 1/4] srcu: Fix typos in __call_srcu() header comment
2018-06-25 22:47 [PATCH tip/core/rcu 0/4] SRCU changes for v4.19 Paul E. McKenney
@ 2018-06-25 22:47 ` Paul E. McKenney
2018-06-25 22:53 ` Randy Dunlap
2018-06-25 22:47 ` [PATCH tip/core/rcu 2/4] srcu: Document that srcu_funnel_gp_start() implies srcu_funnel_exp_start() Paul E. McKenney
` (2 subsequent siblings)
3 siblings, 1 reply; 7+ messages in thread
From: Paul E. McKenney @ 2018-06-25 22:47 UTC (permalink / raw)
To: linux-kernel
Cc: mingo, jiangshanlai, dipankar, akpm, mathieu.desnoyers, josh,
tglx, peterz, rostedt, dhowells, edumazet, fweisbec, oleg, joel,
Paul E. McKenney
This commit simply changes some copy-pasta call_rcu() instances to
the correct call_srcu().
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
kernel/rcu/srcutree.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/kernel/rcu/srcutree.c b/kernel/rcu/srcutree.c
index b4123d7a2cec..615e414b0c1e 100644
--- a/kernel/rcu/srcutree.c
+++ b/kernel/rcu/srcutree.c
@@ -823,17 +823,17 @@ static void srcu_leak_callback(struct rcu_head *rhp)
* more than one CPU, this means that when "func()" is invoked, each CPU
* is guaranteed to have executed a full memory barrier since the end of
* its last corresponding SRCU read-side critical section whose beginning
- * preceded the call to call_rcu(). It also means that each CPU executing
+ * preceded the call to call_srcu(). It also means that each CPU executing
* an SRCU read-side critical section that continues beyond the start of
- * "func()" must have executed a memory barrier after the call_rcu()
+ * "func()" must have executed a memory barrier after the call_srcu()
* but before the beginning of that SRCU read-side critical section.
* Note that these guarantees include CPUs that are offline, idle, or
* executing in user mode, as well as CPUs that are executing in the kernel.
*
- * Furthermore, if CPU A invoked call_rcu() and CPU B invoked the
+ * Furthermore, if CPU A invoked call_srcu() and CPU B invoked the
* resulting SRCU callback function "func()", then both CPU A and CPU
* B are guaranteed to execute a full memory barrier during the time
- * interval between the call to call_rcu() and the invocation of "func()".
+ * interval between the call to call_srcu() and the invocation of "func()".
* This guarantee applies even if CPU A and CPU B are the same CPU (but
* again only if the system has more than one CPU).
*
--
2.17.1
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH tip/core/rcu 1/4] srcu: Fix typos in __call_srcu() header comment
2018-06-25 22:47 ` [PATCH tip/core/rcu 1/4] srcu: Fix typos in __call_srcu() header comment Paul E. McKenney
@ 2018-06-25 22:53 ` Randy Dunlap
2018-06-25 23:09 ` Paul E. McKenney
0 siblings, 1 reply; 7+ messages in thread
From: Randy Dunlap @ 2018-06-25 22:53 UTC (permalink / raw)
To: Paul E. McKenney, linux-kernel
Cc: mingo, jiangshanlai, dipankar, akpm, mathieu.desnoyers, josh,
tglx, peterz, rostedt, dhowells, edumazet, fweisbec, oleg, joel
On 06/25/18 15:47, Paul E. McKenney wrote:
> This commit simply changes some copy-pasta call_rcu() instances to
^^^^^ cute :)
> the correct call_srcu().
>
> Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> ---
> kernel/rcu/srcutree.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
--
~Randy
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH tip/core/rcu 1/4] srcu: Fix typos in __call_srcu() header comment
2018-06-25 22:53 ` Randy Dunlap
@ 2018-06-25 23:09 ` Paul E. McKenney
0 siblings, 0 replies; 7+ messages in thread
From: Paul E. McKenney @ 2018-06-25 23:09 UTC (permalink / raw)
To: Randy Dunlap
Cc: linux-kernel, mingo, jiangshanlai, dipankar, akpm,
mathieu.desnoyers, josh, tglx, peterz, rostedt, dhowells,
edumazet, fweisbec, oleg, joel
On Mon, Jun 25, 2018 at 03:53:34PM -0700, Randy Dunlap wrote:
> On 06/25/18 15:47, Paul E. McKenney wrote:
> > This commit simply changes some copy-pasta call_rcu() instances to
>
> ^^^^^ cute :)
Glad you like it! I was unable to determine if this copy-pasta
constituted copy-spaghetti, copy-macaroni, copy-cannelloni, copy-rotelle,
copy-linguini, copy-lasagne, or something else altogether.
You all can decide for yourselves. ;-)
Thanx, Paul
> > the correct call_srcu().
> >
> > Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> > ---
> > kernel/rcu/srcutree.c | 8 ++++----
> > 1 file changed, 4 insertions(+), 4 deletions(-)
>
>
> --
> ~Randy
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH tip/core/rcu 2/4] srcu: Document that srcu_funnel_gp_start() implies srcu_funnel_exp_start()
2018-06-25 22:47 [PATCH tip/core/rcu 0/4] SRCU changes for v4.19 Paul E. McKenney
2018-06-25 22:47 ` [PATCH tip/core/rcu 1/4] srcu: Fix typos in __call_srcu() header comment Paul E. McKenney
@ 2018-06-25 22:47 ` Paul E. McKenney
2018-06-25 22:47 ` [PATCH tip/core/rcu 3/4] srcu: Add address of first callback to rcutorture output Paul E. McKenney
2018-06-25 22:47 ` [PATCH tip/core/rcu 4/4] srcu: Introduce srcu_read_{un,}lock_notrace() Paul E. McKenney
3 siblings, 0 replies; 7+ messages in thread
From: Paul E. McKenney @ 2018-06-25 22:47 UTC (permalink / raw)
To: linux-kernel
Cc: mingo, jiangshanlai, dipankar, akpm, mathieu.desnoyers, josh,
tglx, peterz, rostedt, dhowells, edumazet, fweisbec, oleg, joel,
Paul E. McKenney
This commit updates the header comment of srcu_funnel_gp_start() to
document the fact that srcu_funnel_gp_start() does the work of
srcu_funnel_exp_start(), in some cases by invoking it directly.
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
kernel/rcu/srcutree.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/kernel/rcu/srcutree.c b/kernel/rcu/srcutree.c
index 615e414b0c1e..37bef2fe80e6 100644
--- a/kernel/rcu/srcutree.c
+++ b/kernel/rcu/srcutree.c
@@ -641,6 +641,9 @@ static void srcu_funnel_exp_start(struct srcu_struct *sp, struct srcu_node *snp,
* period s. Losers must either ensure that their desired grace-period
* number is recorded on at least their leaf srcu_node structure, or they
* must take steps to invoke their own callbacks.
+ *
+ * Note that this function also does the work of srcu_funnel_exp_start(),
+ * in some cases by directly invoking it.
*/
static void srcu_funnel_gp_start(struct srcu_struct *sp, struct srcu_data *sdp,
unsigned long s, bool do_norm)
--
2.17.1
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH tip/core/rcu 3/4] srcu: Add address of first callback to rcutorture output
2018-06-25 22:47 [PATCH tip/core/rcu 0/4] SRCU changes for v4.19 Paul E. McKenney
2018-06-25 22:47 ` [PATCH tip/core/rcu 1/4] srcu: Fix typos in __call_srcu() header comment Paul E. McKenney
2018-06-25 22:47 ` [PATCH tip/core/rcu 2/4] srcu: Document that srcu_funnel_gp_start() implies srcu_funnel_exp_start() Paul E. McKenney
@ 2018-06-25 22:47 ` Paul E. McKenney
2018-06-25 22:47 ` [PATCH tip/core/rcu 4/4] srcu: Introduce srcu_read_{un,}lock_notrace() Paul E. McKenney
3 siblings, 0 replies; 7+ messages in thread
From: Paul E. McKenney @ 2018-06-25 22:47 UTC (permalink / raw)
To: linux-kernel
Cc: mingo, jiangshanlai, dipankar, akpm, mathieu.desnoyers, josh,
tglx, peterz, rostedt, dhowells, edumazet, fweisbec, oleg, joel,
Paul E. McKenney
This commit adds the address of the first callback to the per-CPU rcutorture
output in order to allow lost wakeups to be more efficiently tracked down.
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
kernel/rcu/srcutree.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/kernel/rcu/srcutree.c b/kernel/rcu/srcutree.c
index 37bef2fe80e6..5a1a9a07b407 100644
--- a/kernel/rcu/srcutree.c
+++ b/kernel/rcu/srcutree.c
@@ -1271,11 +1271,11 @@ void srcu_torture_stats_print(struct srcu_struct *sp, char *tt, char *tf)
unsigned long l0, l1;
unsigned long u0, u1;
long c0, c1;
- struct srcu_data *counts;
+ struct srcu_data *sdp;
- counts = per_cpu_ptr(sp->sda, cpu);
- u0 = counts->srcu_unlock_count[!idx];
- u1 = counts->srcu_unlock_count[idx];
+ sdp = per_cpu_ptr(sp->sda, cpu);
+ u0 = sdp->srcu_unlock_count[!idx];
+ u1 = sdp->srcu_unlock_count[idx];
/*
* Make sure that a lock is always counted if the corresponding
@@ -1283,12 +1283,13 @@ void srcu_torture_stats_print(struct srcu_struct *sp, char *tt, char *tf)
*/
smp_rmb();
- l0 = counts->srcu_lock_count[!idx];
- l1 = counts->srcu_lock_count[idx];
+ l0 = sdp->srcu_lock_count[!idx];
+ l1 = sdp->srcu_lock_count[idx];
c0 = l0 - u0;
c1 = l1 - u1;
- pr_cont(" %d(%ld,%ld)", cpu, c0, c1);
+ pr_cont(" %d(%ld,%ld %1p)",
+ cpu, c0, c1, rcu_segcblist_head(&sdp->srcu_cblist));
s0 += c0;
s1 += c1;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH tip/core/rcu 4/4] srcu: Introduce srcu_read_{un,}lock_notrace()
2018-06-25 22:47 [PATCH tip/core/rcu 0/4] SRCU changes for v4.19 Paul E. McKenney
` (2 preceding siblings ...)
2018-06-25 22:47 ` [PATCH tip/core/rcu 3/4] srcu: Add address of first callback to rcutorture output Paul E. McKenney
@ 2018-06-25 22:47 ` Paul E. McKenney
3 siblings, 0 replies; 7+ messages in thread
From: Paul E. McKenney @ 2018-06-25 22:47 UTC (permalink / raw)
To: linux-kernel
Cc: mingo, jiangshanlai, dipankar, akpm, mathieu.desnoyers, josh,
tglx, peterz, rostedt, dhowells, edumazet, fweisbec, oleg, joel,
Paul E. McKenney
Joel Fernandes is using SRCU to protect from-idle tracepoints, which
requires notrace variants of srcu_read_lock() and srcu_read_unlock()
in order to avoid problems with tracepoints in lockdep. This commit
therefore adds srcu_read_lock_notrace() and srcu_read_unlock_notrace().
[1] http://lkml.kernel.org/r/20180427042656.190746-1-joelaf@google.com
Reported-by: Joel Fernandes <joelaf@google.com>
Intermittently-reported-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
include/linux/srcu.h | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/include/linux/srcu.h b/include/linux/srcu.h
index 91494d7e8e41..3e72a291c401 100644
--- a/include/linux/srcu.h
+++ b/include/linux/srcu.h
@@ -195,6 +195,16 @@ static inline int srcu_read_lock(struct srcu_struct *sp) __acquires(sp)
return retval;
}
+/* Used by tracing, cannot be traced and cannot invoke lockdep. */
+static inline notrace int
+srcu_read_lock_notrace(struct srcu_struct *sp) __acquires(sp)
+{
+ int retval;
+
+ retval = __srcu_read_lock(sp);
+ return retval;
+}
+
/**
* srcu_read_unlock - unregister a old reader from an SRCU-protected structure.
* @sp: srcu_struct in which to unregister the old reader.
@@ -209,6 +219,13 @@ static inline void srcu_read_unlock(struct srcu_struct *sp, int idx)
__srcu_read_unlock(sp, idx);
}
+/* Used by tracing, cannot be traced and cannot call lockdep. */
+static inline notrace void
+srcu_read_unlock_notrace(struct srcu_struct *sp, int idx) __releases(sp)
+{
+ __srcu_read_unlock(sp, idx);
+}
+
/**
* smp_mb__after_srcu_read_unlock - ensure full ordering after srcu_read_unlock
*
--
2.17.1
^ permalink raw reply related [flat|nested] 7+ messages in thread