From mboxrd@z Thu Jan 1 00:00:00 1970 From: Borislav Petkov Subject: Re: [RFC PATCH v1 03/28] kvm: svm: Use the hardware provided GPA instead of page walk Date: Wed, 21 Sep 2016 19:16:59 +0200 Message-ID: <20160921171659.cvtkp5nf3r3afawi@pd.tnic> References: <147190820782.9523.4967724730957229273.stgit@brijesh-build-machine> <147190824754.9523.13923968456167130181.stgit@brijesh-build-machine> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Cc: simon.guinot@sequanux.org, linux-efi@vger.kernel.org, kvm@vger.kernel.org, rkrcmar@redhat.com, matt@codeblueprint.co.uk, linus.walleij@linaro.org, linux-mm@kvack.org, paul.gortmaker@windriver.com, hpa@zytor.com, dan.j.williams@intel.com, aarcange@redhat.com, sfr@canb.auug.org.au, andriy.shevchenko@linux.intel.com, herbert@gondor.apana.org.au, bhe@redhat.com, xemul@parallels.com, joro@8bytes.org, x86@kernel.org, mingo@redhat.com, msalter@redhat.com, ross.zwisler@linux.intel.com, dyoung@redhat.com, thomas.lendacky@amd.com, jroedel@suse.de, keescook@chromium.org, toshi.kani@hpe.com, mathieu.desnoyers@efficios.com, devel@linuxdriverproject.org, tglx@linutronix.de, mchehab@kernel.org, iamjoonsoo.kim@lge.com, labbott@fedoraproject.org, tony.luck@intel.com, alexandre.bounine@idt.com, kuleshovmail@gmail.com, linux-kernel@vger.kernel.org, mcgrof@kernel.org, linux-crypto@vger.k To: Brijesh Singh Return-path: Content-Disposition: inline In-Reply-To: <147190824754.9523.13923968456167130181.stgit@brijesh-build-machine> Sender: owner-linux-mm@kvack.org List-Id: linux-crypto.vger.kernel.org On Mon, Aug 22, 2016 at 07:24:07PM -0400, Brijesh Singh wrote: > From: Tom Lendacky > > When a guest causes a NPF which requires emulation, KVM sometimes walks > the guest page tables to translate the GVA to a GPA. This is unnecessary > most of the time on AMD hardware since the hardware provides the GPA in > EXITINFO2. > > The only exception cases involve string operations involving rep or > operations that use two memory locations. With rep, the GPA will only be > the value of the initial NPF and with dual memory locations we won't know > which memory address was translated into EXITINFO2. > > Signed-off-by: Tom Lendacky > --- > arch/x86/include/asm/kvm_emulate.h | 3 +++ > arch/x86/include/asm/kvm_host.h | 3 +++ > arch/x86/kvm/svm.c | 2 ++ > arch/x86/kvm/x86.c | 17 ++++++++++++++++- > 4 files changed, 24 insertions(+), 1 deletion(-) FWIW, LGTM. (Gotta love replying in acronyms :-)) Reviewed-by: Borislav Petkov -- Regards/Gruss, Boris. SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg) -- -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758075AbcIURRU (ORCPT ); Wed, 21 Sep 2016 13:17:20 -0400 Received: from mx2.suse.de ([195.135.220.15]:56686 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757492AbcIURRR (ORCPT ); Wed, 21 Sep 2016 13:17:17 -0400 Date: Wed, 21 Sep 2016 19:16:59 +0200 From: Borislav Petkov To: Brijesh Singh Cc: simon.guinot@sequanux.org, linux-efi@vger.kernel.org, kvm@vger.kernel.org, rkrcmar@redhat.com, matt@codeblueprint.co.uk, linus.walleij@linaro.org, linux-mm@kvack.org, paul.gortmaker@windriver.com, hpa@zytor.com, dan.j.williams@intel.com, aarcange@redhat.com, sfr@canb.auug.org.au, andriy.shevchenko@linux.intel.com, herbert@gondor.apana.org.au, bhe@redhat.com, xemul@parallels.com, joro@8bytes.org, x86@kernel.org, mingo@redhat.com, msalter@redhat.com, ross.zwisler@linux.intel.com, dyoung@redhat.com, thomas.lendacky@amd.com, jroedel@suse.de, keescook@chromium.org, toshi.kani@hpe.com, mathieu.desnoyers@efficios.com, devel@linuxdriverproject.org, tglx@linutronix.de, mchehab@kernel.org, iamjoonsoo.kim@lge.com, labbott@fedoraproject.org, tony.luck@intel.com, alexandre.bounine@idt.com, kuleshovmail@gmail.com, linux-kernel@vger.kernel.org, mcgrof@kernel.org, linux-crypto@vger.kernel.org, pbonzini@redhat.com, akpm@linux-foundation.org, davem@davemloft.net Subject: Re: [RFC PATCH v1 03/28] kvm: svm: Use the hardware provided GPA instead of page walk Message-ID: <20160921171659.cvtkp5nf3r3afawi@pd.tnic> References: <147190820782.9523.4967724730957229273.stgit@brijesh-build-machine> <147190824754.9523.13923968456167130181.stgit@brijesh-build-machine> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <147190824754.9523.13923968456167130181.stgit@brijesh-build-machine> User-Agent: NeoMutt/ (1.7.0) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 22, 2016 at 07:24:07PM -0400, Brijesh Singh wrote: > From: Tom Lendacky > > When a guest causes a NPF which requires emulation, KVM sometimes walks > the guest page tables to translate the GVA to a GPA. This is unnecessary > most of the time on AMD hardware since the hardware provides the GPA in > EXITINFO2. > > The only exception cases involve string operations involving rep or > operations that use two memory locations. With rep, the GPA will only be > the value of the initial NPF and with dual memory locations we won't know > which memory address was translated into EXITINFO2. > > Signed-off-by: Tom Lendacky > --- > arch/x86/include/asm/kvm_emulate.h | 3 +++ > arch/x86/include/asm/kvm_host.h | 3 +++ > arch/x86/kvm/svm.c | 2 ++ > arch/x86/kvm/x86.c | 17 ++++++++++++++++- > 4 files changed, 24 insertions(+), 1 deletion(-) FWIW, LGTM. (Gotta love replying in acronyms :-)) Reviewed-by: Borislav Petkov -- Regards/Gruss, Boris. SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg) -- From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f71.google.com (mail-wm0-f71.google.com [74.125.82.71]) by kanga.kvack.org (Postfix) with ESMTP id E610E280256 for ; Wed, 21 Sep 2016 13:17:16 -0400 (EDT) Received: by mail-wm0-f71.google.com with SMTP id w84so49107128wmg.1 for ; Wed, 21 Sep 2016 10:17:16 -0700 (PDT) Received: from mx2.suse.de (mx2.suse.de. [195.135.220.15]) by mx.google.com with ESMTPS id js8si28585465wjc.127.2016.09.21.10.17.15 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 21 Sep 2016 10:17:15 -0700 (PDT) Date: Wed, 21 Sep 2016 19:16:59 +0200 From: Borislav Petkov Subject: Re: [RFC PATCH v1 03/28] kvm: svm: Use the hardware provided GPA instead of page walk Message-ID: <20160921171659.cvtkp5nf3r3afawi@pd.tnic> References: <147190820782.9523.4967724730957229273.stgit@brijesh-build-machine> <147190824754.9523.13923968456167130181.stgit@brijesh-build-machine> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <147190824754.9523.13923968456167130181.stgit@brijesh-build-machine> Sender: owner-linux-mm@kvack.org List-ID: To: Brijesh Singh Cc: simon.guinot@sequanux.org, linux-efi@vger.kernel.org, kvm@vger.kernel.org, rkrcmar@redhat.com, matt@codeblueprint.co.uk, linus.walleij@linaro.org, linux-mm@kvack.org, paul.gortmaker@windriver.com, hpa@zytor.com, dan.j.williams@intel.com, aarcange@redhat.com, sfr@canb.auug.org.au, andriy.shevchenko@linux.intel.com, herbert@gondor.apana.org.au, bhe@redhat.com, xemul@parallels.com, joro@8bytes.org, x86@kernel.org, mingo@redhat.com, msalter@redhat.com, ross.zwisler@linux.intel.com, dyoung@redhat.com, thomas.lendacky@amd.com, jroedel@suse.de, keescook@chromium.org, toshi.kani@hpe.com, mathieu.desnoyers@efficios.com, devel@linuxdriverproject.org, tglx@linutronix.de, mchehab@kernel.org, iamjoonsoo.kim@lge.com, labbott@fedoraproject.org, tony.luck@intel.com, alexandre.bounine@idt.com, kuleshovmail@gmail.com, linux-kernel@vger.kernel.org, mcgrof@kernel.org, linux-crypto@vger.kernel.org, pbonzini@redhat.com, akpm@linux-foundation.org, davem@davemloft.net On Mon, Aug 22, 2016 at 07:24:07PM -0400, Brijesh Singh wrote: > From: Tom Lendacky > > When a guest causes a NPF which requires emulation, KVM sometimes walks > the guest page tables to translate the GVA to a GPA. This is unnecessary > most of the time on AMD hardware since the hardware provides the GPA in > EXITINFO2. > > The only exception cases involve string operations involving rep or > operations that use two memory locations. With rep, the GPA will only be > the value of the initial NPF and with dual memory locations we won't know > which memory address was translated into EXITINFO2. > > Signed-off-by: Tom Lendacky > --- > arch/x86/include/asm/kvm_emulate.h | 3 +++ > arch/x86/include/asm/kvm_host.h | 3 +++ > arch/x86/kvm/svm.c | 2 ++ > arch/x86/kvm/x86.c | 17 ++++++++++++++++- > 4 files changed, 24 insertions(+), 1 deletion(-) FWIW, LGTM. (Gotta love replying in acronyms :-)) Reviewed-by: Borislav Petkov -- Regards/Gruss, Boris. SUSE Linux GmbH, GF: Felix ImendA?rffer, Jane Smithard, Graham Norton, HRB 21284 (AG NA 1/4 rnberg) -- -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org