Commit 85d6822
rcu: Break rcu_node_0 --> &rq->__lock order
Commit 851a723 ("sched: Always clear user_cpus_ptr in
do_set_cpus_allowed()") added a kfree() call to free any user
provided affinity mask, if present. It was changed later to use
kfree_rcu() in commit 9a5418b ("sched/core: Use kfree_rcu()
in do_set_cpus_allowed()") to avoid a circular locking dependency
problem.
It turns out that even kfree_rcu() isn't safe for avoiding
circular locking problem. As reported by kernel test robot,
the following circular locking dependency now exists:
&rdp->nocb_lock --> rcu_node_0 --> &rq->__lock
Solve this by breaking the rcu_node_0 --> &rq->__lock chain by moving
the resched_cpu() out from under rcu_node lock.
[peterz: heavily borrowed from Waiman's Changelog]
[paulmck: applied Z qiang feedback]
Fixes: 851a723 ("sched: Always clear user_cpus_ptr in do_set_cpus_allowed()")
Reported-by: kernel test robot <oliver.sang@intel.com>
Acked-by: Waiman Long <longman@redhat.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lore.kernel.org/oe-lkp/202310302207.a25f1a30-oliver.sang@intel.com
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Signed-off-by: Frederic Weisbecker <frederic@kernel.org>1 parent 2656821 commit 85d6822
1 file changed
Lines changed: 25 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
755 | 755 | | |
756 | 756 | | |
757 | 757 | | |
758 | | - | |
759 | | - | |
760 | | - | |
761 | | - | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
762 | 766 | | |
763 | 767 | | |
764 | 768 | | |
765 | 769 | | |
| 770 | + | |
766 | 771 | | |
767 | 772 | | |
768 | 773 | | |
| |||
848 | 853 | | |
849 | 854 | | |
850 | 855 | | |
851 | | - | |
852 | 856 | | |
| 857 | + | |
853 | 858 | | |
854 | 859 | | |
855 | 860 | | |
| |||
862 | 867 | | |
863 | 868 | | |
864 | 869 | | |
865 | | - | |
866 | 870 | | |
| 871 | + | |
867 | 872 | | |
868 | 873 | | |
869 | 874 | | |
| |||
892 | 897 | | |
893 | 898 | | |
894 | 899 | | |
895 | | - | |
| 900 | + | |
896 | 901 | | |
897 | 902 | | |
898 | 903 | | |
| |||
2271 | 2276 | | |
2272 | 2277 | | |
2273 | 2278 | | |
2274 | | - | |
2275 | | - | |
2276 | 2279 | | |
2277 | 2280 | | |
2278 | 2281 | | |
2279 | 2282 | | |
2280 | 2283 | | |
| 2284 | + | |
| 2285 | + | |
| 2286 | + | |
2281 | 2287 | | |
2282 | | - | |
2283 | 2288 | | |
2284 | 2289 | | |
2285 | 2290 | | |
| |||
2297 | 2302 | | |
2298 | 2303 | | |
2299 | 2304 | | |
| 2305 | + | |
| 2306 | + | |
| 2307 | + | |
2300 | 2308 | | |
2301 | | - | |
| 2309 | + | |
| 2310 | + | |
2302 | 2311 | | |
2303 | 2312 | | |
2304 | 2313 | | |
| 2314 | + | |
| 2315 | + | |
2305 | 2316 | | |
2306 | 2317 | | |
2307 | 2318 | | |
| |||
2310 | 2321 | | |
2311 | 2322 | | |
2312 | 2323 | | |
| 2324 | + | |
| 2325 | + | |
| 2326 | + | |
2313 | 2327 | | |
2314 | 2328 | | |
2315 | 2329 | | |
| |||
0 commit comments