Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp3614210ybl; Sun, 12 Jan 2020 22:48:06 -0800 (PST) X-Google-Smtp-Source: APXvYqykHNF7lHFYb4m/3fohdgsdYvIPoKPnTas6JBiQEmtnwqN/u2ufT+b6ivGrRZ48Q+Z4n53A X-Received: by 2002:a05:6830:13d3:: with SMTP id e19mr12136517otq.135.1578898085974; Sun, 12 Jan 2020 22:48:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578898085; cv=none; d=google.com; s=arc-20160816; b=DaNUmJso3lK1Zbqzer22c7BS6kKLSPvnSpQwhZ3K43v7Jpn7YlkOKzRJzQZOPbEEQV S6V0rKVgfVLV5P2+L2x9LPhu1US3bFZX2dC6J+M/G+pg5piPh1c/QV77BDCW4eZzALws 7Salt3vQiAm9OWD60ldrLwnHw1Wn9VaYdvsmeNZ0kflTknJhmaWakE9hb5Ul08VRpf97 7Egm/2I4ccLhGxJnJIzKyIePGH3HYq4SgiF2yek6T9BSpIfCUbenbVk9pDeZUCDkS92i zcpYpntAzVNe2qd3HwFUTb0PEw0nVOn4hX7ZhssRnn1SMX9bf65gur6K+dBzmUtrWakz IyUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=M0MHCuSNT/aiqECSm2rLu8e+Ugiapf+vFAYn8TvVooM=; b=USZCYS3oU2iYE9ytmst80TDNlB4YCedCJ7ByFv6FvcbGuD72S7KitYzD6Id8MQE/tS q1Mr4XRN7s3ndAI+ruWHh3J0xNR47/RvcIklQU8ZjvJrcEnqPPobt5BCaxbbhtl6YKk1 YtZZseQF0zed1OE40G6ebtOhFv0zYZcDQhHmOyOGDTXu+Kdjjaf7BBhxqcvdLMQsQfMj 0HWm+FrIengc0Q1MGN6Br0HrBUFwLJTE9KrhRQxYFSFy1tEuboP+VV+hY8RswqHqX3cU K9+yf2kvhoFMnTPGy4xfVKq57beY5oKSX8sPzJUUuJwzHC7TAcUF920TjzCm2iCcF9LT qBKQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z65si5214330oia.33.2020.01.12.22.47.53; Sun, 12 Jan 2020 22:48:05 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726976AbgAMGpy (ORCPT + 99 others); Mon, 13 Jan 2020 01:45:54 -0500 Received: from mga12.intel.com ([192.55.52.136]:4214 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725954AbgAMGpy (ORCPT ); Mon, 13 Jan 2020 01:45:54 -0500 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Jan 2020 22:45:53 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,428,1571727600"; d="scan'208";a="397069155" Received: from unknown (HELO localhost) ([10.239.159.128]) by orsmga005.jf.intel.com with ESMTP; 12 Jan 2020 22:45:51 -0800 Date: Mon, 13 Jan 2020 14:50:13 +0800 From: Yang Weijiang To: Sean Christopherson Cc: Yang Weijiang , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, pbonzini@redhat.com, jmattson@google.com, yu.c.zhang@linux.intel.com, alazar@bitdefender.com, edwin.zhai@intel.com Subject: Re: [RESEND PATCH v10 06/10] vmx: spp: Set up SPP paging table at vmentry/vmexit Message-ID: <20200113065012.GE12253@local-michael-cet-test.sh.intel.com> References: <20200102061319.10077-1-weijiang.yang@intel.com> <20200102061319.10077-7-weijiang.yang@intel.com> <20200110175537.GF21485@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200110175537.GF21485@linux.intel.com> User-Agent: Mutt/1.11.3 (2019-02-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 10, 2020 at 09:55:37AM -0800, Sean Christopherson wrote: > On Thu, Jan 02, 2020 at 02:13:15PM +0800, Yang Weijiang wrote: > > If write to subpage is not allowed, EPT violation generates > > and it's handled in fast_page_fault(). > > > > In current implementation, SPPT setup is only handled in handle_spp() > > vmexit handler, it's triggered when SPP bit is set in EPT leaf > > entry while SPPT entries are not ready. > > > > A SPP specific bit(11) is added to exit_qualification and a new > > exit reason(66) is introduced for SPP. > > ... > > > diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c > > index 6f92b40d798c..c41791ebee65 100644 > > --- a/arch/x86/kvm/mmu/mmu.c > > +++ b/arch/x86/kvm/mmu/mmu.c > > @@ -6372,6 +6427,8 @@ unsigned long kvm_mmu_calculate_default_mmu_pages(struct kvm *kvm) > > return nr_mmu_pages; > > } > > > > +#include "spp.c" > > + > > Unless there is a *very* good reason for these shenanigans, spp.c needs > to built via the Makefile like any other source. If this is justified > for whatever reason, then that justification needs to be very clearly > stated in the changelog. Yes, it looks odd. When extracted the SPP code from mmu.c, I found a lot of functions in mmu.c should be exposed so that spp.c can see them, I took them as unnecessary modification to mmu.c, so just add the spp.c file back to mmu.c, if you suggest change it with a seperate object file, I'll do it. > > In general, the code organization of this entire series likely needs to > be overhauled. There are gobs exports which are either completely > unnecessary or completely backswards. > > E.g. exporting VMX-only functions from spp.c, which presumably are only > callbed by VMX. > > EXPORT_SYMBOL_GPL(vmx_spp_flush_sppt); > EXPORT_SYMBOL_GPL(vmx_spp_init); > > Exporting ioctl helpers from the same file, which are presumably called > only from x86.c. > > EXPORT_SYMBOL_GPL(kvm_vm_ioctl_get_subpages); > EXPORT_SYMBOL_GPL(kvm_vm_ioctl_set_subpages); Thanks for the suggestion, I'll go over the patches and or-organize them.