Thanks Alex and Wesley for the bug report, I went through the proposed patche: - https://gitlab.com/qemu-project/qemu/-/commit/86a637e4 (followed-up by https://gitlab.com/qemu-project/qemu/-/commit/9352f80c that modifies the coroutine pool limit)
The general idea of the proposed fix is to reduce the per-thread coroutine cache pool size and create a glocal cache pool with a size limit that respects the vm.max_map_count limit for the QEMU process. With this approach, the process coroutine cache size is controlled and has lot less chance to go over the limit and cause the VMA mappings creation fail due to the limit vm.max_map_count. 1) Thread-local caches are capped. Each thread keeps at most two batches, with each batch capped at 128 coroutines. This prevents threads from indefinitely retaining large private caches. 2) Threads share a global pool. When a local cache runs low, the thread takes a batch from the global pool; when its cache has too many, it can return a batch. Batching reduces lock traffic while keeping reuse fast. 3) The global pool gets a hard limit. QEMU reads Linux’s vm.max_map_count and set the cache limit to half of the remaining free space (5000 and vm.max_map_count). 5000 is statically fixed as the map_max_count reserved for other usage. Excess completed coroutines are freed. If the bounded pools have no room, QEMU releases the coroutine and its stack instead of retaining those mappings. The change is well isolated to 1 file, has been merged upstream in 2024 and has no follow-up since then for the last 2 years (the file is stable and has only 1 minor commit for the last 2 years after this patch was introduced). Based on that, I think it is safe to SRU this fix to Noble with appropriate integration testing and extensive source code analysis. -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/2168803 Title: QEMU 8.2.2 guests crash by exhausting vm.max_map_count with coroutines To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/qemu/+bug/2168803/+subscriptions -- ubuntu-bugs mailing list [email protected] https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
