> From: Nicholas Piggin <npig...@gmail.com> > Sent: Monday, May 20, 2024 9:04 AM > > On Mon May 20, 2024 at 7:06 AM AEST, Salil Mehta wrote: > > KVM vCPU creation is done once during the vCPU realization when Qemu > > vCPU thread is spawned. This is common to all the architectures as of now. > > > > Hot-unplug of vCPU results in destruction of the vCPU object in QOM > > but the corresponding KVM vCPU object in the Host KVM is not destroyed > > as KVM doesn't support vCPU removal. Therefore, its representative KVM > > vCPU object/context in Qemu is parked. > > > > Refactor architecture common logic so that some APIs could be reused > > by vCPU Hotplug code of some architectures likes ARM, Loongson etc. > > Update new/old APIs with trace events instead of DPRINTF. No functional > change is intended here. >
[...] void kvm_park_vcpu(CPUState *cpu) > > +{ > > + struct KVMParkedVcpu *vcpu; > > + > > + trace_kvm_park_vcpu(cpu->cpu_index, kvm_arch_vcpu_id(cpu)); > > + > > + vcpu = g_malloc0(sizeof(*vcpu)); > > + vcpu->vcpu_id = kvm_arch_vcpu_id(cpu); > > + vcpu->kvm_fd = cpu->kvm_fd; > > + QLIST_INSERT_HEAD(&kvm_state->kvm_parked_vcpus, vcpu, node); } > > Could you move kvm_get_vcpu up here so it's next to kvm_park_vcpu, and > then you don't need to forward declare it. Call it kvm_unpark_vcpu() for > symmetry with park. sorry I missed this part earlier and Phil also suggested the same. Yes, I can. Thanks Salil. > > Thanks, > Nick