浏览代码

KVM: MMU: Drop cr4.pge from shadow page role

Since commit bf47a760f66ad, we no longer handle ptes with the global bit
set specially, so there is no reason to distinguish between shadow pages
created with cr4.gpe set and clear.

Such tracking is expensive when the guest toggles cr4.pge, so drop it.

Signed-off-by: Avi Kivity <avi@redhat.com>
Avi Kivity 15 年之前
父节点
当前提交
87bc3bf972
共有 3 个文件被更改,包括 1 次插入4 次删除
  1. 0 1
      arch/x86/include/asm/kvm_host.h
  2. 1 2
      arch/x86/kvm/mmutrace.h
  3. 0 1
      arch/x86/kvm/x86.c

+ 0 - 1
arch/x86/include/asm/kvm_host.h

@@ -178,7 +178,6 @@ union kvm_mmu_page_role {
 		unsigned direct:1;
 		unsigned direct:1;
 		unsigned access:3;
 		unsigned access:3;
 		unsigned invalid:1;
 		unsigned invalid:1;
-		unsigned cr4_pge:1;
 		unsigned nxe:1;
 		unsigned nxe:1;
 	};
 	};
 };
 };

+ 1 - 2
arch/x86/kvm/mmutrace.h

@@ -28,7 +28,7 @@
 								        \
 								        \
 	role.word = __entry->role;					\
 	role.word = __entry->role;					\
 									\
 									\
-	trace_seq_printf(p, "sp gfn %llx %u%s q%u%s %s%s %spge"		\
+	trace_seq_printf(p, "sp gfn %llx %u%s q%u%s %s%s"		\
 			 " %snxe root %u %s%c",				\
 			 " %snxe root %u %s%c",				\
 			 __entry->gfn, role.level,			\
 			 __entry->gfn, role.level,			\
 			 role.cr4_pae ? " pae" : "",			\
 			 role.cr4_pae ? " pae" : "",			\
@@ -36,7 +36,6 @@
 			 role.direct ? " direct" : "",			\
 			 role.direct ? " direct" : "",			\
 			 access_str[role.access],			\
 			 access_str[role.access],			\
 			 role.invalid ? " invalid" : "",		\
 			 role.invalid ? " invalid" : "",		\
-			 role.cr4_pge ? "" : "!",			\
 			 role.nxe ? "" : "!",				\
 			 role.nxe ? "" : "!",				\
 			 __entry->root_count,				\
 			 __entry->root_count,				\
 			 __entry->unsync ? "unsync" : "sync", 0);	\
 			 __entry->unsync ? "unsync" : "sync", 0);	\

+ 0 - 1
arch/x86/kvm/x86.c

@@ -488,7 +488,6 @@ void kvm_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4)
 	}
 	}
 	kvm_x86_ops->set_cr4(vcpu, cr4);
 	kvm_x86_ops->set_cr4(vcpu, cr4);
 	vcpu->arch.cr4 = cr4;
 	vcpu->arch.cr4 = cr4;
-	vcpu->arch.mmu.base_role.cr4_pge = (cr4 & X86_CR4_PGE) && !tdp_enabled;
 	kvm_mmu_reset_context(vcpu);
 	kvm_mmu_reset_context(vcpu);
 }
 }
 EXPORT_SYMBOL_GPL(kvm_set_cr4);
 EXPORT_SYMBOL_GPL(kvm_set_cr4);