On Mon, Aug 17, 2026 at 5:46 PM Philippe Mathieu-Daudé
<[email protected]> wrote:
> >> -/* Unblock cpu */
> >> +/**
> >> + * qemu_cpu_kick_self - Force vCPU to re-enter to its inner main loop
> >> + *
> >> + * Signal the current vCPU thread to exit any blocking operations and
> >> + * re-enter its inner execution loop to process pending requests,
> >> + * possibly returning to its outer execution loop.
> >> + *
> >> + * Must be called from within the vCPU thread itself.
> >> + */
> >
> > Neither is correct.
Right, the first of the two in "neither" referred to the existing
"unblock CPU" comment (it's clearly unblocked if it's calling
qemu_cpu_kick_self!). The requirement to call from the vCPU thread is
correct, sorry about the imprecise reference.
> I got confused by this comment in accel/mshv/mshv-all.c and interpreted
> too much:
Yes, that code is broken and there is a patch queued to make it go away.
Paolo
> /*
> * The signal handler is triggered when QEMU's main thread receives a
> SIG_IPI
> * (SIGUSR1). This signal causes the current CPU thread to be kicked,
> forcing a
> * VM exit on the CPU. The VM exit generates an exit reason that breaks
> the loop
> * (see mshv_cpu_exec). If the exit is due to a Ctrl+A+x command, the
> system
> * will shut down. For other cases, the system will continue running.
> */
> static void sa_ipi_handler(int sig)
> {
> /* TODO: call IOCTL to set_immediate_exit, once implemented. */
>
> qemu_cpu_kick_self();
> }
> >
> > I'd rather have something like:
> >
> > diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
> > index 83cbd120a84..e5d068e341f 100644
> > --- a/accel/kvm/kvm-all.c
> > +++ b/accel/kvm/kvm-all.c
> > @@ -3292,7 +3292,7 @@ static void kvm_cpu_kick_self(void)
> > if (kvm_immediate_exit) {
> > kvm_cpu_kick(current_cpu);
> > } else {
> > - qemu_cpu_kick_self();
> > + cpus_kick_thread(current_cpu);
> > }
> > }
> >
> > diff --git a/target/i386/nvmm/nvmm-all.c b/target/i386/nvmm/nvmm-all.c
> > index 8a1af35ed32..b9b1ee39850 100644
> > --- a/target/i386/nvmm/nvmm-all.c
> > +++ b/target/i386/nvmm/nvmm-all.c
> > @@ -753,7 +753,7 @@ nvmm_vcpu_loop(CPUState *cpu)
> > #if NVMM_USER_VERSION >= 2
> > nvmm_vcpu_stop(vcpu);
> > #else
> > - qemu_cpu_kick_self();
> > + cpus_kick_thread(current_cpu);
> > #endif
> > }
> >
> > and get rid of qemu_cpu_kick_self() completely.
>
> OK I'll take that route.
>