From: Greg Kroah-Hartman Date: Mon, 7 Feb 2022 08:25:37 +0000 (+0100) Subject: 5.4-stable patches X-Git-Tag: v4.9.300~9 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e7d2a0a3dce74b4f2f60ce91a37c79825467c520;p=thirdparty%2Fkernel%2Fstable-queue.git 5.4-stable patches added patches: cgroup-cpuset-fix-suspicious-rcu-usage-lockdep-warning.patch --- diff --git a/queue-5.4/cgroup-cpuset-fix-suspicious-rcu-usage-lockdep-warning.patch b/queue-5.4/cgroup-cpuset-fix-suspicious-rcu-usage-lockdep-warning.patch new file mode 100644 index 00000000000..52408e2467f --- /dev/null +++ b/queue-5.4/cgroup-cpuset-fix-suspicious-rcu-usage-lockdep-warning.patch @@ -0,0 +1,60 @@ +From 2bdfd2825c9662463371e6691b1a794e97fa36b4 Mon Sep 17 00:00:00 2001 +From: Waiman Long +Date: Wed, 2 Feb 2022 22:31:03 -0500 +Subject: cgroup/cpuset: Fix "suspicious RCU usage" lockdep warning + +From: Waiman Long + +commit 2bdfd2825c9662463371e6691b1a794e97fa36b4 upstream. + +It was found that a "suspicious RCU usage" lockdep warning was issued +with the rcu_read_lock() call in update_sibling_cpumasks(). It is +because the update_cpumasks_hier() function may sleep. So we have +to release the RCU lock, call update_cpumasks_hier() and reacquire +it afterward. + +Also add a percpu_rwsem_assert_held() in update_sibling_cpumasks() +instead of stating that in the comment. + +Fixes: 4716909cc5c5 ("cpuset: Track cpusets that use parent's effective_cpus") +Signed-off-by: Waiman Long +Tested-by: Phil Auld +Reviewed-by: Phil Auld +Signed-off-by: Tejun Heo +Signed-off-by: Greg Kroah-Hartman +--- + kernel/cgroup/cpuset.c | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +--- a/kernel/cgroup/cpuset.c ++++ b/kernel/cgroup/cpuset.c +@@ -1473,10 +1473,15 @@ static void update_sibling_cpumasks(stru + struct cpuset *sibling; + struct cgroup_subsys_state *pos_css; + ++ percpu_rwsem_assert_held(&cpuset_rwsem); ++ + /* + * Check all its siblings and call update_cpumasks_hier() + * if their use_parent_ecpus flag is set in order for them + * to use the right effective_cpus value. ++ * ++ * The update_cpumasks_hier() function may sleep. So we have to ++ * release the RCU read lock before calling it. + */ + rcu_read_lock(); + cpuset_for_each_child(sibling, pos_css, parent) { +@@ -1484,8 +1489,13 @@ static void update_sibling_cpumasks(stru + continue; + if (!sibling->use_parent_ecpus) + continue; ++ if (!css_tryget_online(&sibling->css)) ++ continue; + ++ rcu_read_unlock(); + update_cpumasks_hier(sibling, tmp); ++ rcu_read_lock(); ++ css_put(&sibling->css); + } + rcu_read_unlock(); + } diff --git a/queue-5.4/series b/queue-5.4/series index 87816585356..101770e6b2a 100644 --- a/queue-5.4/series +++ b/queue-5.4/series @@ -41,3 +41,4 @@ rtc-cmos-evaluate-century-appropriate.patch edac-altera-fix-deferred-probing.patch edac-xgene-fix-deferred-probing.patch ext4-fix-error-handling-in-ext4_restore_inline_data.patch +cgroup-cpuset-fix-suspicious-rcu-usage-lockdep-warning.patch