rcu.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/5] rcu-tasks miscellaneous fixes
@ 2021-08-25  7:10 Neeraj Upadhyay
  2021-08-25  7:10 ` [PATCH v2 1/5] rcu-tasks: Fix s/rcu_add_holdout/trc_add_holdout/ typo in comment Neeraj Upadhyay
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Neeraj Upadhyay @ 2021-08-25  7:10 UTC (permalink / raw)
  To: paulmck, josh, rostedt, mathieu.desnoyers, jiangshanlai, joel
  Cc: rcu, linux-kernel, urezki, frederic, boqun.feng, Neeraj Upadhyay

Minor typos in comments and fixes for rcu-tasks.

V1 -> V2:
- Update comment in patch 4/5, as suggested by Paul.

Neeraj Upadhyay (5):
  rcu-tasks: Fix s/rcu_add_holdout/trc_add_holdout/ typo in comment
  rcu-tasks: Correct firstreport usage in check_all_holdout_tasks_trace
  rcu-tasks: Correct check for no_hz_full cpu in show_stalled_task_trace
  rcu-tasks: Fix read-side primitives comment for call_rcu_tasks_trace
  rcu-tasks: Clarify read side section info for rcu_tasks_rude GP
    primitives

 kernel/rcu/tasks.h | 36 ++++++++++++++++--------------------
 1 file changed, 16 insertions(+), 20 deletions(-)

-- 
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] 7+ messages in thread

* [PATCH v2 1/5] rcu-tasks: Fix s/rcu_add_holdout/trc_add_holdout/ typo in comment
  2021-08-25  7:10 [PATCH v2 0/5] rcu-tasks miscellaneous fixes Neeraj Upadhyay
@ 2021-08-25  7:10 ` Neeraj Upadhyay
  2021-08-25  7:10 ` [PATCH v2 2/5] rcu-tasks: Correct firstreport usage in check_all_holdout_tasks_trace Neeraj Upadhyay
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Neeraj Upadhyay @ 2021-08-25  7:10 UTC (permalink / raw)
  To: paulmck, josh, rostedt, mathieu.desnoyers, jiangshanlai, joel
  Cc: rcu, linux-kernel, urezki, frederic, boqun.feng, Neeraj Upadhyay

Signed-off-by: Neeraj Upadhyay <neeraju@codeaurora.org>
---
 kernel/rcu/tasks.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/rcu/tasks.h b/kernel/rcu/tasks.h
index 39cef3c..e62da45 100644
--- a/kernel/rcu/tasks.h
+++ b/kernel/rcu/tasks.h
@@ -996,7 +996,7 @@ static void trc_wait_for_one_reader(struct task_struct *t,
 
 	// If this task is not yet on the holdout list, then we are in
 	// an RCU read-side critical section.  Otherwise, the invocation of
-	// rcu_add_holdout() that added it to the list did the necessary
+	// trc_add_holdout() that added it to the list did the necessary
 	// get_task_struct().  Either way, the task cannot be freed out
 	// from under this code.
 
-- 
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] 7+ messages in thread

* [PATCH v2 2/5] rcu-tasks: Correct firstreport usage in check_all_holdout_tasks_trace
  2021-08-25  7:10 [PATCH v2 0/5] rcu-tasks miscellaneous fixes Neeraj Upadhyay
  2021-08-25  7:10 ` [PATCH v2 1/5] rcu-tasks: Fix s/rcu_add_holdout/trc_add_holdout/ typo in comment Neeraj Upadhyay
@ 2021-08-25  7:10 ` Neeraj Upadhyay
  2021-08-25  7:10 ` [PATCH v2 3/5] rcu-tasks: Correct check for no_hz_full cpu in show_stalled_task_trace Neeraj Upadhyay
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Neeraj Upadhyay @ 2021-08-25  7:10 UTC (permalink / raw)
  To: paulmck, josh, rostedt, mathieu.desnoyers, jiangshanlai, joel
  Cc: rcu, linux-kernel, urezki, frederic, boqun.feng, Neeraj Upadhyay

In check_all_holdout_tasks_trace(), firstreport is a pointer argument;
so, check the dereferenced value, instead of checking the pointer.

Signed-off-by: Neeraj Upadhyay <neeraju@codeaurora.org>
---
 kernel/rcu/tasks.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/rcu/tasks.h b/kernel/rcu/tasks.h
