Re: [PATCH 11/16] accel/kvm: Consistently return CPU halt state from process_async_events
Philippe Mathieu-Daudé <[email protected]>
| Newsgroups | org.nongnu.qemu-riscv,org.kernel.vger.kvm,org.nongnu.qemu-arm,org.nongnu.qemu-devel |
|---|---|
| Message-ID | <[email protected]> |
On 18/8/26 12:30, Paolo Bonzini wrote: > On Tue, Aug 18, 2026 at 11:24 AM Philippe Mathieu-Daudé > <[email protected]> wrote: >>> Your patch is correct because, even if cpu_thread_is_idle() sees cpu- >>> >halted == false, the flag could become true during >>> process_queued_cpu_work() because it releases the BQL. >>> >>> However, I think the better fix is to remove the return code, and check >>> cpu->halted in kvm_cpu_exec(). >> >> Looking at it, even better would be to move *process_async_events() >> from inner loop to outer loop for all accelerators. For HW accels it >> seems quite trivial; for TCG I need to figure if it is safe to call >> icount_prepare_for_run() with the BQL taken, due to the replay_mutex >> uses -- here the win is cpu_handle_halt() ends restricted to system >> and we can remove the odd EXCP_HLT handling in user emulation. > > Makes sense, but probably it would be a series of its own. :) Good, right. (FYI the motivation behind these cleanups and documentation is to get hybrid-acceleration, so a consistent vcpu_thread_routine between accelerators: https://lore.kernel.org/qemu-devel/[email protected]/)