Re: [PATCH 02/16] cpus: Improve qemu_cpu_kick_self() docstring
Paolo Bonzini <[email protected]>
| Newsgroups | org.nongnu.qemu-arm,org.kernel.vger.kvm,org.nongnu.qemu-devel,org.nongnu.qemu-riscv |
|---|---|
| Message-ID | <[email protected]> |
On 8/13/26 20:16, Philippe Mathieu-Daudé wrote: > Be a bit more descriptive than "Unblock cpu" :) > > Signed-off-by: Philippe Mathieu-Daudé <[email protected]> > --- > include/system/cpus.h | 10 +++++++++- > 1 file changed, 9 insertions(+), 1 deletion(-) > > diff --git a/include/system/cpus.h b/include/system/cpus.h > index 508444ccf1c..ade13e068eb 100644 > --- a/include/system/cpus.h > +++ b/include/system/cpus.h > @@ -30,7 +30,15 @@ void resume_all_vcpus(void); > void pause_all_vcpus(void); > void cpu_stop_current(void); > > -/* 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. What it does is force the vCPU not to enter the accelerator, and immediately exit again to process events. This is only needed because KVM doesn't want you to process events because KVM allows you to do so. 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. Paolo