index e62da45..9db7293 100644
--- a/kernel/rcu/tasks.h
+++ b/kernel/rcu/tasks.h
@@ -1134,7 +1134,7 @@ static void check_all_holdout_tasks_trace(struct list_head *hop,
 	cpus_read_unlock();
 
 	if (needreport) {
-		if (firstreport)
+		if (*firstreport)
 			pr_err("INFO: rcu_tasks_trace detected stalls? (Late IPI?)\n");
 		show_stalled_ipi_trace();
 	}
-- 
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] 7+ messages in thread

* [PATCH v2 3/5] rcu-tasks: Correct check for no_hz_full cpu in show_stalled_task_trace
  2021-08-25  7:10 [PATCH v2 0/5] rcu-tasks miscellaneous fixes Neeraj Upadhyay
  2021-08-25  7:10 ` [PATCH v2 1/5] rcu-tasks: Fix s/rcu_add_holdout/trc_add_holdout/ typo in comment Neeraj Upadhyay
  2021-08-25  7:10 ` [PATCH v2 2/5] rcu-tasks: Correct firstreport usage in check_all_holdout_tasks_trace Neeraj Upadhyay
@ 2021-08-25  7:10 ` Neeraj Upadhyay
  2021-08-25  7:10 ` [PATCH v2 4/5] rcu-tasks: Fix read-side primitives comment for call_rcu_tasks_trace Neeraj Upadhyay
  2021-08-25  7:10 ` [PATCH v2 5/5] rcu-tasks: Clarify read side section info for rcu_tasks_rude GP primitives Neeraj Upadhyay
  4 siblings, 0 replies; 7+ messages in thread
From: Neeraj Upadhyay @ 2021-08-25  7:10 UTC (permalink / raw)
  To: paulmck, josh, rostedt, mathieu.desnoyers, jiangshanlai, joel
  Cc: rcu, linux-kernel, urezki, frederic, boqun.feng, Neeraj Upadhyay

Correct the check for no_hz_full cpu in show_stalled_task_trace(),
to include cpu 0.

Signed-off-by: Neeraj Upadhyay <neeraju@codeaurora.org>
---
 kernel/rcu/tasks.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/rcu/tasks.h b/kernel/rcu/tasks.h
index 9db7293..244e06a 100644
--- a/kernel/rcu/tasks.h
+++ b/kernel/rcu/tasks.h
@@ -1091,7 +1091,7 @@ static void show_stalled_task_trace(struct task_struct *t, bool *firstreport)
 		 t->pid,
 		 ".I"[READ_ONCE(t->trc_ipi_to_cpu) > 0],
 		 ".i"[is_idle_task(t)],
-		 ".N"[cpu > 0 && tick_nohz_full_cpu(cpu)],
+		 ".N"[cpu >= 0 && tick_nohz_full_cpu(cpu)],
 		 READ_ONCE(t->trc_reader_nesting),
 		 " N"[!!READ_ONCE(t->trc_reader_special.b.need_qs)],
 		 cpu);
-- 
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] 7+ messages in thread

* [PATCH v2 4/5] rcu-tasks: Fix read-side primitives comment for call_rcu_tasks_trace
  2021-08-25  7:10 [PATCH v2 0/5] rcu-tasks miscellaneous fixes Neeraj Upadhyay
                   ` (2 preceding siblings ...)
  2021-08-25  7:10 ` [PATCH v2 3/5] rcu-tasks: Correct check for no_hz_full cpu in show_stalled_task_trace Neeraj Upadhyay
@ 2021-08-25  7:10 ` Neeraj Upadhyay
  2021-08-25 17:08   ` Paul E. McKenney
  2021-08-25  7:10 ` [PATCH v2 5/5] rcu-tasks: Clarify read side section info for rcu_tasks_rude GP primitives Neeraj Upadhyay
  4 siblings, 1 reply; 7+ messages in thread
From: Neeraj Upadhyay @ 2021-08-25  7:10 UTC (permalink / raw)
  To: paulmck, josh, rostedt, mathieu.desnoyers, jiangshanlai, joel
  Cc: rcu, linux-kernel, urezki, frederic, boqun.feng, Neeraj Upadhyay

call_rcu_tasks_trace() does have read-side primitives - rcu_read_lock_trace()
and rcu_read_unlock_trace(). Fix this information in the comments.

Signed-off-by: Neeraj Upadhyay <neeraju@codeaurora.org>
---
 kernel/rcu/tasks.h | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/kernel/rcu/tasks.h b/kernel/rcu/tasks.h
index 244e06a..c5f1c2f 100644
--- a/kernel/rcu/tasks.h
+++ b/kernel/rcu/tasks.h
@@ -1212,15 +1212,11 @@ static void exit_tasks_rcu_finish_trace(struct task_struct *t)
  * @rhp: structure to be used for queueing the RCU updates.
  * @func: actual callback function to be invoked after the grace period
  *
