clean the redundant level check when fetching
shadow pte for present & non-present spte.


Signed-off-by: Yaozu (Eddie) Dong <[EMAIL PROTECTED]>

diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h
index 56b88f7..735d532 100644
--- a/arch/x86/kvm/paging_tmpl.h
+++ b/arch/x86/kvm/paging_tmpl.h
@@ -292,16 +292,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;

Attachment: tlb-clean4.patch
Description: tlb-clean4.patch

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel

Reply via email to