From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH 5/6] Nested SVM: Implement INVLPGA Date: Sun, 17 May 2009 23:02:17 +0300 Message-ID: <4A106D49.7080600@redhat.com> References: <1242375740-31222-1-git-send-email-agraf@suse.de> <1242375740-31222-2-git-send-email-agraf@suse.de> <1242375740-31222-3-git-send-email-agraf@suse.de> <1242375740-31222-4-git-send-email-agraf@suse.de> <1242375740-31222-5-git-send-email-agraf@suse.de> <1242375740-31222-6-git-send-email-agraf@suse.de> <20090515134301.GX9835@amd.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Alexander Graf , kvm@vger.kernel.org To: Joerg Roedel Return-path: Received: from mx2.redhat.com ([66.187.237.31]:54034 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752250AbZEQUCW (ORCPT ); Sun, 17 May 2009 16:02:22 -0400 In-Reply-To: <20090515134301.GX9835@amd.com> Sender: kvm-owner@vger.kernel.org List-ID: Joerg Roedel wrote: > On Fri, May 15, 2009 at 10:22:19AM +0200, Alexander Graf wrote: > >> SVM adds another way to do INVLPG by ASID which Hyper-V makes use of, >> so let's implement it! >> >> For now we just do the same thing invlpg does, as asid switching >> means we flush the mmu anyways. That might change one day though. >> >> >> +static int invlpga_interception(struct vcpu_svm *svm, struct kvm_run *kvm_run) >> +{ >> + struct kvm_vcpu *vcpu = &svm->vcpu; >> + nsvm_printk("INVLPGA\n"); >> + svm->next_rip = kvm_rip_read(&svm->vcpu) + 3; >> + skip_emulated_instruction(&svm->vcpu); >> + >> + kvm_mmu_reset_context(vcpu); >> + kvm_mmu_load(vcpu); >> + return 1; >> +} >> + >> > > Hmm, since we flush the TLB on every nested-guest entry I think we can > make this function a nop. > I think, unless it specified ASID 0? In that case you need a local tlb flush. (the kvm_mmu_reset_context() and kvm_mmu_load() are total overkills in any case). -- Do not meddle in the internals of kernels, for they are subtle and quick to panic.