- * The callback function will be invoked some time after a full grace
- * period elapses, in other words after all currently executing RCU
- * read-side critical sections have completed. call_rcu_tasks_trace()
- * assumes that the read-side critical sections end at context switch,
- * cond_resched_rcu_qs(), or transition to usermode execution.  As such,
- * there are no read-side primitives analogous to rcu_read_lock() and
- * rcu_read_unlock() because this primitive is intended to determine
- * that all tasks have passed through a safe state, not so much for
- * data-structure synchronization.
+ * The callback function will be invoked some time after a trace rcu-tasks
+ * grace period elapses, in other words after all currently executing
+ * trace rcu-tasks read-side critical sections have completed. These
+ * read-side critical sections are delimited by calls to rcu_read_lock_trace()
+ * and rcu_read_unlock_trace().
  *
  * See the description of call_rcu() for more detailed information on
  * memory ordering guarantees.
@@ -1236,7 +1232,7 @@ EXPORT_SYMBOL_GPL(call_rcu_tasks_trace);
  *
  * Control will return to the caller some time after a trace rcu-tasks
  * grace period has elapsed, in other words after all currently executing
- * rcu-tasks read-side critical sections have elapsed.  These read-side
+ * trace rcu-tasks read-side critical sections have elapsed. These read-side
  * critical sections are delimited by calls to rcu_read_lock_trace()
  * and rcu_read_unlock_trace().
  *
-- 
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] 7+ messages in thread

* [PATCH v2 5/5] rcu-tasks: Clarify read side section info for rcu_tasks_rude GP primitives
  2021-08-25  7:10 [PATCH v2 0/5] rcu-tasks miscellaneous fixes Neeraj Upadhyay
                   ` (3 preceding siblings ...)
  2021-08-25  7:10 ` [PATCH v2 4/5] rcu-tasks: Fix read-side primitives comment for call_rcu_tasks_trace Neeraj Upadhyay
@ 2021-08-25  7:10 ` Neeraj Upadhyay
  4 siblings, 0 replies; 7+ messages in thread
From: Neeraj Upadhyay @ 2021-08-25  7:10 UTC (permalink / raw)
  To: paulmck, josh, rostedt, mathieu.desnoyers, jiangshanlai, joel
  Cc: rcu, linux-kernel, urezki, frederic, boqun.feng, Neeraj Upadhyay

RCU tasks rude variant does not maintain or check whether the current
running context on a CPU is usermode. Read side critical section ends
on transition to usermode execution, by the virtue of usermode
execution being schedulable. Clarify this in comments for
call_rcu_tasks_rude() and synchronize_rcu_tasks_rude().

Signed-off-by: Neeraj Upadhyay <neeraju@codeaurora.org>
---
 kernel/rcu/tasks.h | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/kernel/rcu/tasks.h b/kernel/rcu/tasks.h
index c5f1c2f..691defa 100644
--- a/kernel/rcu/tasks.h
+++ b/kernel/rcu/tasks.h
@@ -677,11 +677,11 @@ DEFINE_RCU_TASKS(rcu_tasks_rude, rcu_tasks_rude_wait_gp, call_rcu_tasks_rude,
  * period elapses, in other words after all currently executing RCU
  * read-side critical sections have completed. call_rcu_tasks_rude()
  * assumes that the read-side critical sections end at context switch,
- * cond_resched_rcu_qs(), or transition to usermode execution.  As such,
- * there are no read-side primitives analogous to rcu_read_lock() and
- * rcu_read_unlock() because this primitive is intended to determine
- * that all tasks have passed through a safe state, not so much for
- * data-structure synchronization.
+ * cond_resched_rcu_qs(), or transition to usermode execution (as
+ * usermode execution is schedulable). As such, there are no read-side
+ * primitives analogous to rcu_read_lock() and rcu_read_unlock() because
+ * this primitive is intended to determine that all tasks have passed
+ * through a safe state, not so much for data-structure synchronization.
  *
  * See the description of call_rcu() for more detailed information on
  * memory ordering guarantees.
@@ -699,8 +699,8 @@ EXPORT_SYMBOL_GPL(call_rcu_tasks_rude);
  * grace period has elapsed, in other words after all currently
  * executing rcu-tasks read-side critical sections have elapsed.  These
  * read-side critical sections are delimited by calls to schedule(),
- * cond_resched_tasks_rcu_qs(), userspace execution, and (in theory,
- * anyway) cond_resched().
+ * cond_resched_tasks_rcu_qs(), userspace execution (which is a schedulable
+ * context), and (in theory, anyway) cond_resched().
  *
  * This is a very specialized primitive, intended only for a few uses in
  * tracing and other situations requiring manipulation of function preambles
-- 
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] 7+ messages in thread

* Re: [PATCH v2 4/5] rcu-tasks: Fix read-side primitives comment for call_rcu_tasks_trace
  2021-08-25  7:10 ` [PATCH v2 4/5] rcu-tasks: Fix read-side primitives comment for call_rcu_tasks_trace Neeraj Upadhyay
