From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757886AbcLONKA (ORCPT ); Thu, 15 Dec 2016 08:10:00 -0500 Received: from mx1.redhat.com ([209.132.183.28]:56182 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751862AbcLONJ7 (ORCPT ); Thu, 15 Dec 2016 08:09:59 -0500 Subject: Re: [PATCH v3] kvm: svm: Use the hardware provided GPA instead of page walk To: Paolo Bonzini , Brijesh Singh , kvm@vger.kernel.org References: <148174555164.13485.11526818510637119259.stgit@brijesh-build-machine> <148174556351.13485.18084576305677228092.stgit@brijesh-build-machine> <1f538be1-b5f1-d095-01be-38a30db62045@redhat.com> <71035e94-f1c0-409c-e58d-2d4a3ea75db5@redhat.com> Cc: thomas.lendacky@amd.com, rkrcmar@redhat.com, joro@8bytes.org, x86@kernel.org, linux-kernel@vger.kernel.org, mingo@redhat.com, hpa@zytor.com, tglx@linutronix.de, bp@suse.de From: David Hildenbrand Organization: Red Hat GmbH Message-ID: <5be2e278-fca0-d08a-3f2a-aa8ec70c9b9e@redhat.com> Date: Thu, 15 Dec 2016 14:09:53 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <71035e94-f1c0-409c-e58d-2d4a3ea75db5@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 15 Dec 2016 13:09:58 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org >>> + * If the exit was due to a NPF we may already have a GPA. >>> + * If the GPA is present, use it to avoid the GVA to GPA table walk. >>> + * Note, this cannot be used on string operations since string >>> + * operation using rep will only have the initial GPA from the NPF >>> + * occurred. >>> + */ >> >> I was wondering if it would make sense to get rid of gpa_available and >> rather define a new function: >> >> bool exception_gpa_valid(struct kvm_vcpu) >> { >> // check if svm >> // check if exit code is NPF >> // check ctxt >> } > > No, this would be a layering violation. The emulator ops don't know > about svm and exit codes (and in fact it's trivial to implement this > optimization for vmx, with a slightly different logic), so we need to > have gpa_available. I was rather thinking about adding an vmx/svm independent callback, which would return false for vmx for now. I just saw the variable and was wondering if it is really necessary. -- David