diff options
| author | Chuyi Zhou <zhouchuyi@bytedance.com> | 2026-07-09 20:29:24 +0800 |
|---|---|---|
| committer | Thomas Gleixner <tglx@kernel.org> | 2026-07-16 09:24:55 +0200 |
| commit | 9f483e5b2f1263f7fad20bcc5b09d01d2da57f1f (patch) | |
| tree | 5b3cabef30c391fb95c8e556a6674fa524c19807 /tools/perf/scripts/python/bin | |
| parent | 9a560af15fd31b3b93235b1584a2509445a17963 (diff) | |
smp: Alloc percpu csd data in smpcfd_prepare_cpu() only once
smp_call_function_many_cond() uses per-CPU CSD objects when queueing
callbacks to remote CPUs, and the wait path later dereferences those CSDs
from csd_lock_wait().
Making the wait path preemptible allows the initiating task to be
preempted or migrated before it waits for completion. A target CPU can be
offlined in that window. If smpcfd_dead_cpu() frees the target CPU's
per-CPU CSD storage, csd_lock_wait() can later dereference freed memory.
One way to protect the CSD storage is to free it via RCU or after a
synchronization step in the CPU offline path, but that would add
unnecessary complexity and can delay CPU shutdown.
Allocate the per-CPU CSD storage the first time a CPU comes up and keep
it allocated when the CPU is offlined. This allows csd_lock_wait() to
access the CSD even when the target CPU is offlined after preemption is
re-enabled and before the wait is invoked.
Signed-off-by: Chuyi Zhou <zhouchuyi@bytedance.com>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Tested-by: Paul E. McKenney <paulmck@kernel.org>
Reviewed-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Acked-by: Muchun Song <muchun.song@linux.dev>
Link: https://patch.msgid.link/20260709122933.4021501-6-zhouchuyi@bytedance.com
Diffstat (limited to 'tools/perf/scripts/python/bin')
0 files changed, 0 insertions, 0 deletions
