From patchwork Thu Jan 15 13:23:27 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gleb Natapov X-Patchwork-Id: 2467 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n0FDL6pu018645 for ; Thu, 15 Jan 2009 05:21:07 -0800 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754933AbZAONZE (ORCPT ); Thu, 15 Jan 2009 08:25:04 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1756504AbZAONZE (ORCPT ); Thu, 15 Jan 2009 08:25:04 -0500 Received: from mx2.redhat.com ([66.187.237.31]:38765 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754933AbZAONZC (ORCPT ); Thu, 15 Jan 2009 08:25:02 -0500 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n0FDP1Rv001634 for ; Thu, 15 Jan 2009 08:25:01 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n0FDP1Ao021896 for ; Thu, 15 Jan 2009 08:25:01 -0500 Received: from dhcp-1-237.tlv.redhat.com (dhcp-1-237.tlv.redhat.com [10.35.1.237]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n0FDP0kW032390 for ; Thu, 15 Jan 2009 08:25:01 -0500 Received: by dhcp-1-237.tlv.redhat.com (Postfix, from userid 587) id 07CE918D43A; Thu, 15 Jan 2009 15:23:28 +0200 (IST) Date: Thu, 15 Jan 2009 15:23:27 +0200 From: Gleb Natapov To: kvm@vger.kernel.org Subject: [PATCH] Allow to call vm_stop from vcpu thread Message-ID: <20090115132327.GB11299@redhat.com> MIME-Version: 1.0 Content-Disposition: inline X-Scanned-By: MIMEDefang 2.58 on 172.16.27.26 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Signed-off-by: Gleb Natapov --- Gleb. -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/qemu/qemu-kvm.c b/qemu/qemu-kvm.c index e4fba78..484a232 100644 --- a/qemu/qemu-kvm.c +++ b/qemu/qemu-kvm.c @@ -296,11 +296,15 @@ static void pause_all_threads(void) { CPUState *penv = first_cpu; - assert(!cpu_single_env); - while (penv) { - penv->kvm_cpu_state.stop = 1; - pthread_kill(penv->kvm_cpu_state.thread, SIG_IPI); + if (penv != cpu_single_env) { + penv->kvm_cpu_state.stop = 1; + pthread_kill(penv->kvm_cpu_state.thread, SIG_IPI); + } else { + penv->kvm_cpu_state.stop = 0; + penv->kvm_cpu_state.stopped = 1; + cpu_interrupt(penv, CPU_INTERRUPT_EXIT); + } penv = (CPUState *)penv->next_cpu; }