KVM: MMU: Merge shadow level check in FNAME(fetch)
authorDong, Eddie <eddie.dong@intel.com>
Wed, 2 Jan 2008 06:29:08 +0000 (14:29 +0800)
committerAvi Kivity <avi@qumranet.com>
Wed, 30 Jan 2008 16:01:21 +0000 (18:01 +0200)
Remove the redundant level check when fetching
shadow pte for present & non-present spte.

Signed-off-by: Yaozu (Eddie) Dong <eddie.dong@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
arch/x86/kvm/paging_tmpl.h

index 349920556be391bfd7911ff10ecaf9ce54273315..03ba8608fe0f43816c91fc2bdc77b1c22725d7bb 100644 (file)
@@ -300,16 +300,13 @@ static u64 *FNAME(fetch)(struct kvm_vcpu *vcpu, gva_t addr,
                bool new_page = 0;
 
                shadow_ent = ((u64 *)__va(shadow_addr)) + index;
+               if (level == PT_PAGE_TABLE_LEVEL)
+                       break;
                if (is_shadow_present_pte(*shadow_ent)) {
-                       if (level == PT_PAGE_TABLE_LEVEL)
-                               break;
                        shadow_addr = *shadow_ent & PT64_BASE_ADDR_MASK;
                        continue;
                }
 
-               if (level == PT_PAGE_TABLE_LEVEL)
-                       break;
-
                if (level - 1 == PT_PAGE_TABLE_LEVEL
                    && walker->level == PT_DIRECTORY_LEVEL) {
                        metaphysical = 1;