Add some pr_debug() statements to actions performed related to the cpuhp_offline_cb() call to aid debugging. Since rcu_nocb_cpu_offload() and rcu_nocb_cpu_deoffload() will print out some info text, there is no need to add pr_debug() statements for them.
Also update test_cpuset_prs.sh test script to enable printing of dynamic debug messages for the kernel/cgroup/cpuset.c file when loglevel is 7 (debug).
Signed-off-by: Waiman Long longman@redhat.com --- kernel/cgroup/cpuset.c | 18 +++++++++++++----- .../selftests/cgroup/test_cpuset_prs.sh | 7 +++++++ 2 files changed, 20 insertions(+), 5 deletions(-)
diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c index 489708f4e096..30632e4b5899 100644 --- a/kernel/cgroup/cpuset.c +++ b/kernel/cgroup/cpuset.c @@ -21,6 +21,7 @@ * License. See the file COPYING in the main directory of the Linux * distribution for more details. */ +#define pr_fmt(fmt) "cpuset: " fmt #include "cpuset-internal.h"
#include <linux/context_tracking.h> @@ -1406,10 +1407,13 @@ static int do_housekeeping_exclude_cpumask(void *arg __maybe_unused) if (tick_nohz_full_enabled()) { tick_nohz_full_update_cpus(icpus); for_each_cpu(cpu, isolcpus_update_state.cpus) { - if (cpumask_test_cpu(cpu, icpus)) + if (cpumask_test_cpu(cpu, icpus)) { + pr_debug("Add CPU %d to nohz_full\n", cpu); ct_cpu_track_user(cpu); - else + } else { + pr_debug("Remove CPU %d from nohz_full\n", cpu); ct_cpu_untrack_user(cpu); + } } } else { pr_warn_once("Full dynticks cannot be enabled without the nohz_full kernel boot parameter!\n"); @@ -1425,6 +1429,7 @@ static int do_housekeeping_exclude_cpumask(void *arg __maybe_unused) ret = rcu_nocb_cpu_offload(cpu); else ret = rcu_nocb_cpu_deoffload(cpu); + if (WARN_ON_ONCE(ret)) break; } @@ -1468,11 +1473,14 @@ static void update_isolation_cpumasks(void) * Without any change in the set of nohz_full CPUs, we don't really * need to use CPU hotplug for making change in HK cpumasks. */ - if (cpumask_empty(isolcpus_update_state.cpus)) + if (cpumask_empty(isolcpus_update_state.cpus)) { ret = do_housekeeping_exclude_cpumask(NULL); - else + } else { + pr_debug("cpuhp_offline_cb() called for CPUs %*pbl\n", + cpumask_pr_args(isolcpus_update_state.cpus)); ret = cpuhp_offline_cb(isolcpus_update_state.cpus, do_housekeeping_exclude_cpumask, NULL); + } /* * A errno value of -EPERM may be returned from cpuhp_offline_cb() if * any one of the CPUs in isolcpus_update_state.cpus can't be brought @@ -1481,7 +1489,7 @@ static void update_isolation_cpumasks(void) * isolated partition. */ if (ret == -EPERM) - pr_warn_once("cpuset: The boot CPU shouldn't be used for isolated partition\n"); + pr_warn_once("The boot CPU shouldn't be used for isolated partition\n"); else WARN_ON_ONCE(ret < 0);
diff --git a/tools/testing/selftests/cgroup/test_cpuset_prs.sh b/tools/testing/selftests/cgroup/test_cpuset_prs.sh index f61369be8bf6..43a12690775e 100755 --- a/tools/testing/selftests/cgroup/test_cpuset_prs.sh +++ b/tools/testing/selftests/cgroup/test_cpuset_prs.sh @@ -67,6 +67,13 @@ then echo Y > /sys/kernel/debug/sched/verbose fi
+# Enable dynamic debug messages for cpuset only +DYN_DEBUG=/sys/kernel/debug/dynamic_debug/control +[[ -f $DYN_DEBUG ]] && { + echo "-p" > $DYN_DEBUG + echo "file kernel/cgroup/cpuset.c +p" > $DYN_DEBUG +} + cd $CGROUP2 echo +cpuset > cgroup.subtree_control