From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54497) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aOT0o-0003Mu-NX for qemu-devel@nongnu.org; Wed, 27 Jan 2016 11:32:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aOT0k-00071z-Hc for qemu-devel@nongnu.org; Wed, 27 Jan 2016 11:32:06 -0500 Received: from e34.co.us.ibm.com ([32.97.110.152]:58793) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aOT0k-00071h-8d for qemu-devel@nongnu.org; Wed, 27 Jan 2016 11:32:02 -0500 Received: from localhost by e34.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 27 Jan 2016 09:31:58 -0700 References: <1452236119-24452-1-git-send-email-bharata@linux.vnet.ibm.com> <1452236119-24452-6-git-send-email-bharata@linux.vnet.ibm.com> From: Matthew Rosato Message-ID: <56A8F0ED.4020400@linux.vnet.ibm.com> Date: Wed, 27 Jan 2016 11:31:41 -0500 MIME-Version: 1.0 In-Reply-To: <1452236119-24452-6-git-send-email-bharata@linux.vnet.ibm.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v6 05/11] cpu: Reclaim vCPU objects List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Bharata B Rao , qemu-devel@nongnu.org Cc: Zhu Guihua , ehabkost@redhat.com, imammedo@redhat.com, aik@ozlabs.ru, agraf@suse.de, mdroth@linux.vnet.ibm.com, Gu Zheng , qemu-ppc@nongnu.org, tyreld@linux.vnet.ibm.com, nfont@linux.vnet.ibm.com, Chen Fan , pbonzini@redhat.com, afaerber@suse.de, david@gibson.dropbear.id.au On 01/08/2016 01:55 AM, Bharata B Rao wrote: > From: Gu Zheng > > In order to deal well with the kvm vcpus (which can not be removed without any > protection), we do not close KVM vcpu fd, just record and mark it as stopped > into a list, so that we can reuse it for the appending cpu hot-add request if > possible. It is also the approach that kvm guys suggested: > https://www.mail-archive.com/kvm@vger.kernel.org/msg102839.html > > Signed-off-by: Chen Fan > Signed-off-by: Gu Zheng > Signed-off-by: Zhu Guihua > Signed-off-by: Bharata B Rao > [- Explicit CPU_REMOVE() from qemu_kvm/tcg_destroy_vcpu() > isn't needed as it is done from cpu_exec_exit() > - Use iothread mutex instead of global mutex during > destroy > - Don't cleanup vCPU object from vCPU thread context > but leave it to the callers (device_add/device_del)] > --- > cpus.c | 38 +++++++++++++++++++++++++++++++++++ > include/qom/cpu.h | 10 +++++++++ > include/sysemu/kvm.h | 1 + > kvm-all.c | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++- > kvm-stub.c | 5 +++++ > 5 files changed, 110 insertions(+), 1 deletion(-) > > diff --git a/cpus.c b/cpus.c > index ea29584..12374af 100644 > --- a/cpus.c > +++ b/cpus.c > @@ -953,6 +953,18 @@ void async_run_on_cpu(CPUState *cpu, void (*func)(void *data), void *data) > qemu_cpu_kick(cpu); > } > > +static void qemu_kvm_destroy_vcpu(CPUState *cpu) > +{ > + if (kvm_destroy_vcpu(cpu) < 0) { > + error_report("kvm_destroy_vcpu failed.\n"); FYI, checkpatch fails here -- no need for the newline. Matt