Skip to content

Commit ddc05e9

Browse files
oleg-nesterovopsiff
authored andcommitted
sched/isolation: Prevent boot crash when the boot CPU is nohz_full
Documentation/timers/no_hz.rst states that the "nohz_full=" mask must not include the boot CPU, which is no longer true after: 08ae95f ("nohz_full: Allow the boot CPU to be nohz_full"). However after: aae17eb ("workqueue: Avoid using isolated cpus' timers on queue_delayed_work") the kernel will crash at boot time in this case; housekeeping_any_cpu() returns an invalid CPU number until smp_init() brings the first housekeeping CPU up. Change housekeeping_any_cpu() to check the result of cpumask_any_and() and return smp_processor_id() in this case. This is just the simple and backportable workaround which fixes the symptom, but smp_processor_id() at boot time should be safe at least for type == HK_TYPE_TIMER, this more or less matches the tick_do_timer_boot_cpu logic. There is no worry about cpu_down(); tick_nohz_cpu_down() will not allow to offline tick_do_timer_cpu (the 1st online housekeeping CPU). [ Apply only documentation changes as commit which causes boot crash when boot CPU is nohz_full is not backported to stable kernels - Krishanth ] Reported-by: Chris von Recklinghausen <[email protected]> Signed-off-by: Oleg Nesterov <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> Reviewed-by: Phil Auld <[email protected]> Acked-by: Frederic Weisbecker <[email protected]> Link: https://lore.kernel.org/r/[email protected] Closes: https://lore.kernel.org/all/[email protected]/ Signed-off-by: Krishanth Jagaduri <[email protected]> [ strip out upstream commit and Fixes: so tools don't get confused that this commit actually does anything real - gregkh] Signed-off-by: Greg Kroah-Hartman <[email protected]> (cherry picked from commit 6e0447f)
1 parent 8d4576b commit ddc05e9

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

Documentation/timers/no_hz.rst

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,8 @@ adaptive-tick CPUs: At least one non-adaptive-tick CPU must remain
129129
online to handle timekeeping tasks in order to ensure that system
130130
calls like gettimeofday() returns accurate values on adaptive-tick CPUs.
131131
(This is not an issue for CONFIG_NO_HZ_IDLE=y because there are no running
132-
user processes to observe slight drifts in clock rate.) Therefore, the
133-
boot CPU is prohibited from entering adaptive-ticks mode. Specifying a
134-
"nohz_full=" mask that includes the boot CPU will result in a boot-time
135-
error message, and the boot CPU will be removed from the mask. Note that
136-
this means that your system must have at least two CPUs in order for
132+
user processes to observe slight drifts in clock rate.) Note that this
133+
means that your system must have at least two CPUs in order for
137134
CONFIG_NO_HZ_FULL=y to do anything for you.
138135

139136
Finally, adaptive-ticks CPUs must have their RCU callbacks offloaded.

0 commit comments

Comments
 (0)