From patchwork Thu Jun 11 14:02:26 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcelo Tosatti X-Patchwork-Id: 29564 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 n5BE5YkA023350 for ; Thu, 11 Jun 2009 14:05:35 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752309AbZFKOFb (ORCPT ); Thu, 11 Jun 2009 10:05:31 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752108AbZFKOFa (ORCPT ); Thu, 11 Jun 2009 10:05:30 -0400 Received: from mx2.redhat.com ([66.187.237.31]:55352 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751878AbZFKOF1 (ORCPT ); Thu, 11 Jun 2009 10:05:27 -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 n5BE5TbW026911 for ; Thu, 11 Jun 2009 10:05:29 -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 n5BE5S50023759; Thu, 11 Jun 2009 10:05:28 -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 n5BE5QLP021793; Thu, 11 Jun 2009 10:05:27 -0400 Received: from amt.cnet (amt.cnet [127.0.0.1]) by amt.cnet (Postfix) with ESMTP id 06DB5275008; Thu, 11 Jun 2009 11:04:56 -0300 (BRT) Received: (from marcelo@localhost) by amt.cnet (8.14.3/8.14.3/Submit) id n5BE4sRo005887; Thu, 11 Jun 2009 11:04:54 -0300 Message-Id: <20090611140416.633810344@localhost.localdomain> References: <20090611140224.457657937@localhost.localdomain> In-Reply-To: <4A307819.6010503@redhat.com> User-Agent: quilt/0.46-1 Date: Thu, 11 Jun 2009 11:02:26 -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;