Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751489AbdHRH5m (ORCPT ); Fri, 18 Aug 2017 03:57:42 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58334 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750923AbdHRH5k (ORCPT ); Fri, 18 Aug 2017 03:57:40 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 6F787C047B61 Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=david@redhat.com Subject: Re: [PATCH 2/3] KVM: x86: Avoid guest page table walk when gpa_available is set To: Paolo Bonzini , linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: wanpeng.li@hotmail.com, rkrcmar@redhat.com, Brijesh Singh References: <1502987818-24065-1-git-send-email-pbonzini@redhat.com> <1502987818-24065-3-git-send-email-pbonzini@redhat.com> From: David Hildenbrand Organization: Red Hat GmbH Message-ID: <97f78603-3007-2418-653a-58a0d33a0523@redhat.com> Date: Fri, 18 Aug 2017 09:57:38 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <1502987818-24065-3-git-send-email-pbonzini@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Fri, 18 Aug 2017 07:57:40 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 953 Lines: 32 > +++ 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) Reviewed-by: David Hildenbrand -- Thanks, David