From: Ridong Chen <ridong.chen@linux.dev>
To: "Waiman Long" <longman@redhat.com>, "Tejun Heo" <tj@kernel.org>,
"Johannes Weiner" <hannes@cmpxchg.org>,
"Michal Koutný" <mkoutny@suse.com>,
"Jonathan Corbet" <corbet@lwn.net>,
"Shuah Khan" <skhan@linuxfoundation.org>,
"Randy Dunlap" <rdunlap@infradead.org>,
"Ingo Molnar" <mingo@redhat.com>,
"Peter Zijlstra" <peterz@infradead.org>,
"Juri Lelli" <juri.lelli@redhat.com>,
"Vincent Guittot" <vincent.guittot@linaro.org>,
"Dietmar Eggemann" <dietmar.eggemann@arm.com>,
"Steven Rostedt" <rostedt@goodmis.org>,
"Ben Segall" <bsegall@google.com>, "Mel Gorman" <mgorman@suse.de>,
"Valentin Schneider" <vschneid@redhat.com>,
"K Prateek Nayak" <kprateek.nayak@amd.com>,
"Anna-Maria Behnsen" <anna-maria@linutronix.de>,
"Frederic Weisbecker" <frederic@kernel.org>,
"Thomas Gleixner" <tglx@kernel.org>
Cc: cgroups@vger.kernel.org, linux-doc@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
Guopeng Zhang <guopeng.zhang@linux.dev>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Subject: Re: [PATCH-next v2 2/3] sched/isolation: Forbid the boot CPU from being domain isolated
Date: Tue, 24 Nov 2026 11:27:43 +0800 [thread overview]
Message-ID: <7dbec7f4-35d0-4351-a61d-ab0a649c41d6@linux.dev> (raw)
In-Reply-To: <20261123041209.382726-3-longman@redhat.com>
On 11/23/2026 12:12 PM, Waiman Long wrote:
> It is reported that with CONFIG_CPUSETS=n, a kernel booted with
> isolcpus=domain,0 hits the BUG() in select_fallback_rq() during boot
> [1]. At boot time, cpu 0 is the only CPU online and an unbound kworker
> cannot be run on a domain isolated CPU causing kernel panic.
>
> Sashiko also reports that domain isolating the boot CPU can break system
> suspend and trigger a BUG_ON() [2]. So it is problematic if the boot CPU
> is domain isolated.
>
> There may be other kernel subsystems that have problem if the boot CPU
> is domain isolated as most of them won't take into account the fact that
> boot CPU is currently allowed to be domain isolated. Given the fact
> that the boot CPU is likely to be disallowed from the nohz_full list,
> it makes sense that we should not allow the boot CPU from being set in
> the isolcpus boot parameter as well. This will also avoid the kind of
> problems listed above.
>
> Do that by clearing the boot CPU from the isolcpus range when it is
> specified in the boot command line. A warning may also be printed when
> that happens. If the users want to have boot CPU in the managed_irq
> or nohz isolation list, a standalone isolcpus boot parameter will be
> needed instead of combining domain and other flags in the same isolcpus
> boot parameter.
>
> This is indeed a change in behavior which is customer visible. So the
> kernel-paremeters.txt is updated to mention the fact that boot CPU
> cannot be isolated.
>
> [1] https://lore.kernel.org/lkml/20261117144817.265109-1-mathieu.desnoyers@efficios.com
> [2] https://sashiko.dev/#/patchset/20261108180849.1268263-1-longman%40redhat.com
>
> Signed-off-by: Waiman Long <longman@redhat.com>
This fixes a boot-time BUG(), so it seems worth a Fixes?
> ---
> .../admin-guide/kernel-parameters.txt | 7 +++---
> kernel/sched/isolation.c | 22 +++++++++++++++----
> 2 files changed, 22 insertions(+), 7 deletions(-)
>
> diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
> index 930cee4de79a..1c8bf3583b0b 100644
> --- a/Documentation/admin-guide/kernel-parameters.txt
> +++ b/Documentation/admin-guide/kernel-parameters.txt
> @@ -2954,11 +2954,12 @@ Kernel parameters
>
> You can move a process onto or off an "isolated" CPU via
> the CPU affinity syscalls or cpuset.
> - <cpu number> begins at 0 and the maximum value is
> - "number of CPUs in system - 1".
> + <cpu number> begins at 0 and the maximum value
> + is "number of CPUs in system - 1". However boot
> + CPU (cpu 0) cannot be domain isolated as it
> + may cause problem with some kernel subsystems.
>
> managed_irq
> -
> Isolate from being targeted by managed interrupts
> which have an interrupt mask containing isolated
> CPUs. The affinity of managed interrupts is
> diff --git a/kernel/sched/isolation.c b/kernel/sched/isolation.c
> index c0c8b8862cbd..de8152351450 100644
> --- a/kernel/sched/isolation.c
> +++ b/kernel/sched/isolation.c
> @@ -231,6 +231,7 @@ static int __init housekeeping_setup(char *str, unsigned long flags)
> {
> cpumask_var_t non_housekeeping_mask, housekeeping_staging;
> unsigned int first_cpu;
> + int boot_cpu = smp_processor_id();
> int err = 0;
>
> if ((flags & HK_FLAG_KERNEL_NOISE) && !(housekeeping.flags & HK_FLAG_KERNEL_NOISE)) {
> @@ -253,12 +254,25 @@ static int __init housekeeping_setup(char *str, unsigned long flags)
>
> first_cpu = cpumask_first_and(cpu_present_mask, housekeeping_staging);
> if (first_cpu >= nr_cpu_ids || first_cpu >= setup_max_cpus) {
> - __cpumask_set_cpu(smp_processor_id(), housekeeping_staging);
> - __cpumask_clear_cpu(smp_processor_id(), non_housekeeping_mask);
> + __cpumask_set_cpu(boot_cpu, housekeeping_staging);
> + __cpumask_clear_cpu(boot_cpu, non_housekeeping_mask);
> if (!housekeeping.flags) {
> - pr_warn("Housekeeping: must include one present CPU, "
> - "using boot CPU:%d\n", smp_processor_id());
> + pr_warn("Housekeeping: must include one present CPU, using boot CPU:%d\n",
> + boot_cpu);
> }
> + } else if ((flags & HK_FLAG_DOMAIN) &&
> + cpumask_test_cpu(boot_cpu, non_housekeeping_mask)) {
> + /*
> + * If the same isolcpus boot parameter covers both domain and
> + * managed_irq/nohz, the boot CPU will also be removed from the
> + * managed_irq/nohz isolation list. Users have to use a separate
> + * isolcpus boot parameter for them if they want to include the
> + * boot CPU.
> + */
> + pr_warn("Housekeeping: Boot CPU must not be domain isolated, clearing %d from isolcpus range\n",
> + boot_cpu);
> + __cpumask_set_cpu(boot_cpu, housekeeping_staging);
> + __cpumask_clear_cpu(boot_cpu, non_housekeeping_mask);
> }
>
> if (cpumask_empty(non_housekeeping_mask))
The code change itself looks good to me.
Reviewed-by: Ridong Chen <ridong.chen@linux.dev>
Thanks.
--
Best regards
Ridong
next prev parent reply other threads:[~2026-11-24 3:27 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-23 4:12 [PATCH-next v2 0/3] Skip boot CPU or don't allow it from being used in isolcpus and isolated partitions Waiman Long
2026-11-23 4:12 ` [PATCH-next v2 1/3] tick/sched: Make tick_nohz_full_mask and HK_TYPE_KERNEL_NOISE cpumask consistent Waiman Long
2026-11-23 21:24 ` Frederic Weisbecker
2026-11-24 2:47 ` Waiman Long
2026-11-24 2:56 ` Ridong Chen
2026-11-24 3:05 ` Guopeng Zhang
2026-11-23 4:12 ` [PATCH-next v2 2/3] sched/isolation: Forbid the boot CPU from being domain isolated Waiman Long
2026-11-23 21:34 ` Frederic Weisbecker
2026-11-24 3:09 ` Guopeng Zhang
2026-11-24 3:27 ` Ridong Chen [this message]
2026-11-23 4:12 ` [PATCH-next v2 3/3] cgroup/cpuset: Disallow CPU 0 from being used in isolated partition Waiman Long
2026-11-23 21:38 ` Frederic Weisbecker
2026-11-24 3:28 ` Guopeng Zhang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7dbec7f4-35d0-4351-a61d-ab0a649c41d6@linux.dev \
--to=ridong.chen@linux.dev \
--cc=anna-maria@linutronix.de \
--cc=bsegall@google.com \
--cc=cgroups@vger.kernel.org \
--cc=corbet@lwn.net \
--cc=dietmar.eggemann@arm.com \
--cc=frederic@kernel.org \
--cc=guopeng.zhang@linux.dev \
--cc=hannes@cmpxchg.org \
--cc=juri.lelli@redhat.com \
--cc=kprateek.nayak@amd.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=longman@redhat.com \
--cc=mathieu.desnoyers@efficios.com \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=mkoutny@suse.com \
--cc=peterz@infradead.org \
--cc=rdunlap@infradead.org \
--cc=rostedt@goodmis.org \
--cc=skhan@linuxfoundation.org \
--cc=tglx@kernel.org \
--cc=tj@kernel.org \
--cc=vincent.guittot@linaro.org \
--cc=vschneid@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox