TWx Linux Repository
Go to file
Koichiro Den a5cbbea145 hrtimers: Handle CPU state correctly on hotplug
commit 2f8dea1692eef2b7ba6a256246ed82c365fdc686 upstream.

Consider a scenario where a CPU transitions from CPUHP_ONLINE to halfway
through a CPU hotunplug down to CPUHP_HRTIMERS_PREPARE, and then back to
CPUHP_ONLINE:

Since hrtimers_prepare_cpu() does not run, cpu_base.hres_active remains set
to 1 throughout. However, during a CPU unplug operation, the tick and the
clockevents are shut down at CPUHP_AP_TICK_DYING. On return to the online
state, for instance CFS incorrectly assumes that the hrtick is already
active, and the chance of the clockevent device to transition to oneshot
mode is also lost forever for the CPU, unless it goes back to a lower state
than CPUHP_HRTIMERS_PREPARE once.

This round-trip reveals another issue; cpu_base.online is not set to 1
after the transition, which appears as a WARN_ON_ONCE in enqueue_hrtimer().

Aside of that, the bulk of the per CPU state is not reset either, which
means there are dangling pointers in the worst case.

Address this by adding a corresponding startup() callback, which resets the
stale per CPU state and sets the online flag.

[ tglx: Make the new callback unconditionally available, remove the online
  	modification in the prepare() callback and clear the remaining
  	state in the starting callback instead of the prepare callback ]

Fixes: 5c0930ccaad5 ("hrtimers: Push pending hrtimers away from outgoing CPU earlier")
Signed-off-by: Koichiro Den <koichiro.den@canonical.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/all/20241220134421.3809834-1-koichiro.den@canonical.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-01-23 17:21:17 +01:00
arch x86/asm: Make serialize() always_inline 2025-01-23 17:21:14 +01:00
block block, bfq: fix waker_bfqq UAF after bfq_split_bfqq() 2025-01-17 13:36:25 +01:00
certs
crypto crypto: ecc - Prevent ecc_digits_from_bytes from reading too many bytes 2025-01-09 13:31:52 +01:00
Documentation dt-bindings: display: adi,adv7533: Drop single lane support 2025-01-09 13:32:08 +01:00
drivers irqchip/gic-v3-its: Don't enable interrupts in its_irq_set_vcpu_affinity() 2025-01-23 17:21:17 +01:00
fs fs/proc: fix softlockup in __read_vmcore (part 2) 2025-01-23 17:21:16 +01:00
include hrtimers: Handle CPU state correctly on hotplug 2025-01-23 17:21:17 +01:00
init Compiler Attributes: disable __counted_by for clang < 19.1.3 2024-12-09 10:32:46 +01:00
io_uring io_uring/eventfd: ensure io_eventfd_signal() defers another RCU period 2025-01-17 13:36:24 +01:00
ipc ipc: fix memleak if msg_init_ns failed in create_ipc_ns 2024-12-09 10:32:54 +01:00
kernel hrtimers: Handle CPU state correctly on hotplug 2025-01-23 17:21:17 +01:00
lib seq_buf: Introduce DECLARE_SEQ_BUF and seq_buf_str() 2025-01-09 13:31:55 +01:00
LICENSES
mm filemap: avoid truncating 64-bit offset to 32 bits 2025-01-23 17:21:16 +01:00
net vsock: prevent null-ptr-deref in vsock_*[has_data|has_space] 2025-01-23 17:21:16 +01:00
rust rust: macros: fix documentation of the paste! macro 2024-12-09 10:32:25 +01:00
samples samples/bpf: Fix a resource leak 2024-12-14 20:00:03 +01:00
scripts scripts/sorttable: fix orc_sort_cmp() to maintain symmetry and transitivity 2025-01-09 13:32:07 +01:00
security selinux: ignore unknown extended permissions 2025-01-09 13:31:54 +01:00
sound ALSA: hda/realtek: Add support for Ayaneo System using CS35L41 HDA 2025-01-23 17:21:14 +01:00
tools selftests: mptcp: avoid spurious errors on disconnect 2025-01-23 17:21:15 +01:00
usr
virt KVM: Use dedicated mutex to protect kvm_usage_count to avoid deadlock 2024-10-04 16:29:47 +02:00
.clang-format
.cocciconfig
.get_maintainer.ignore
.gitattributes
.gitignore Remove *.orig pattern from .gitignore 2024-10-04 16:29:44 +02:00
.mailmap
.rustfmt.toml
COPYING
CREDITS
Kbuild
Kconfig
MAINTAINERS membarrier: riscv: Add full memory barrier in switch_mm() 2024-09-12 11:11:45 +02:00
Makefile Linux 6.6.73 2025-01-21 09:49:10 +01:00
README

Linux kernel
============

There are several guides for kernel developers and users. These guides can
be rendered in a number of formats, like HTML and PDF. Please read
Documentation/admin-guide/README.rst first.

In order to build the documentation, use ``make htmldocs`` or
``make pdfdocs``.  The formatted documentation can also be read online at:

    https://www.kernel.org/doc/html/latest/

There are various text files in the Documentation/ subdirectory,
several of them using the Restructured Text markup notation.

Please read the Documentation/process/changes.rst file, as it contains the
requirements for building and running the kernel, and information about
the problems which may result by upgrading your kernel.