From patchwork Tue Jul 6 16:25:00 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gleb Natapov X-Patchwork-Id: 110461 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o66GUNCR018060 for ; Tue, 6 Jul 2010 16:32:44 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754690Ab0GFQ1d (ORCPT ); Tue, 6 Jul 2010 12:27:33 -0400 Received: from mx1.redhat.com ([209.132.183.28]:16192 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753891Ab0GFQZ2 (ORCPT ); Tue, 6 Jul 2010 12:25:28 -0400 Received: from int-mx05.intmail.prod.int.phx2.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.18]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o66GP4u7004789 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 6 Jul 2010 12:25:04 -0400 Received: from dhcp-1-237.tlv.redhat.com (dhcp-1-237.tlv.redhat.com [10.35.1.237]) by int-mx05.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o66GP3k7025899; Tue, 6 Jul 2010 12:25:03 -0400 Received: by dhcp-1-237.tlv.redhat.com (Postfix, from userid 13519) id ED3A9134417; Tue, 6 Jul 2010 19:25:00 +0300 (IDT) From: Gleb Natapov To: kvm@vger.kernel.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, avi@redhat.com, mingo@elte.hu, a.p.zijlstra@chello.nl, tglx@linutronix.de, hpa@zytor.com, riel@redhat.com, cl@linux-foundation.org, mtosatti@redhat.com Subject: [PATCH v4 12/12] Send async PF when guest is not in userspace too. Date: Tue, 6 Jul 2010 19:25:00 +0300 Message-Id: <1278433500-29884-13-git-send-email-gleb@redhat.com> In-Reply-To: <1278433500-29884-1-git-send-email-gleb@redhat.com> References: <1278433500-29884-1-git-send-email-gleb@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.18 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 (demeter.kernel.org [140.211.167.41]); Tue, 06 Jul 2010 16:32:44 +0000 (UTC) diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index 95a0a8b..297f399 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c @@ -2280,7 +2280,13 @@ static bool can_do_async_pf(struct kvm_vcpu *vcpu) if (!vcpu->arch.apf_data || kvm_event_needs_reinjection(vcpu)) return false; - return !!kvm_x86_ops->get_cpl(vcpu); + if (vcpu->arch.apf_send_user_only) + return !!kvm_x86_ops->get_cpl(vcpu); + + if (!kvm_x86_ops->interrupt_allowed(vcpu)) + return false; + + return true; } static int tdp_page_fault(struct kvm_vcpu *vcpu, gva_t gpa, u32 error_code,