From patchwork Tue Jul 17 13:53:29 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiao Guangrong X-Patchwork-Id: 1205131 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 5652940073 for ; Tue, 17 Jul 2012 13:53:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755007Ab2GQNxj (ORCPT ); Tue, 17 Jul 2012 09:53:39 -0400 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 Received: from d23relay04.au.ibm.com (202.81.31.246) by e23smtp01.au.ibm.com (202.81.31.207) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 17 Jul 2012 13:43:33 +1000 Received: from d23av02.au.ibm.com (d23av02.au.ibm.com [9.190.235.138]) by d23relay04.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q6HDjW9A3735814; Tue, 17 Jul 2012 23:45:32 +1000 Received: from d23av02.au.ibm.com (loopback [127.0.0.1]) by d23av02.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q6HDrVqR030685; Tue, 17 Jul 2012 23:53:31 +1000 Received: from localhost.localdomain ([9.123.236.99]) by d23av02.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q6HDrTte030669; Tue, 17 Jul 2012 23:53:30 +1000 Message-ID: <50056E59.4090003@linux.vnet.ibm.com> Date: Tue, 17 Jul 2012 21:53:29 +0800 From: Xiao Guangrong User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120615 Thunderbird/13.0.1 MIME-Version: 1.0 To: Xiao Guangrong CC: Avi Kivity , Marcelo Tosatti , LKML , KVM Subject: [PATCH 5/9] KVM: MMU: fask check write-protect for direct mmu References: <50056DB8.7080702@linux.vnet.ibm.com> In-Reply-To: <50056DB8.7080702@linux.vnet.ibm.com> x-cbid: 12071703-1618-0000-0000-00000214409A Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org 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;