OpenCloudOS-Kernel/kernel/rcu
Frederic Weisbecker 37d9fd3134 rcu/nocb: Remove buggy bypass lock contention mitigation
[ Upstream commit e4f78057291608f6968a6789c5ebb3bde7d95504 ]

The bypass lock contention mitigation assumes there can be at most
2 contenders on the bypass lock, following this scheme:

1) One kthread takes the bypass lock
2) Another one spins on it and increment the contended counter
3) A third one (a bypass enqueuer) sees the contended counter on and
  busy loops waiting on it to decrement.

However this assumption is wrong. There can be only one CPU to find the
lock contended because call_rcu() (the bypass enqueuer) is the only
bypass lock acquire site that may not already hold the NOCB lock
beforehand, all the other sites must first contend on the NOCB lock.
Therefore step 2) is impossible.

The other problem is that the mitigation assumes that contenders all
belong to the same rdp CPU, which is also impossible for a raw spinlock.
In theory the warning could trigger if the enqueuer holds the bypass
lock and another CPU flushes the bypass queue concurrently but this is
prevented from all flush users:

1) NOCB kthreads only flush if they successfully _tried_ to lock the
   bypass lock. So no contention management here.

2) Flush on callbacks migration happen remotely when the CPU is offline.
   No concurrency against bypass enqueue.

3) Flush on deoffloading happen either locally with IRQs disabled or
   remotely when the CPU is not yet online. No concurrency against
   bypass enqueue.

4) Flush on barrier entrain happen either locally with IRQs disabled or
   remotely when the CPU is offline. No concurrency against
   bypass enqueue.

For those reasons, the bypass lock contention mitigation isn't needed
and is even wrong. Remove it but keep the warning reporting a contended
bypass lock on a remote CPU, to keep unexpected contention awareness.

Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-09-08 07:54:44 +02:00
..
Kconfig rcu: Employ jiffies-based backstop to callback time limit 2023-05-11 13:42:39 -07:00
Kconfig.debug rcu: Allow up to five minutes expedited RCU CPU stall-warning timeouts 2023-01-09 12:09:52 -08:00
Makefile rcuperf: Change rcuperf to rcuscale 2020-08-24 18:39:24 -07:00
rcu.h rcu: Dump memory object info if callback function is invalid 2024-08-29 17:33:23 +02:00
rcu_segcblist.c rcu: Throttle callback invocation based on number of ready callbacks 2023-01-03 17:28:34 -08:00
rcu_segcblist.h rcu: Throttle callback invocation based on number of ready callbacks 2023-01-03 17:28:34 -08:00
rcuscale.c rcuscale: Move rcu_scale_writer() schedule_timeout_uninterruptible() to _idle() 2023-07-14 15:01:49 -07:00
rcutorture.c rcutorture: Fix rcu_torture_fwd_cb_cr() data race 2024-08-14 13:58:41 +02:00
refscale.c refscale: Add a "jiffies" test 2023-07-14 15:01:04 -07:00
srcutiny.c rcu: Dump memory object info if callback function is invalid 2024-08-29 17:33:23 +02:00
srcutree.c rcu: Dump memory object info if callback function is invalid 2024-08-29 17:33:23 +02:00
sync.c rcu/sync: Use call_rcu_hurry() instead of call_rcu 2022-11-29 14:04:33 -08:00
tasks.h rcu: Dump memory object info if callback function is invalid 2024-08-29 17:33:23 +02:00
tiny.c rcu: Dump memory object info if callback function is invalid 2024-08-29 17:33:23 +02:00
tree.c rcu: Eliminate rcu_gp_slow_unregister() false positive 2024-08-29 17:33:23 +02:00
tree.h rcu/nocb: Remove buggy bypass lock contention mitigation 2024-09-08 07:54:44 +02:00
tree_exp.h rcu/exp: Handle RCU expedited grace period kworker allocation failure 2024-03-26 18:19:17 -04:00
tree_nocb.h rcu/nocb: Remove buggy bypass lock contention mitigation 2024-09-08 07:54:44 +02:00
tree_plugin.h rcu: Mark additional concurrent load from ->cpu_no_qs.b.exp 2023-05-11 13:42:39 -07:00
tree_stall.h rcu: Fix buffer overflow in print_cpu_stall_info() 2024-06-12 11:11:32 +02:00
update.c Merge branch 'stall.2023.01.09a' into HEAD 2023-02-02 16:40:07 -08:00