From mboxrd@z Thu Jan 1 00:00:00 1970 From: Xiao Guangrong Subject: [PATCH 5/9] KVM: MMU: fask check write-protect for direct mmu Date: Tue, 17 Jul 2012 21:53:29 +0800 Message-ID: <50056E59.4090003@linux.vnet.ibm.com> References: <50056DB8.7080702@linux.vnet.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: Avi Kivity , Marcelo Tosatti , LKML , KVM To: Xiao Guangrong Return-path: Received: from e23smtp01.au.ibm.com ([202.81.31.143]:53158 "EHLO e23smtp01.au.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754962Ab2GQNxg (ORCPT ); Tue, 17 Jul 2012 09:53:36 -0400 Received: from /spool/local by e23smtp01.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 17 Jul 2012 13:43:35 +1000 In-Reply-To: <50056DB8.7080702@linux.vnet.ibm.com> Sender: kvm-owner@vger.kernel.org List-ID: If it have no indirect shadow pages we need not protect any gfn, this is always true for direct mmu without nested Signed-off-by: Xiao Guangrong --- arch/x86/kvm/mmu.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index 28b12e2..a846a9c 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c @@ -2294,6 +2294,9 @@ static int mmu_need_write_protect(struct kvm_vcpu *vcpu, gfn_t gfn, struct hlist_node *node; bool need_unsync = false; + if (!vcpu->kvm->arch.indirect_shadow_pages) + return 0; + for_each_gfn_indirect_valid_sp(vcpu->kvm, s, gfn, node) { if (!can_unsync) return 1; -- 1.7.7.6