From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gleb Natapov Subject: [PATCH] Allow to call vm_stop from vcpu thread Date: Thu, 15 Jan 2009 15:23:27 +0200 Message-ID: <20090115132327.GB11299@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii To: kvm@vger.kernel.org Return-path: 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 Content-Disposition: inline Sender: kvm-owner@vger.kernel.org List-ID: Signed-off-by: Gleb Natapov 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; } -- Gleb.