* [PATCH 0/3] RCU tasks for v6.7
@ 2023-10-17 12:19 Frederic Weisbecker
2023-10-17 12:19 ` [PATCH 1/3] rcu-tasks: Add printk()s to localize boot-time self-test hang Frederic Weisbecker
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Frederic Weisbecker @ 2023-10-17 12:19 UTC (permalink / raw)
To: LKML
Cc: Frederic Weisbecker, Boqun Feng, Joel Fernandes, Josh Triplett,
Mathieu Desnoyers, Neeraj Upadhyay, Paul E . McKenney,
Steven Rostedt, Uladzislau Rezki, rcu
Hello,
Please find below the RCU tasks updates for the next merge window:
Jiapeng Chong (1):
rcu-tasks: Make rcu_tasks_lazy_ms static
Paul E. McKenney (2):
rcu-tasks: Add printk()s to localize boot-time self-test hang
rcu-tasks: Pull sampling of ->percpu_dequeue_lim out of loop
Thanks,
Frederic.
kernel/rcu/tasks.h | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
--
2.34.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/3] rcu-tasks: Add printk()s to localize boot-time self-test hang
2023-10-17 12:19 [PATCH 0/3] RCU tasks for v6.7 Frederic Weisbecker
@ 2023-10-17 12:19 ` Frederic Weisbecker
2023-10-17 12:19 ` [PATCH 2/3] rcu-tasks: Pull sampling of ->percpu_dequeue_lim out of loop Frederic Weisbecker
2023-10-17 12:19 ` [PATCH 3/3] rcu-tasks: Make rcu_tasks_lazy_ms static Frederic Weisbecker
2 siblings, 0 replies; 4+ messages in thread
From: Frederic Weisbecker @ 2023-10-17 12:19 UTC (permalink / raw)
To: LKML
Cc: Paul E. McKenney, Boqun Feng, Joel Fernandes, Josh Triplett,
Mathieu Desnoyers, Neeraj Upadhyay, Steven Rostedt,
Uladzislau Rezki, rcu, Guenter Roeck, Frederic Weisbecker
From: "Paul E. McKenney" <paulmck@kernel.org>
Currently, rcu_tasks_initiate_self_tests() prints a message and then
initiates self tests on up to three different RCU Tasks flavors. If one
of the flavors has a grace-period hang, it is not easy to work out which
of the three hung. This commit therefore prints a message prior to each
individual test.
Reported-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
---
kernel/rcu/tasks.h | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/kernel/rcu/tasks.h b/kernel/rcu/tasks.h
index 8d65f7d576a3..83049a893de5 100644
--- a/kernel/rcu/tasks.h
+++ b/kernel/rcu/tasks.h
@@ -1979,20 +1979,22 @@ static void test_rcu_tasks_callback(struct rcu_head *rhp)
static void rcu_tasks_initiate_self_tests(void)
{
- pr_info("Running RCU-tasks wait API self tests\n");
#ifdef CONFIG_TASKS_RCU
+ pr_info("Running RCU Tasks wait API self tests\n");
tests[0].runstart = jiffies;
synchronize_rcu_tasks();
call_rcu_tasks(&tests[0].rh, test_rcu_tasks_callback);
#endif
#ifdef CONFIG_TASKS_RUDE_RCU
+ pr_info("Running RCU Tasks Rude wait API self tests\n");
tests[1].runstart = jiffies;
synchronize_rcu_tasks_rude();
call_rcu_tasks_rude(&tests[1].rh, test_rcu_tasks_callback);
#endif
#ifdef CONFIG_TASKS_TRACE_RCU
+ pr_info("Running RCU Tasks Trace wait API self tests\n");
tests[2].runstart = jiffies;
synchronize_rcu_tasks_trace();
call_rcu_tasks_trace(&tests[2].rh, test_rcu_tasks_callback);
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/3] rcu-tasks: Pull sampling of ->percpu_dequeue_lim out of loop
2023-10-17 12:19 [PATCH 0/3] RCU tasks for v6.7 Frederic Weisbecker
2023-10-17 12:19 ` [PATCH 1/3] rcu-tasks: Add printk()s to localize boot-time self-test hang Frederic Weisbecker
@ 2023-10-17 12:19 ` Frederic Weisbecker
2023-10-17 12:19 ` [PATCH 3/3] rcu-tasks: Make rcu_tasks_lazy_ms static Frederic Weisbecker
2 siblings, 0 replies; 4+ messages in thread
From: Frederic Weisbecker @ 2023-10-17 12:19 UTC (permalink / raw)
To: LKML
Cc: Paul E. McKenney, Boqun Feng, Joel Fernandes, Josh Triplett,
Mathieu Desnoyers, Neeraj Upadhyay, Steven Rostedt,
Uladzislau Rezki, rcu, Linus Torvalds, Frederic Weisbecker
From: "Paul E. McKenney" <paulmck@kernel.org>
The rcu_tasks_need_gpcb() samples ->percpu_dequeue_lim as part of the
condition clause of a "for" loop, which is a bit confusing. This commit
therefore hoists this sampling out of the loop, using the result loaded
in the condition clause.
So why does this work in the face of a concurrent switch from single-CPU
queueing to per-CPU queueing?
o The call_rcu_tasks_generic() that makes the change has already
enqueued its callback, which means that all of the other CPU's
callback queues are empty.
o For the call_rcu_tasks_generic() that first notices
the switch to per-CPU queues, the smp_store_release()
used to update ->percpu_enqueue_lim pairs with the
raw_spin_trylock_rcu_node()'s full barrier that is
between the READ_ONCE(rtp->percpu_enqueue_shift) and the
rcu_segcblist_enqueue() that enqueues the callback.
o Because this CPU's queue is empty (unless it happens to
be the original single queue, in which case there is no
need for synchronization), this call_rcu_tasks_generic()
will do an irq_work_queue() to schedule a handler for the
needed rcuwait_wake_up() call. This call will be ordered
after the first call_rcu_tasks_generic() function's change to
->percpu_dequeue_lim.
o This rcuwait_wake_up() will either happen before or after the
set_current_state() in rcuwait_wait_event(). If it happens
before, the "condition" argument's call to rcu_tasks_need_gpcb()
will be ordered after the original change, and all callbacks on
all CPUs will be visible. Otherwise, if it happens after, then
the grace-period kthread's state will be set back to running,
which will result in a later call to rcuwait_wait_event() and
thus to rcu_tasks_need_gpcb(), which will again see the change.
So it all works out.
Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
---
kernel/rcu/tasks.h | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/kernel/rcu/tasks.h b/kernel/rcu/tasks.h
index 83049a893de5..94bb5abdbb37 100644
--- a/kernel/rcu/tasks.h
+++ b/kernel/rcu/tasks.h
@@ -432,6 +432,7 @@ static void rcu_barrier_tasks_generic(struct rcu_tasks *rtp)
static int rcu_tasks_need_gpcb(struct rcu_tasks *rtp)
{
int cpu;
+ int dequeue_limit;
unsigned long flags;
bool gpdone = poll_state_synchronize_rcu(rtp->percpu_dequeue_gpseq);
long n;
@@ -439,7 +440,8 @@ static int rcu_tasks_need_gpcb(struct rcu_tasks *rtp)
long ncbsnz = 0;
int needgpcb = 0;
- for (cpu = 0; cpu < smp_load_acquire(&rtp->percpu_dequeue_lim); cpu++) {
+ dequeue_limit = smp_load_acquire(&rtp->percpu_dequeue_lim);
+ for (cpu = 0; cpu < dequeue_limit; cpu++) {
struct rcu_tasks_percpu *rtpcp = per_cpu_ptr(rtp->rtpcpu, cpu);
/* Advance and accelerate any new callbacks. */
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 3/3] rcu-tasks: Make rcu_tasks_lazy_ms static
2023-10-17 12:19 [PATCH 0/3] RCU tasks for v6.7 Frederic Weisbecker
2023-10-17 12:19 ` [PATCH 1/3] rcu-tasks: Add printk()s to localize boot-time self-test hang Frederic Weisbecker
2023-10-17 12:19 ` [PATCH 2/3] rcu-tasks: Pull sampling of ->percpu_dequeue_lim out of loop Frederic Weisbecker
@ 2023-10-17 12:19 ` Frederic Weisbecker
2 siblings, 0 replies; 4+ messages in thread
From: Frederic Weisbecker @ 2023-10-17 12:19 UTC (permalink / raw)
To: LKML
Cc: Jiapeng Chong, Boqun Feng, Joel Fernandes, Josh Triplett,
Mathieu Desnoyers, Neeraj Upadhyay, Paul E . McKenney,
Steven Rostedt, Uladzislau Rezki, rcu, Abaci Robot,
Frederic Weisbecker
From: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
The rcu_tasks_lazy_ms variable is not used outside the file tasks.h,
so this commit marks it static.
kernel/rcu/tasks.h:1085:5: warning: symbol 'rcu_tasks_lazy_ms' was not declared. Should it be static?
Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=6086
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
Reviewed-by: Joel Fernandes (Google) <joel@joelfernandes.org>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Signed-off-by: Frederic Weisbecker <frederic@kernel.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 94bb5abdbb37..018f03f20629 100644
--- a/kernel/rcu/tasks.h
+++ b/kernel/rcu/tasks.h
@@ -1086,7 +1086,7 @@ void rcu_barrier_tasks(void)
}
EXPORT_SYMBOL_GPL(rcu_barrier_tasks);
-int rcu_tasks_lazy_ms = -1;
+static int rcu_tasks_lazy_ms = -1;
module_param(rcu_tasks_lazy_ms, int, 0444);
static int __init rcu_spawn_tasks_kthread(void)
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-10-17 12:19 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-17 12:19 [PATCH 0/3] RCU tasks for v6.7 Frederic Weisbecker
2023-10-17 12:19 ` [PATCH 1/3] rcu-tasks: Add printk()s to localize boot-time self-test hang Frederic Weisbecker
2023-10-17 12:19 ` [PATCH 2/3] rcu-tasks: Pull sampling of ->percpu_dequeue_lim out of loop Frederic Weisbecker
2023-10-17 12:19 ` [PATCH 3/3] rcu-tasks: Make rcu_tasks_lazy_ms static Frederic Weisbecker
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.