summaryrefslogtreecommitdiff
path: root/scripts/basic
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2024-08-12 16:19:48 +0200
committerThomas Gleixner <tglx@kernel.org>2026-09-07 11:10:20 +0200
commit113a9796effe3376d2ec5aabcca1fef4fef4cd62 (patch)
tree74718e4b40f9b364c8286d37cd5e979a3438965a /scripts/basic
parentdf2908090cda368b01ff43709f51890076c56157 (diff)
downloadlinux-stable-113a9796effe3376d2ec5aabcca1fef4fef4cd62.tar.gz
linux-stable-113a9796effe3376d2ec5aabcca1fef4fef4cd62.zip
tick/broadcast: Plug clockevents replacement race
朱恺乾 reported and decoded the following race condition when a broadcast device is replaced: CPUA CPUB __tick_broadcast_oneshot_control() bc = tick_broadcast_device.evtdev; tick_install_broadcast_device(dev) clockevents_exchange_device(cur, dev) shutdown(cur); detach(cur); cur->handler = noop; tick_broadcast_device.evtdev = dev; tick_broadcast_set_event(bc, next_event); <- FAIL: arms a detached device. If the original broadcast device has a restricted interrupt affinity mask and the last CPU in that mask goes offline then the BUG() in tick_cleanup_dead_cpu() triggers because the clockevent device is not in detached state. The reason for this is that tick_install_broadcast_device() is not serialized vs. tick broadcast operations. The obvious cure is to serialize tick_install_broadcast_device() with tick_broadcast_lock against a concurrent tick broadcast operation. That requires to split clockevents_exchange_device() into two parts, one which does the exchange, shutdown and detach operation and the other which drops the module reference count. This is required because the module reference cannot be dropped while holding tick_broadcast_lock. Let clockevents_exchange_device() do both operations as before, but let the broadcast device code take the two step approach and do the device exchange under tick_broadcast_lock and drop the module reference count after releasing it. Fixes: f8381cba04ba ("[PATCH] tick-management: broadcast functionality") Reported-by: 朱恺乾 <zhukaiqian@xiaomi.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Thomas Gleixner <tglx@kernel.org> Reviewed-by: Bradley Morgan <brads@mainlining.org> Tested-by: 刘术高 <liushugao@xiaomi.com> Cc: stable@vger.kernel.org Link: https://patch.msgid.link/87cymdsu0r.ffs@tglx
Diffstat (limited to 'scripts/basic')
0 files changed, 0 insertions, 0 deletions