From mboxrd@z Thu Jan 1 00:00:00 1970 From: Radim =?utf-8?B?S3LEjW3DocWZ?= Subject: Re: [PATCH 2/3] KVM: x86: Avoid guest page table walk when gpa_available is set Date: Fri, 18 Aug 2017 14:36:50 +0200 Message-ID: <20170818123649.GB20100@flask> References: <1502987818-24065-1-git-send-email-pbonzini@redhat.com> <1502987818-24065-3-git-send-email-pbonzini@redhat.com> <97f78603-3007-2418-653a-58a0d33a0523@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Paolo Bonzini , linux-kernel@vger.kernel.org, kvm@vger.kernel.org, wanpeng.li@hotmail.com, Brijesh Singh To: David Hildenbrand Return-path: Content-Disposition: inline In-Reply-To: <97f78603-3007-2418-653a-58a0d33a0523@redhat.com> Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org 2017-08-18 09:57+0200, David Hildenbrand: > > > +++ b/arch/x86/kvm/x86.c > > @@ -4657,25 +4657,18 @@ static int emulator_read_write_onepage(unsigned long addr, void *val, > > */ > > if (vcpu->arch.gpa_available && > > emulator_can_use_gpa(ctxt) && > > - vcpu_is_mmio_gpa(vcpu, addr, exception->address, write) && > > - (addr & ~PAGE_MASK) == (exception->address & ~PAGE_MASK)) { > > - gpa = exception->address; > > - goto mmio; > > + (addr & ~PAGE_MASK) == (vcpu->arch.gpa_val & ~PAGE_MASK)) { > > + gpa = vcpu->arch.gpa_val; > > + ret = vcpu_is_mmio_gpa(vcpu, addr, gpa, write); > > + } else { > > + ret = vcpu_mmio_gva_to_gpa(vcpu, addr, &gpa, exception, write); > > } > > > > - ret = vcpu_mmio_gva_to_gpa(vcpu, addr, &gpa, exception, write); > > - > > if (ret < 0) > > return X86EMUL_PROPAGATE_FAULT; > > just wondering if it makes sense to move this into the else branch (as > it logically only belongs to vcpu_mmio_gva_to_gpa) It does, I took the liberty to change that. > Reviewed-by: David Hildenbrand Thanks.