@ 2021-08-25 17:08   ` Paul E. McKenney
  0 siblings, 0 replies; 7+ messages in thread
From: Paul E. McKenney @ 2021-08-25 17:08 UTC (permalink / raw)
  To: Neeraj Upadhyay
  Cc: josh, rostedt, mathieu.desnoyers, jiangshanlai, joel, rcu,
	linux-kernel, urezki, frederic, boqun.feng

On Wed, Aug 25, 2021 at 12:40:50PM +0530, Neeraj Upadhyay wrote:
> call_rcu_tasks_trace() does have read-side primitives - rcu_read_lock_trace()
> and rcu_read_unlock_trace(). Fix this information in the comments.
> 
> Signed-off-by: Neeraj Upadhyay <neeraju@codeaurora.org>

Queued for v5.16, thank you very much!

(The other four patches are already queued.)

							Thanx, Paul

> ---
>  kernel/rcu/tasks.h | 16 ++++++----------
>  1 file changed, 6 insertions(+), 10 deletions(-)
> 
> diff --git a/kernel/rcu/tasks.h b/kernel/rcu/tasks.h
> index 244e06a..c5f1c2f 100644
> --- a/kernel/rcu/tasks.h
> +++ b/kernel/rcu/tasks.h
> @@ -1212,15 +1212,11 @@ static void exit_tasks_rcu_finish_trace(struct task_struct *t)
>   * @rhp: structure to be used for queueing the RCU updates.
>   * @func: actual callback function to be invoked after the grace period
>   *
> - * The callback function will be invoked some time after a full grace
> - * period elapses, in other words after all currently executing RCU
> - * read-side critical sections have completed. call_rcu_tasks_trace()
> - * assumes that the read-side critical sections end at context switch,
> - * cond_resched_rcu_qs(), or transition to usermode execution.  As such,
> - * there are no read-side primitives analogous to rcu_read_lock() and
> - * rcu_read_unlock() because this primitive is intended to determine
> - * that all tasks have passed through a safe state, not so much for
> - * data-structure synchronization.
> + * The callback function will be invoked some time after a trace rcu-tasks
> + * grace period elapses, in other words after all currently executing
> + * trace rcu-tasks read-side critical sections have completed. These
> + * read-side critical sections are delimited by calls to rcu_read_lock_trace()
> + * and rcu_read_unlock_trace().
>   *
>   * See the description of call_rcu() for more detailed information on
>   * memory ordering guarantees.
> @@ -1236,7 +1232,7 @@ EXPORT_SYMBOL_GPL(call_rcu_tasks_trace);
>   *
>   * Control will return to the caller some time after a trace rcu-tasks
>   * grace period has elapsed, in other words after all currently executing
> - * rcu-tasks read-side critical sections have elapsed.  These read-side
> + * trace rcu-tasks read-side critical sections have elapsed. These read-side
>   * critical sections are delimited by calls to rcu_read_lock_trace()
>   * and rcu_read_unlock_trace().
>   *
> -- 
> 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] 7+ messages in thread

end of thread, other threads:[~2021-08-25 17:08 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-25  7:10 [PATCH v2 0/5] rcu-tasks miscellaneous fixes Neeraj Upadhyay
2021-08-25  7:10 ` [PATCH v2 1/5] rcu-tasks: Fix s/rcu_add_holdout/trc_add_holdout/ typo in comment Neeraj Upadhyay
2021-08-25  7:10 ` [PATCH v2 2/5] rcu-tasks: Correct firstreport usage in check_all_holdout_tasks_trace Neeraj Upadhyay
2021-08-25  7:10 ` [PATCH v2 3/5] rcu-tasks: Correct check for no_hz_full cpu in show_stalled_task_trace Neeraj Upadhyay
2021-08-25  7:10 ` [PATCH v2 4/5] rcu-tasks: Fix read-side primitives comment for call_rcu_tasks_trace Neeraj Upadhyay
2021-08-25 17:08   ` Paul E. McKenney
2021-08-25  7:10 ` [PATCH v2 5/5] rcu-tasks: Clarify read side section info for rcu_tasks_rude GP primitives Neeraj Upadhyay

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