summaryrefslogtreecommitdiff
path: root/scripts/Makefile.thinlto
diff options
context:
space:
mode:
authorSungho Bae <baver.bae@lge.com>2026-06-04 03:37:57 +0900
committerMichael S. Tsirkin <mst@redhat.com>2026-09-04 17:06:04 -0400
commit8911e7822fee1fc5d5692051b745ebefa5b688f1 (patch)
tree8d681c385840b298a5f61a436c73f8de7871a93e /scripts/Makefile.thinlto
parent8d2b35741ec0b9546f2e309e4804c95984f30d6c (diff)
downloadlinux-next-8911e7822fee1fc5d5692051b745ebefa5b688f1.tar.gz
linux-next-8911e7822fee1fc5d5692051b745ebefa5b688f1.zip
virtio_console: fix race between hvc put_chars and virtqueue teardown on freeze
With no_console_suspend enabled, hvc console output can continue while virtio_console is freezing. In that window, put_chars can still enqueue buffers to the output virtqueue while virtcons_freeze is tearing queues down, triggering a BUG_ON in virtqueue_detach_unused_buf_split: BUG_ON(vq->vq.num_free != vq->split.vring.num) Add a pm_freezing flag to ports_device. Set it via smp_store_release() at the start of virtcons_freeze(); put_chars() and __send_to_port() drop output while the flag is set, checked via smp_load_acquire(). The check in __send_to_port() is placed under outvq_lock, making it atomic with remove_port_data() which also acquires outvq_lock. Once remove_port_data() returns for a given port, no concurrent __send_to_port() can add buffers before remove_vqs() tears down the vq. After setting pm_freezing, acquire and release outvq_lock for each port (protected by ports_lock to prevent list manipulation races) before calling virtio_reset_device(). A TX thread that already passed the pm_freezing check may still hold outvq_lock while spinning for host acknowledgment; the drain loop ensures all such threads have completed before the device is reset. Clear pm_freezing in virtcons_restore() only after all port->out_vq pointers have been reassigned to the newly allocated virtqueues, preventing TX paths from dereferencing freed vqs during restore. Link: https://sashiko.dev/#/patchset/20260519162242.7324-1-baver.bae%40gmail.com Signed-off-by: Sungho Bae <baver.bae@lge.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Message-ID: <20260603183757.21587-5-baver.bae@gmail.com>
Diffstat (limited to 'scripts/Makefile.thinlto')
0 files changed, 0 insertions, 0 deletions