From patchwork Thu Jun 11 15:07:41 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcelo Tosatti X-Patchwork-Id: 29596 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n5BFEuEg029239 for ; Thu, 11 Jun 2009 15:14:56 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758099AbZFKPOr (ORCPT ); Thu, 11 Jun 2009 11:14:47 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1758766AbZFKPOr (ORCPT ); Thu, 11 Jun 2009 11:14:47 -0400 Received: from mx2.redhat.com ([66.187.237.31]:49751 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757835AbZFKPOp (ORCPT ); Thu, 11 Jun 2009 11:14:45 -0400 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 n5BFEmIT014156 for ; Thu, 11 Jun 2009 11:14:48 -0400 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 n5BFEgBh016903; Thu, 11 Jun 2009 11:14:43 -0400 Received: from amt.cnet (vpn-10-91.str.redhat.com [10.32.10.91]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n5BFEdtm002933; Thu, 11 Jun 2009 11:14:41 -0400 Received: from amt.cnet (amt.cnet [127.0.0.1]) by amt.cnet (Postfix) with ESMTP id 3875667421C; Thu, 11 Jun 2009 12:14:31 -0300 (BRT) Received: (from root@localhost) by amt.cnet (8.14.3/8.14.3/Submit) id n5BFETGP006653; Thu, 11 Jun 2009 12:14:29 -0300 Message-Id: <20090611150845.705086787@localhost.localdomain> References: <20090611150739.140947079@localhost.localdomain> In-Reply-To: <4A311529.3070907@redhat.com> User-Agent: quilt/0.46-1 Date: Thu, 11 Jun 2009 12:07:41 -0300 From: Marcelo Tosatti To: avi@redhat.com Cc: kvm@vger.kernel.org, Marcelo Tosatti Subject: [patch 2/5] KVM: MMU: make for_each_shadow_entry aware of largepages Content-Disposition: inline; filename=kvm-shadow-iterator-largepage-descend X-Scanned-By: MIMEDefang 2.58 on 172.16.27.26 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org This way there is no need to add explicit checks in every for_each_shadow_entry user. Signed-off-by: Marcelo Tosatti Index: kvm/arch/x86/kvm/mmu.c =================================================================== --- kvm.orig/arch/x86/kvm/mmu.c +++ kvm/arch/x86/kvm/mmu.c @@ -1273,6 +1273,11 @@ static bool shadow_walk_okay(struct kvm_ { if (iterator->level < PT_PAGE_TABLE_LEVEL) return false; + + if (iterator->level == PT_PAGE_TABLE_LEVEL) + if (is_large_pte(*iterator->sptep)) + return false; + iterator->index = SHADOW_PT_INDEX(iterator->addr, iterator->level); iterator->sptep = ((u64 *)__va(iterator->shadow_addr)) + iterator->index; return true;