From patchwork Mon Nov 1 12:55:51 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gleb Natapov X-Patchwork-Id: 294422 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oA1CuK0J003614 for ; Mon, 1 Nov 2010 12:56:20 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757553Ab0KAMz6 (ORCPT ); Mon, 1 Nov 2010 08:55:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:26151 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757501Ab0KAMz5 (ORCPT ); Mon, 1 Nov 2010 08:55:57 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id oA1CtrPx010207 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 1 Nov 2010 08:55:53 -0400 Received: from dhcp-1-237.tlv.redhat.com (dhcp-1-237.tlv.redhat.com [10.35.1.237]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id oA1CtqnE005996; Mon, 1 Nov 2010 08:55:53 -0400 Received: by dhcp-1-237.tlv.redhat.com (Postfix, from userid 13519) id BE4FB18D46D; Mon, 1 Nov 2010 14:55:51 +0200 (IST) Date: Mon, 1 Nov 2010 14:55:51 +0200 From: Gleb Natapov To: Xiao Guangrong Cc: Avi Kivity , Marcelo Tosatti , LKML , KVM Subject: Re: [RFC PATCH v2 7/7] KVM: KVM: don't break vcpu 'halt' state due to apfs Message-ID: <20101101125551.GD31722@redhat.com> References: <4CCE8143.3090105@cn.fujitsu.com> <4CCE82BC.3090000@cn.fujitsu.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <4CCE82BC.3090000@cn.fujitsu.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Mon, 01 Nov 2010 12:56:20 +0000 (UTC) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 2cfdf2d..f7aed95 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -5295,8 +5295,9 @@ static int __vcpu_run(struct kvm_vcpu *vcpu) { switch(vcpu->arch.mp_state) { case KVM_MP_STATE_HALTED: - vcpu->arch.mp_state = - KVM_MP_STATE_RUNNABLE; + if (list_empty_careful(&vcpu->async_pf.done)) + vcpu->arch.mp_state = + KVM_MP_STATE_RUNNABLE; case KVM_MP_STATE_RUNNABLE: vcpu->arch.apf.halted = false; break; @@ -6279,6 +6280,7 @@ void kvm_arch_async_page_present(struct kvm_vcpu *vcpu, vcpu->arch.fault.error_code = 0; vcpu->arch.fault.address = work->arch.token; kvm_inject_page_fault(vcpu); + vcpu->arch.mp_state = KVM_MP_STATE_RUNNABLE; } }