Patch "timers: Reinitialize per cpu bases on hotplug" has been added to the 4.14-stable tree
This is a note to let you know that I've just added the patch titled
timers: Reinitialize per cpu bases on hotplug
to the 4.14-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
timers-reinitialize-per-cpu-bases-on-hotplug.patch
and it can be found in the queue-4.14 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
26456f87aca7157c057de65c9414b37f1ab881d1Mon Sep 17 00:00:00 2001
From: Thomas Gleixner <[email protected]>
Date: Wed, 27 Dec 2017 21:37:25 +0100
Subject: timers: Reinitialize per cpu bases on hotplug
From: Thomas Gleixner <[email protected]>
commit 26456f87aca7157c057de65c9414b37f1ab881d1 upstream.
The timer wheel bases are not (re)initialized on CPU hotplug. That leaves them with a potentially stale clk and next_expiry valuem, which can cause trouble then the CPU is plugged.
Add a prepare callback which forwards the clock, sets next_expiry to far in the future and reset the control flags to a known state.
Set base->must_forward_clk so the first timer which is queued will try to forward the clock to current jiffies.
--- include/linux/cpuhotplug.h | 2 +- include/linux/timer.h | 4 +++- kernel/cpu.c | 4 ++-- kernel/time/timer.c | 15 +++++++++++++++ 4 files changed, 21 insertions(+), 4 deletions(-)
include/linux/cpuhotplug.h +1 -1
@@ -86,7 +86,7 @@ enum cpuhp_state {CPUHP_MM_ZSWP_POOL_PREPARE ,CPUHP_KVM_PPC_BOOK3S_PREPARE ,CPUHP_ZCOMP_PREPARE , -CPUHP_TIMERS_DEAD , +CPUHP_TIMERS_PREPARE ,CPUHP_MIPS_SOC_PREPARE ,CPUHP_BP_PREPARE_DYN , CPUHP_BP_PREPARE_DYN_END = CPUHP_BP_PREPARE_DYN + 20,
include/linux/timer.h +3 -1
@@ -246,9 +246,11 @@ unsigned long round_jiffies_up(unsignedunsigned long round_jiffies_up_relative (unsigned long j);#ifdef CONFIG_HOTPLUG_CPU +int timers_prepare_cpu (unsigned int cpu);int timers_dead_cpu (unsigned int cpu);#else -#define timers_dead_cpu NULL +#define timers_prepare_cpu NULL +#define timers_dead_cpu NULL#endif #endif
kernel/cpu.c +2 -2
@@ -1277,9 +1277,9 @@ static struct cpuhp_step cpuhp_bp_states* before blk_mq_queue_reinit_notify() from notify_dead(), * otherwise a RCU stall occurs. */ - [CPUHP_TIMERS_DEAD] = { + [CPUHP_TIMERS_PREPARE] = { .name = "timers:dead", - .startup.single = NULL, + .startup.single = timers_prepare_cpu, .teardown.single = timers_dead_cpu, },/* Kicks the plugged cpu into life */
kernel/time/timer.c +15 -0
@@ -1801,6 +1801,21 @@ static void migrate_timer_list(struct ti } } +int timers_prepare_cpu (unsigned int cpu) +{ +struct timer_base *base; +int b; + +for (b =0 ; b <NR_BASES ; b++) { + base =per_cpu_ptr (&timer_bases[b], cpu); + base->clk = jiffies; + base->next_expiry = base->clk +NEXT_TIMER_MAX_DELTA ; + base->is_idle = false; + base->must_forward_clk = true; + } +return 0 ; +} +int timers_dead_cpu (unsigned int cpu) {struct timer_base *old_base;
Patches currently in stable-queue which might be from [email protected] are
queue-4.14/x86-mm-pti-allow-nx-poison-to-be-set-in-p4d-pgd.patch queue-4.14/nohz-prevent-a-timer-interrupt-storm-in-tick_nohz_stop_sched_tick.patch queue-4.14/x86-dumpstack-indicate-in-oops-whether-pti-is-configured-and-enabled.patch queue-4.14/x86-mm-remove-preempt_disable-enable-from-__native_flush_tlb.patch queue-4.14/x86-mm-clarify-the-whole-asid-kernel-pcid-user-pcid-naming.patch queue-4.14/x86-ldt-plug-memory-leak-in-error-path.patch queue-4.14/x86-mm-abstract-switching-cr3.patch queue-4.14/x86-mm-optimize-restore_cr3.patch queue-4.14/x86-mm-pti-force-entry-through-trampoline-when-pti-active.patch queue-4.14/timers-invoke-timer_start_debug-where-it-makes-sense.patch queue-4.14/revert-mlx5-move-affinity-hints-assignments-to-generic-code.patch queue-4.14/x86-entry-align-entry-text-section-to-pmd-boundary.patch queue-4.14/x86-mm-64-make-a-full-pgd-entry-size-hole-in-the-memory-map.patch queue-4.14/x86-cpu_entry_area-add-debugstore-entries-to-cpu_entry_area.patch queue-4.14/x86-mm-pti-share-entry-text-pmd.patch queue-4.14/x86-ldt-make-the-ldt-mapping-ro.patch queue-4.14/x86-mm-dump_pagetables-check-user-space-page-table-for-wx-pages.patch queue-4.14/x86-pti-map-the-vsyscall-page-if-needed.patch queue-4.14/x86-mm-pti-disable-global-pages-if-page_table_isolation-y.patch queue-4.14/x86-mm-dump_pagetables-allow-dumping-current-pagetables.patch queue-4.14/x86-mm-pti-add-infrastructure-for-page-table-isolation.patch queue-4.14/x86-cpufeatures-add-x86_bug_cpu_insecure.patch queue-4.14/x86-mm-use-fix-pcid-to-optimize-user-kernel-switches.patch queue-4.14/x86-mm-use-invpcid-for-__native_flush_tlb_single.patch queue-4.14/x86-mm-pti-prepare-the-x86-entry-assembly-code-for-entry-exit-cr3-switching.patch queue-4.14/x86-mm-allow-flushing-for-future-asid-switches.patch queue-4.14/x86-mm-pti-add-kconfig.patch queue-4.14/x86-mm-pti-add-mapping-helper-functions.patch queue-4.14/x86-mm-pti-map-espfix-into-user-space.patch queue-4.14/x86-ldt-make-ldt-pgtable-free-conditional.patch queue-4.14/x86-smpboot-remove-stale-tlb-flush-invocations.patch queue-4.14/timers-use-deferrable-base-independent-of-base-nohz_active.patch queue-4.14/x86-mm-pti-share-cpu_entry_area-with-user-space-page-tables.patch queue-4.14/x86-mm-pti-add-functions-to-clone-kernel-pmds.patch queue-4.14/x86-pti-add-the-pti-cmdline-option-and-documentation.patch queue-4.14/timers-reinitialize-per-cpu-bases-on-hotplug.patch queue-4.14/x86-events-intel-ds-map-debug-buffers-in-cpu_entry_area.patch queue-4.14/x86-mm-pti-allocate-a-separate-user-pgd.patch queue-4.14/x86-pti-put-the-ldt-in-its-own-pgd-if-pti-is-on.patch queue-4.14/x86-mm-pti-populate-user-pgd.patch queue-4.14/x86-32-fix-kexec-with-stack-canary-config_cc_stackprotector.patch queue-4.14/x86-espfix-64-fix-espfix-double-fault-handling-on-5-level-systems.patch queue-4.14/x86-mm-dump_pagetables-add-page-table-directory-to-the-debugfs-vfs-hierarchy.patch