On Wed, 2024-04-10 at 15:07 -0700, isaku.yamahata@xxxxxxxxx wrote: > @@ -5882,18 +5884,40 @@ int kvm_arch_vcpu_map_memory(struct kvm_vcpu *vcpu, > if (!tdp_enabled) > return -EOPNOTSUPP; > > + /* Force to use L1 GPA despite of vcpu MMU mode. */ > + is_smm = !!(vcpu->arch.hflags & HF_SMM_MASK); > + if (is_smm || > + vcpu->arch.mmu != &vcpu->arch.root_mmu || > + vcpu->arch.walk_mmu != &vcpu->arch.root_mmu) { > + vcpu->arch.hflags &= ~HF_SMM_MASK; > + mmu = vcpu->arch.mmu; > + walk_mmu = vcpu->arch.walk_mmu; > + vcpu->arch.mmu = &vcpu->arch.root_mmu; > + vcpu->arch.walk_mmu = &vcpu->arch.root_mmu; > + kvm_mmu_reset_context(vcpu); > + } > + > /* reload is optimized for repeated call. */ After the kvm_mmu_reset_context(), what benefit is there to the operation? And it happening for every call of kvm_arch_vcpu_map_memory()? > kvm_mmu_reload(vcpu);