Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp992191imu; Wed, 23 Jan 2019 09:05:02 -0800 (PST) X-Google-Smtp-Source: ALg8bN73/K2hfX4dqOkBRsEKTmPWdbywuzpCFeG6AdBzba1bLeryJOn+GOIl6G/Ib88jAlBAhKNd X-Received: by 2002:a62:2fc3:: with SMTP id v186mr2733004pfv.82.1548263102652; Wed, 23 Jan 2019 09:05:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548263102; cv=none; d=google.com; s=arc-20160816; b=m0GPmAdj8Z6P8yh0rsmKq3GZ/T3x5iQaxXkPjf9N/EaDTu+Wq2SCyaXaaKJSLXYND1 /2+790YhqaOYKhrUs1jDkk5U1WY1T2R6zi7pDNCIDBOgMr7C0ibzdGkF6MZwtWn8N5IQ Z1g83f0dw6QqcOraxx/Lpxv3fVSY8lPQLrKMOHykfFZufM3pXQnPEN2aMfXc1jL/r/x1 LBg8tFZRRgBlbH9KMLWPcL2EJMbJYrZyW/1/6UoCH40oQgrtzRQpsHdnAuOrHmRJQbQS xm2K/Da77FZFvr6cBuLBJIz5s7Jj3rC7Ust8XaFbn5zSkldTZTcFTF9l/I0Oz8vTLFNM BM2g== 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:dkim-signature; bh=X/uCg52rQL0X37oiYpP9CWxwi/dxjQRWHrF1dQtkiuA=; b=OvhxaNZD2swIDT5AL5r5u0lDD3jzkCbtVjrP/ggWXTeJ5FoFGMTbfkXn9sxvw8YqkN AS2Euq1cEBuIESnoDX/N3GWgex+QSjj+SnyAmR4cHQdcpXMhMnRRen/ZAMa3GBQVWyI7 gdoKE+LEt7eCPu1mNuAGPbznF028JjSI87dv9y712Qarui93naSAaXPUPrZnjT3xh1AF aENIEK7JrN7VCPwXTb9WoNVMNn5CZynGYitAIgwaia0Ti5SRt31vDfqdtFSTwQZwVtbL 7FBfupklYpixc72s9bKXPzuPyKMmdhvpyLkdKWZC3VltXFFvmPYxcG/Yr0uQH5Bryyju 5nAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=m3Mvx4DX; 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=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v141si19903624pfc.260.2019.01.23.09.04.30; Wed, 23 Jan 2019 09:05:02 -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; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=m3Mvx4DX; 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=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726262AbfAWRAG (ORCPT + 99 others); Wed, 23 Jan 2019 12:00:06 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:54456 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725987AbfAWRAG (ORCPT ); Wed, 23 Jan 2019 12:00:06 -0500 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id x0NGxGjX009140; Wed, 23 Jan 2019 17:00:01 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=corp-2018-07-02; bh=X/uCg52rQL0X37oiYpP9CWxwi/dxjQRWHrF1dQtkiuA=; b=m3Mvx4DXCEzPkctG86kSTMiukCisQxEVuw4HPq1xMIvjQC55PTP/6/YLN5B/5X7a/1a5 jYLs2nqmxAedk7MTpdK1NzhwLHPkZRqEMwdi/IcCXfmoGEO9+Rje5MaKFnPdsDppeyOS yvOleAvb3YVvFPmw4+7FWN/7xAxMULvivkjvoGMu2rV5YF9JhKXiZbfUBrxWCi5KDLIY ZhAA8c3DzrYbwUMoL81lj9G72j6SAFoxUAGeMG+d1IX5sNp+TnzyhAED8QlCN+1wEvHc Tchwxptl42thWNZgpFeEqbmXbFnQ3TXQhFpbSFRJWdyPjR98JeTklQ1x/XsL+XcYHyOC RA== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by aserp2130.oracle.com with ESMTP id 2q3sdekaea-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 23 Jan 2019 17:00:01 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id x0NH00ig023145 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 23 Jan 2019 17:00:00 GMT Received: from abhmp0016.oracle.com (abhmp0016.oracle.com [141.146.116.22]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x0NGxxwx024081; Wed, 23 Jan 2019 16:59:59 GMT Received: from Konrads-MacBook-Pro.local (/75.104.64.133) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 23 Jan 2019 08:59:59 -0800 Date: Wed, 23 Jan 2019 11:59:45 -0500 From: Konrad Rzeszutek Wilk To: KarimAllah Ahmed Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, pbonzini@redhat.com, rkrcmar@redhat.com Subject: Re: [PATCH v5 01/13] X86/nVMX: handle_vmon: Read 4 bytes from guest memory Message-ID: <20190123165932.GF19289@Konrads-MacBook-Pro.local> References: <1547026933-31226-1-git-send-email-karahmed@amazon.de> <1547026933-31226-2-git-send-email-karahmed@amazon.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1547026933-31226-2-git-send-email-karahmed@amazon.de> User-Agent: Mutt/1.9.4 (2018-02-28) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9145 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1901230125 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 09, 2019 at 10:42:01AM +0100, KarimAllah Ahmed wrote: > Read the data directly from guest memory instead of the map->read->unmap > sequence. This also avoids using kvm_vcpu_gpa_to_page() and kmap() which > assumes that there is a "struct page" for guest memory. > > Suggested-by: Jim Mattson > Signed-off-by: KarimAllah Ahmed > Reviewed-by: Jim Mattson > Reviewed-by: David Hildenbrand Mind if I join party? Reviewed-by: Konrad Rzeszutek Wilk > > --- > v1 -> v2: > - Massage commit message a bit. > --- > arch/x86/kvm/vmx/nested.c | 14 +++----------- > 1 file changed, 3 insertions(+), 11 deletions(-) > > diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c > index 3170e29..536468a 100644 > --- a/arch/x86/kvm/vmx/nested.c > +++ b/arch/x86/kvm/vmx/nested.c > @@ -4192,7 +4192,7 @@ static int handle_vmon(struct kvm_vcpu *vcpu) > { > int ret; > gpa_t vmptr; > - struct page *page; > + uint32_t revision; > struct vcpu_vmx *vmx = to_vmx(vcpu); > const u64 VMXON_NEEDED_FEATURES = FEATURE_CONTROL_LOCKED > | FEATURE_CONTROL_VMXON_ENABLED_OUTSIDE_SMX; > @@ -4241,18 +4241,10 @@ static int handle_vmon(struct kvm_vcpu *vcpu) > if (!PAGE_ALIGNED(vmptr) || (vmptr >> cpuid_maxphyaddr(vcpu))) > return nested_vmx_failInvalid(vcpu); > > - page = kvm_vcpu_gpa_to_page(vcpu, vmptr); > - if (is_error_page(page)) > + if (kvm_read_guest(vcpu->kvm, vmptr, &revision, sizeof(revision)) || > + revision != VMCS12_REVISION) > return nested_vmx_failInvalid(vcpu); > > - if (*(u32 *)kmap(page) != VMCS12_REVISION) { > - kunmap(page); > - kvm_release_page_clean(page); > - return nested_vmx_failInvalid(vcpu); > - } > - kunmap(page); > - kvm_release_page_clean(page); > - > vmx->nested.vmxon_ptr = vmptr; > ret = enter_vmx_operation(vcpu); > if (ret) > -- > 2.7.4 >